C Programming Multiple Choice Questions (MCQ) | IT Developer <?php echo $page_title; ?>
IT Developer

C Programming Multiple Choice Questions (MCQ)

C Programming - Conditional Statements & Loops Multiple Choice Questions (MCQ) - Set 2



Share with a Friend

Multiple Choice Questions


C Programming - Conditional Statements & Loops Multiple Choice Questions (MCQ) - Set 2

6. Choose a syntax for C Ternary Operator from the list.
A). condition ? expression1 : expression2
B). condition : expression1 ? expression2
C). condition ? expression1 < expression2
D). condition < expression1 ? expression2
View Answer
Correct: A




7. What is the output?
void main()
{
  int x = 5;
  if (true);
    printf("hello");
}
A). hello
B). Error
C). Blank
D). None of these
View Answer
Correct: A




8. What is the output of the C statement ?
int main()
{
    int a=0;
    a = 5<2 ? 4 : 3;
    printf("%d",a);

    return 0;
}
A). 4
B). 3
C). 5
D). 2
View Answer
Correct: B




9. If switch case is used, then
A). Default case must be present
B). Default case, if used, should not be the last case
C). Default case, if used, should be the last case
D). None of these
View Answer
Correct: C




10. What is the output of C Program ?
int main()
{
    int a=0;
    a = printf("4");
    printf("%d",a);

    return 0;
}
A). 04
B). compiler error
C). 40
D). 41
View Answer
Correct: D