The document contains 10 multiple choice questions about C programming concepts like operators, loops, and variable names. For each question, the possible answers are given along with the correct answer. Some sample questions covered include the output of a code using pre-increment, post-increment and pre-decrement operators, the loop referred to as an exit controlled loop, unary operators in C, and the order of mathematical operators.
1 of 20
Download to read offline
More Related Content
G quiz
1. 1. What will be the output of the
following code.
int a=1;
printf("n%d %d %d",--a,a++,++a);
a. 2 2 2
b. 0 0 2
c. 0 0 1
d. 0 1 2
e. none of these
G-Quiz (C programming)
2. 1. What will be the output of the
following code.
int a=1;
printf("n%d %d %d",--a,a++,++a);
a. 2 2 2
b. 0 0 2
c. 0 0 1
d. 0 1 2
e. none of these
G-Quiz (C programming)
Correct Answer
a
3. 2. Which loop is called as exit controlled
loop?
a. while
b. do-while
c. while(1)
d. for
e. none of these
G-Quiz (C programming)
4. 2. Which loop is called as exit controlled
loop?
a. while
b. do-while
c. while(1)
d. for
e. none of these
G-Quiz (C programming)
Correct Answer
b
5. 3. What will be the output of the following
code.
a=5;
b=a++;
a=b?++a:a--;
printf("n%d",--a);
a. 4 b. 5 c. 6 d. 7
e. none of these
G-Quiz (C programming)
6. 3. What will be the output of the following
code.
a=5;
b=a++;
a=b?++a:a--;
printf("n%d",--a);
a. 4 b. 5 c. 6 d. 7
e. none of these
G-Quiz (C programming)
Correct Answer
c
7. 4. Which of the following special symbol
allowed in a variable name?
a. * (asterisk)
b. | (pipeline)
c. - (hyphen)
d. _ (underscore)
G-Quiz (C programming)
8. 4. Which of the following special symbol
allowed in a variable name?
a. * (asterisk)
b. | (pipeline)
c. - (hyphen)
d. _ (underscore)
G-Quiz (C programming)
Correct Answer
d
9. 5. How many times "IPL" is printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("IPL");
}
return 0;
}
G-Quiz (C programming)
a. Infinite times
b. 11 times
c. 0 times
d. 1 time
10. 5. How many times "IPL" is printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("IPL");
}
return 0;
}
a. Infinite times
b. 11 times
c. 0 times
d. 1 time
G-Quiz (C programming)
Correct Answer
c
11. 6. Which of the following is not logical
operator?
a. &
b. &&
c. ||
d. !
G-Quiz (C programming)
12. 6. Which of the following is not logical
operator?
a. &
b. &&
c. ||
d. !
G-Quiz (C programming)
Correct Answer
a
13. 7. Which bitwise operator is suitable for
turning off a particular bit in a number?
a. && operator
b. & operator
c || operator
d. ! operator
G-Quiz (C programming)
14. 7. Which bitwise operator is suitable for
turning off a particular bit in a number?
a. && operator
b. & operator
c || operator
d. ! operator
G-Quiz (C programming)
Correct Answer
b
15. 8. In mathematics and computer
programming, which is the correct
order of mathematical operators ?
G-Quiz (C programming)
a. Addition, Subtraction, Multiplication, Division
b. Division, Multiplication, Addition, Subtraction
c. Multiplication, Addition, Division, Subtraction
d. Addition, Division, Modulus, Subtraction
16. 8. In mathematics and computer
programming, which is the correct
order of mathematical operators ?
G-Quiz (C programming)
a. Addition, Subtraction, Multiplication, Division
b. Division, Multiplication, Addition, Subtraction
c. Multiplication, Addition, Division, Subtraction
d. Addition, Division, Modulus, Subtraction
Correct Answer = b
17. 9. Which of the following cannot be
checked in a switch-case statement?
G-Quiz (C programming)
a. char
b. int
c. float
d. enum
18. 9. Which of the following cannot be
checked in a switch-case statement?
G-Quiz (C programming)
a. char
b. int
c. float
d. enum
Correct Answer
c
19. 10. Which of the following are unary
operators in C?
1. !
2. sizeof
3. ~
4. &&
G-Quiz (C programming)
a. 1, 2 b. 1, 3
c. 2, 4 d. 1, 2, 3
20. 10. Which of the following are unary
operators in C?
1. !
2. sizeof
3. ~
4. &&
G-Quiz (C programming)
a. 1, 2 b. 1, 3
c. 2, 4 d. 1, 2, 3
Correct Answer
d