C Programming Objective Type Questions:
1. What is the output of the following code :
void main()
{
int x;
printf("%d",x);
}
a. 0 b. -1 c. Garbage d. None
2. For the purpose of language translation , C language uses:
a. Operating system b. Interpreter c. Compiler d. Interpreter
3. &&, ||, ! are the operators of type :
a. Relational b. Logical c. Conditional d. None
4. Output of following code
void main()
{
int x=10,y;
y=x++;
printf("x=%d y=%d",x,y);
}
a. x=11 y=11 b. x=11 y=10 c. x=10 y=11 d.None
5. Which of the following is ternary operator:
a. ++ b. % c. ?: d.None
6. __________ is the name given to any user defined variable, constant or function.
a. Keyword b. Identifier c.Variable d. None
7. What is the output of following code:
int x=10,y=20,i;
i=x<y;
printf("\n%d",i);
a. 1 b. 0 c.Garbage d.None
8. Whats is the output of following code :
int x=3;
main()
{
do
{
printf("x=%d\n",x--);
}while(x>0);
}
a. x= 3 b. x=2 c. x=3 d. None
x=2
x=1
9. Character variable can at a time store :
a. 1 character b. 4 character c. 256 character d. There is no limit
10. If a is an integer variable, then a=5/2 will return a value
a. 2.5 b.2 c. 3 d.0
11. What is the output of the following code:
void main()
{
int i=1;
while(i<=10);
{
printf("%d",i);
i++;
}
}
a. 1 2 3 …. 10 b. Infinite loop c. 10 d. 1 2 3 …9
12. We can use a break statement to exit from :
a. An if statement b. switch statement c. A program c. The main function
13. In which sequence the (i) Initialization (ii) Testing (iii)Increment/Decrement and (iv) execution of body of for loop takes place :
a. (i) (ii) (iii) (iv) b. (i) (iii) (ii) (iv) c. (i) (ii) (iv) (iii) d. (i) (iv) (ii) (iii)
14. A do-while loop is useful when we want that the statements within a loop must be executed :
a. Only once b. At least once c. More than once d. None of the above
15. The maximum number of values a function can return at a time is :
a. 0 b. 1 c. There is no limit. 4. 5
16. What would be output of following code:
void main()
{
int i=0;
for(;i<=5;i++);
{
printf("%d",i);
}
}
a. 6. B. 0 1 2 3 4 5 c. 0 1 2 3 4 d. 5
17. Equality operator is represented by :
a. = b. == c. .EQ. d.:=
18. The expression x+=4 is equivalent to :
a. x=x+4 b. x=4 c. x+4=x d. None
19. Which of the following is used to send the information from called function to calling function :
a. Send b. return c. fetch d. None
20. In order to make selection from multiple options which of the following is used :
a. Nested if-else b. Functions c. switch case d. do-while
Ans : 1. C 2.c 3. B 4. B 5.c 6. B 7.b 8. c 9. A. 10. B 11. B 12. B. 13. C. 14. B 15. B 16. A 17. B.
18. A 19. B. 20. C.
No comments:
Post a Comment