C Programming MCQ - Structure And Loops

11. For loop in a C program, if the condition is missing?

A. it is assumed to be present and taken to be false
B. it is assumed to be present and taken to the true
C. it result in a syntax error
D. execution will be terminated abruptly

View Answer


12.Which of the following statement about for loop is true ?

A. Index value is retained outside the loop
B. Index value can be changed from within the loop
C. Goto can be used to jump, out of the loop
D. All of these

View Answer


13.Using goto inside for loop is equivalent to using

A. Continue
B. Break
C. Return
D. None of the above

View Answer


14. If switch feature is used, then

A. Default case must be present
B. Default case, if used, should be the last case
C. Default case, if used, can be placed anywhere
D. None of the above

View Answer


15. Which of the following comments about for loop are correct ?

A. Using break is equivalent to using a goto that jumps to the statement immediately following the loop
B. Continue is used to by-pass the remainder of the current pass of the loop
C. If comma operator is used, then the value returned is the value of the right operand
D. All of the above

View Answer


16. In the context of "break" and "continue" statements in C, pick the best statement.

A. “break” and “continue” can be used in “for”, “while”, “do-while” loop body and “switch” body.
B. “break” and “continue” can be used in “for”, “while” and “do-while” loop body. But only “break” can be used in “switch” body.
C. “break” and “continue” can be used in “for”, “while” and “do-while” loop body. Besides, “continue” and “break” can be used in “switch” and “if-else” body.
D. “break” can be used in “for”, “while” and “do-while” loop body.

View Answer


17. In _______, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.

A. Loop unrolling
B. Strength reduction
C. Loop concatenation
D. Loop jamming

View Answer


18. What is the output of this program?

void main()
{
if(!printf(""))
printf("hello");
else
printf("world");
}

A. hello
B. world
C. Compilation Error
D. None of the above

View Answer


19. What is the output of this program?

#include <stdio.h>
void main()
{
int a=10;
if(a=5)
printf("YES");
else
printf("NO");
}

A. YES
B. NO
C. Error
D. None of the above

View Answer


20. What is correct about the given program?

#include <stdio.h>
int x;
void main()
{
if (x);
else
printf("Ëlse");
}

A. if block will be executed
B. else block will be executed
C. Depends on value of x since it is undeclared
D. Compilation Error

View Answer







Also check :


Discussion


* You must be logged in to add comment.