Aptitude Test C Programming For Loops in on November 6, 2019 April 20, 2020 Share Facebook Twitter Pinterest Email 0 Welcome to Your Quiz: Aptitude Test C Programming For Loops Name Email 1. What will be the output of the following C code?#include <stdio.h>void main(){int k;for (k = -3; k < -5; k++)printf("Hello");}Infinite helloRun time errorNothingHello2. What will be the output of the following C code?#include <stdio.h>int main(){int i = 0;for (foo(); i == 1; i = 2)printf("In for loop\n");printf("After loop\n");}int foo(){return 1;}After loopInfinite loopIn for loop after loopCompile time error3. What will be the output of the following C code?#include <stdio.h>int main(){short i;for (i = 1; i >= 0; i++)printf("%d\n", i);}The control won’t fall into the for loopNumbers will be displayed until the signed limit of short and throw a runtime errorNumbers will be displayed until the signed limit of short and program will successfully terminateThis program will get into an infinite loop and keep printing numbers with no errors4. What will be the output of the following C code?#include <stdio.h>void main(){int k = 0;for (k)printf("Hello");}Compile time errorhelloVariesNothing5. What will be the output of the following C code?#include <stdio.h>int main(){int *p = NULL;for (foo(); p; p = 0)printf("In for loop\n");printf("After loop\n");}Infinite loopIn for loop after loopDepends on the value of NULLCompile time error6. What will be the output of the following C code?#include <stdio.h>int main(){int i = 0;for (i++; i == 1; i = 2)printf("In for loop ");printf("After loop\n");}In for loop after loopCompile time errorAfter loopUndefined behaviour7. What will be the output of the following C code?#include <stdio.h>void main(){double k = 0;for (k = 0.0; k < 3.0; k++)printf("Hello");}Hello is printed thriceHello is printed twiceRun time errorHello is printed infinitely8. What will be the output of the following C code?#include <stdio.h>void main(){double k = 0;for (k = 0.0; k < 3.0; k++);printf("%lf", k);}1.0000002.0000003.000000Run time error9. What will be the output of the following C code?#include <stdio.h>int main(){for (int i = 0;i < 1; i++)printf("In for loop\n");}In for loopCompile time errorDepends on the standard compiler implementsDepends on the compiler10. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)?functiontypedefmacrosvariable11. What will be the output of the following C code?#include <stdio.h>void main(){int k = 0;for (k < 3; k++)printf("Hello");}NothingCompile time errorHello is printed thriceVaries12. Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i < n; i++)?for (i = n; i>0; i–)for (i = n; i >= 0; i–)for (i = n-1; i>0; i–)for (i = n-1; i>-1; i–)13. What will be the output of the following C code?#include <stdio.h>int main(){int i = 0;for ( ; ; ; )printf("In for loop\n");printf("After loop\n");}Undefined behaviourCompile time errorAfter loopInfinite loop14. The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ___________exit(0)breakabort()terminate15. How many times the below loop will be executed?#include <stdio.h> int main() { int x, y; for(x=5; x>=1; x--){ for(y=1; y<=x; y++)printf("%d\n",y); } }12345123451234512345112345123412312111212312341234512345123412345121Thank You for Submitting your response for QuizAptitude Test C Programming For LoopsPlease click on View Result Button to see the Result. Time is Up!(Visited 217 times, 1 visits today) Share This Previous Post← Aptitude Test C Programming For If Else Statements Aptitude Test C Programming For If Else Statements