C LANGUAGE QUIZ
1 .
Which of the following are unary operators?

Correct Answer : Option (D)

all of the mentioned
  Show Answer
2 .
Which of the following method is accepted for assignment?

Correct Answer : Option (B)

a = b = c = d = 5;
  Show Answer
3 .
Which of the following is possible with any 2 operators in C?

Correct Answer : Option (D)

All of the mentioned
  Show Answer
4 .
What will be the output of the following C code?

#include <stdio.h>
    void main()
    {
        int x = 5;
        if (true);
            printf("hello");
    }‚Äč

Correct Answer : Option (B)

It will throw an error
  Show Answer
5 .
What will be the output of the following C code?
 
#include <stdio.h>
    void main()
    {
        int x = 0;
        if (x == 0)
            printf("hi");
        else
            printf("how are u");
            printf("hello");
    }

Correct Answer : Option (C)

hihello
  Show Answer
6 .
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)
 
#include <stdio.h>
    void main()
    {
        int ch;
        printf("enter a value between 1 to 2:");
        scanf("%d", &ch);
        switch (ch, ch + 1)
        {
           case 1:
              printf("1\n");
              break;
           case 2:
              printf("2");
              break;
        }
    }

Correct Answer : Option (A)

2
  Show Answer
7 .
The C code ‘for(;;)’ represents an infinite loop. It can be terminated by _______

Correct Answer : Option (A)

break
  Show Answer
8 .
Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i < n; i++)?

Correct Answer : Option (D)

for (i = n-1; i>-1; i–)
  Show Answer
9 .
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");
    }

Correct Answer : Option (B)

Hello is printed thrice
  Show Answer
10 .
What will be the output of the following C code?
 
#include <stdio.h>
    int main()
    {
        while ()
            printf("In while loop ");
        printf("After loop\n");
    }

Correct Answer : Option (D)

Compile time error
  Show Answer