WorksheetsFASTEST DECODER_PART 1
Total questions: 30
Worksheet time: 30mins
What will be the output of the following C code?
a = 1, b = 1
a = 2, b = 1
a = 1, b = 2
a = 2, b = 2
What will be the output of the following C code?
a = 10, b = 9
a = 10, b = 8
a = 5, b = 9
None of the above
What is the output of this program?
Compilation error
Run time error
Output : a, b and c 10 20 30
None of the above
What is the output of this program?
n=7
n=6
n goes into infinite loop
None of the above
Suppose that in a C program snippet, followings statements are used.
i) sizeof(int)
ii) sizeof(int*)
iii) sizeof(int**)
Assuming size of pointer is 4 bytes and size of int is also 4 bytes, pick the most correct answer from the given options.
Only i) would compile successfully and it would return size as 4.
i), ii) and iii) would compile successfully and size of each would be same i.e. 4
i), ii) and iii) would compile successfully but the size of each would be different and would be decided at run time.
ii) and iii) would result in compile error but i) would compile and result in size as 4.
What’s the meaning of following declaration in C language?int (*p)[5];
It will result in compile error because there shouldn’t be any parenthesis i.e. “int *p[5]” is valid.
p is a pointer to 5 integers.
p is a pointer to integer array.
p is a pointer to an array of 5 integers
Predict the output of following Python Program
0
4
2
None of the above
What is the output of the following python program?
33
(1,2,4)
18
Error
What is the output of this program?
Error
true
false
9
What is the output of this program?
['AB','CD']
Error
['ab', 'cd']
['AB','cd']
What is the output of this program?
260
160
155
255
What is the output of this program?
1
2
5
Error
What is the output of this program?
(1, 2, 3, 1, 2, 3)
(1, 2, 3, 4, 5, 6)
(3, 6, 9)
Error
What will be the output of the following program ?print("abcdef".find("cd"))
true
2
3
None of these
What is the output of the following Python program?
1 2 3 4 5 6.
1 2 3 4 5 6 7.
Error.
None of these
What is the output of this program?
False.
True.
Error.
None of these
What is the output of this program?
1 2 3.
1 2.
Syntax Error.
None of these
For the following declaration of a function in C, pick the best statement
int [ ] fun(void (*fptr)(int *));
(i) It will result in compile error.
(ii) No compile error.
(iii) fun is a function which takes a function pointer fptr as argument and returns an array of int.
(iv) The array of int depends on the body of fun i.e. what size array is returned.
only i is correct
both i and ii are correct
i, ii , iii are correct
none of the above
What is the output of this program?
a
b
97
Run time error
What will be the output of the following C code?
Yes
No
Depends on the compiler
Depends on the operating system
What will be the final value of d in the following C code?
Syntax error
1
5
10
What will be the output of the following C code?
6
5
0
None of the above
What will be the output of the following C code?
6
5
0
None of the above
What will be the final value of j in the following C code?
0
10
Depends on the compiler
None of the above
What will be the output of the following C code?
15
16
15.6
10
What will be the output of the following C code?
Syntax error
1
10
5
What will be the final value of x in the following C code?
3.75
Depends on compiler
24
3
