Coding Question Paper
Coding Question Paper
Participant Name :
Contact No. :
void main()
do
printf("hello");
} while (str);
2. Consider an implementation of unsorted singly linked list. Suppose it has its representation
with a head and tail pointer. Given the representation, which of the following operation can be
implemented in O(1) time?
i) Insertion at the front of the linked list
ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
iv) Deletion of the last node of the linked list
a) I and II
b) I and III
c) I,II and III
d) I,II and IV
4. What happens when we try to compile the class definition in following code snippet?
c) It will not compile because a class cannot be protectedly inherited from other class.
5. If integer needs two bytes of storage, then maximum value of an unsigned integer is
a) 216 1 b) 215 1
6. Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
#include<stdio.h>
int main()
{
printf("%x\n", -1>>1);
return 0;
}
a) Ffff b) 0fff
c) 0000 d) fff0
#include<stdio.h>
int main()
{
static int a[2][2] = {1, 2, 3, 4};
int i, j;
static int *p[] = {(int*)a, (int*)a+1, (int*)a+2};
for(i=0; i<2; i++)
{
for(j=0; j<2; j++)
{
printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i),
*(*(i+p)+j), *(*(p+j)+i));
}
}
return 0;
}
a) 1, 1, 1, 1
2, 3, 2, 3
3, 2, 3, 2
4, 4, 4, 4
b) 1, 2, 1, 2
2, 3, 2, 3
3, 4, 3, 4
4, 2, 4, 2
c) 1, 1, 1, 1
2, 2, 2, 2
2, 2, 2, 2
3, 3, 3, 3
d) 1, 2, 3, 4
2, 3, 4, 1
3, 4, 1, 2
4, 1, 2, 3
#include<stdio.h>
main()
{ int i = 1;
while( i++<=5 )
printf("%d ",i++);
}
a) 1 3 5 b) 2 4
c) 2 4 6 d) 2
a) 1 b) -1
c) 2 d) -2
#include<stdio.h>
main()
{
struct student
{
int num = 10;
}var;
printf("%d", var.num);
}
a)10 b) garbage
13. Which scanf() statement will you use to scan a float value (a) and double value (b)?
Float a;
Double b;
a) YES b) NO
15.Which of the following function can be used to terminate the main function from another
function safely?
a) return(expr); b) exit(expr);
#include<stdio.h>
int main()
{
printf("Code");
main();
return 0;
}
int main()
{
int var = 010;
printf("%d", var);
}
a) 2 b) 8
c) 9 d) 10
18. Choose the right option
String *x,y;
a) int *ip;
b) string s,*sp=0;
d) int *pi=0;
a) break
b) Goto
c) Exit
d) Switch