![]() |
VOOZH | about |
Question 1
Consider the following C program:
The output of the above C program is _____. GATE CSE || 2019 NAT || 2-mark
10
Question 2
Match the following: 2017 SET 2 || MCQ || 1-mark
(P) static char var ; | (i) Sequence of memory locations to store address |
|---|---|
(Q) m = malloc (10); m = NULL; | (ii) A variable located in data section of memory |
(R) char*ptr[10]; | (iii) Request to allocate a CPU register to store data |
(S) register int var1; | (iv) A lost memory which cannot be freed |
P→(ii), Q→(iv), R→(i), S→(iii)
P→(ii), Q→(i), R→(iv), S→(iii)
P→(ii), Q→(iv), R→(iii), S→(i)
P→(iii), Q→(iv), R→(i), S→(ii)
Question 3
Consider the following function implemented in C:
The output of invoking printxy(1, 1) is 2017 SET 2 || MCQ || 2-mark
0, 0
0 ,1
1, 0
1, 1
Question 4
Consider the C program fragment below which is meant to divide x by y using repeated subtractions. The variables x, y, q and r are all unsigned int.
Which of the following conditions on the variables x, y, q and r before the execution of the fragment will ensure that the loop terminates in a state satisfying the condition x == (y*q + r)? 2017 SET 2|| MCQ || 2-mark
(q == r) && (r == 0)
(x > 0) && (r == x) && (y > 0)
(q == 0) && (r == x) && (y > 0)
(q == 0) && (y > 0)
Question 5
Consider the following snippet of a C program. Assume that swap(&x, &y) exchanges the contents of x and y.
The output of the program is ________. GATE CSE || 2017 SET 2 || NAT || 2-mark |
3
Question 6
Consider the following C program.
The output of the program is ______ GATE CSE || 2017 SET 2 || NAT || 2-mark
0
Question 7
Consider the following C program.
The output of the program is _________ . GATE || 2017 SET 2 || NAT || 2-mark
2
Question 8
Consider the following C code:
The code suffers from which one of the following problems: 2017 SET 1 ||MCQ || 1-mark
compiler error as the return of malloc is not typecast approximately
compiler error because the comparison should be made as x==NULL and not as shown
compiles successfully but execution may result in dangling pointer
compiles successfully but execution may result in memory leak
Question 9
Consider the following two functions.
The output printed when fun1(5) is called is 2017 SET 1 || MCQ || 2-mark
53423122233445
53423120112233
53423122132435
53423120213243
Question 10
Consider the following C program.
Recall that strlen is defined in string.h as returning a value of type size_t, which is an unsigned int. The output of the program is _________. 2017 SET 1 || NAT || 2-mark
3
There are 58 questions to complete.