wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming YCAP 3 Post Test ET B

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.
1.
a)
3.75
b)
Depends on compiler
c)
24
d)
3
2.
2.
a)
128
b)
-128
c)
Depends on the compiler
d)
None of the mentioned
3.
3.
a)
It will cause a compile-time error
b)
It will cause a run-time error
c)
It will run without any error and prints 3
d)
It will experience infinite looping
4.
4.Which of the following cannot be checked in a switch-case statement?
a)
Character
b)
Integer
c)
Float
d)
enum
5.
5.
a)
It compiles
b)
Compiles with an warning
c)
Not compile
d)
Compiles and print nothing
6.
6. There is a error in the below program. Which statement will you add to remove it?
a)
Add prototype: float f(aa, bb)
b)
Add prototype: float f(int, float)
c)
Add prototype: float f(float, int)
d)
Add prototype: float f(bb, aa)
7.
7.Which of the following statements correctly assigns 12 to month using pointer variable pdt?
a)
pdt.month = 12
b)
&pdt.month = 12
c)
d.month = 12
d)
pdt->month = 12
8.
8.What will be the output of the program ?
a)
2, 1, 15
b)
1, 2, 5
c)
3, 2, 15
d)
2, 3, 20
9.
a)
2, 3, 4, 5
b)
1, 2, 3, 4
c)
0, 1, 2, 3
d)
3, 2, 1 0
10.
10.What will be the output of the program ?#include #include int main() { char str1[20] = "Hello", str2[20] = " World"; printf("%s\n", strcpy(str2, strcat(str1, str2))); return 0; }
a)
Hello
b)
World
c)
Hello World
d)
WorldHello
11.
11.What will be the output of the program?
a)
5, 2
b)
10, 4
c)
2, 5
d)
25, 4
12.
12.What will be the output of the program?
a)
9
b)
10
c)
11
d)
8
13.
13.What will be the output of the program?
a)
b = 300 c = 200
b)
b = 100 c = garbage
c)
b = 300 c = garbage
d)
b = 100 c = 200
14.
14.What will be the output of the program?
a)
Infinite loop
b)
0 1 2 ... 65535
c)
0 1 2 ... 32767 - 32766 -32765 -1 0
d)
No output
15.
15.What will be the output of the program?#include
a)
x and y are equal
b)
x and y are not equal
c)
Unpredictable
d)
No output
16.
16.Point out the error, if any in the for loop.
a)
There should be a condition in the for loop
b)
The two semicolons should be dropped
c)
The for loop should be replaced with while loop.
d)
No error
17.
17.Point out the error, if any in the program.
a)
Error: No case statement specified
b)
Error: No default specified
c)
No Error
d)
Error: infinite loop occurs
18.
18.Point out the error, if any in the while loop.
a)
There should be a condition in the while loop
b)
There should be at least a semicolon in the while
c)
The while loop should be replaced with for loop.
d)
No error
19.
19.Which of the following errors would be reported by the compiler on compiling the program given below?
a)
There is no break statement in each case.
b)
Expression as in case 3 + 2 is not allowed.
c)
Duplicate case case 5:
d)
No error will be reported.
20.
20.Which of the following statements are correct about the below program?
a)
Error: Expression syntax
b)
Error: Lvalue required
c)
Error: Rvalue required
d)
The Code runs successfully
21.
21.Which of the following statements are correct about an if-else statements in a C-program?
a)
1 and 2
b)
2 and 3
c)
1, 2 and 4
d)
2, 3, 4
22.
22.Which of the following statements are correct about the below C-program?
a)
1
b)
2, 3
c)
3, 4
d)
4
23.
23.What is the output of the program?
a)
20
b)
0
c)
Garbage Value
d)
Error
24.
24.Point out the error in the following program (if it is compiled with Turbo C compiler).
a)
No error
b)
display() doesn't get invoked
c)
display() is called before it is defined
d)
None of these
25.
25.Point out the error in the following program.
a)
Error: Declaration syntax error 'v' (or) Size of v is unknown or zero.
b)
Program terminates abnormally.
c)
No error.
d)
None of these.
26.
26.Which of the structure is incorrect?
a)
1
b)
2
c)
3
d)
1, 2, 3
27.

27.What will be the output of the program ?

a)
30
b)
27
c)
9
d)
3
28.

28.What will be the output of the following C code snippet?

a)
returns 1
b)
returns 2
c)
Varies
d)
Compile time error
29.

29.How many times the while loop will get executed if a short int is 2 byte wide?

a)
Infinite times
b)
255 times
c)
256 times
d)
254 times
30.

30. What are the disadvantages of arrays?

a)
Index value of an array can be negative
b)
Elements are sequentially accessed
c)
Data structure like queue or stack cannot be implemented
d)
There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size