C Objective Paper
Participant Name:-
College:-
Mobile No:-
1. What will be the output of the program ?
#include
int main()
{
static char *s[] = {"black", "white", "pink", "violet"};
char **ptr[] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
++p;
printf("%s", **p+1);
return 0;
}
A.
Ink
B.
ack
C.
Ite
D.
let
2. What will be the output of the program?
#include
int main()
{
float a=0.7;
if(a < 0.7)
printf("C\n");
else
printf("C++\n");
return 0;
}
A.
C
B.
C++
C.
Compiler error
D.
Non of above
3. What will be the output of the program?
#include
#include
int main()
{
printf("%d, %d, %d\n", sizeof(3.14f), sizeof(3.14), sizeof(3.14L));
return 0;
}
A.
4, 4, 4
B.
4, 8, 8
C.
4, 8, 10
D.
4, 8, 12
4. What will be the output of the program?
#include
int main()
{
float *p;
printf("%d\n", sizeof(p));
return 0;
}
A.
2 in 16bit compiler, 4 in 32bit compiler
B.
4 in 16bit compiler, 2 in 32bit compiler
C.
4 in 16bit compiler, 4 in 32bit compiler
D.
2 in 16bit compiler, 2 in 32bit compiler
5. What will be the output of the program ?
#include
int main()
{
union var
{
int a, b;
};
union var v;
v.a=10;
v.b=20;
printf("%d\n", v.a);
return 0;
}
A.
10
B.
20
C.
30
D.
0
6. What will be the output of the program ?
#include
int main()
{
enum days {MON=-1, TUE, WED=6, THU, FRI, SAT};
printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT);
return 0;
}
A.
-1, 0, 1, 2, 3, 4
B.
-1, 2, 6, 3, 4, 5
C.
-1, 0, 6, 2, 3, 4
D.
-1, 0, 6, 7, 8, 9
--------------------------------------------------------------------------------------------------
7 What will be the output of the program ?
#include
int main()
{
int i=4, j=8;
printf("%d, %d, %d\n", i|j&j|i, i|j&j|i, i^j);
return 0;
}
A.
12, 12, 12
B.
112, 1, 12
C.
32, 1, 12
D.
-64, 1, 12
8. What will be the output of the program ?
#include
int main()
{
enum value{VAL1=0, VAL2, VAL3, VAL4, VAL5} var;
printf("%d\n", sizeof(var));
return 0;
}
A.
1
B.
2
C.
4
D.
10
9 Assunming, integer is 2 byte, What will be the output of the program?
#include
int main()
{
printf("%x\n", -1>>1);
return 0;
}
A.
ffff
B.
0fff
C.
0000
D.
fff0
10 What will be the output of the program?
#include
int main()
{
printf("%d >> %d %d >> %d\n", 4 >> 1, 8 >> 1);
return 0;
}
A.
4 1 8 1
B.
4 >> 1 8 >> 1
C.
2 >> 4 Garbage value >> Garbage value
D.
2 4
11 What will be the output of the program ?
#include
int main()
{
int i=32, j=0x20, k, l, m;
k=i|j;
l=i&j;
m=k^l;
printf("%d, %d, %d, %d, %d\n", i, j, k, l, m);
return 0;
}
A.
0, 0, 0, 0, 0
B.
0, 32, 32, 32, 32
C.
32, 32, 32, 32, 0
D.
32, 32, 32, 32, 32
12. What will be the output of the program?
#include
int main()
{
unsigned int res;
res = (64 >>(2+1-2)) & (~(1<<2));
printf("%d\n", res);
return 0;
}
A.
32
B.
64
C.
0
D.
128
13 Point out the error in the following program.
#include
#include
int main()
{
char *ptr;
*ptr = (char)malloc(30);
strcpy(ptr, "RAM");
printf("%s", ptr);
free(ptr);
return 0;
}
A.
Error: in strcpy() statement.
B.
Error: in *ptr = (char)malloc(30);
C.
Error: in free(ptr);
D.
No error
14. What will the function rewind() do?
A.
Reposition the file pointer to a character reverse.
B.
Reposition the file pointer stream to end of file.
C.
Reposition the file pointer to begining of that line.
D.
Reposition the file pointer to begining of file.
15 Declare the following statement?
"An array of three pointers to chars".
A.
char *ptr[3]();
B.
char *ptr[3];
C.
char (*ptr[3])();
D.
char **ptr[3];
16 In which stage the following code
#include
gets replaced by the contents of the file stdio.h
A.
During editing
B.
During linking
C.
During execution
D.
During preprocessing
17 What will be the output of the program?
#include
#define SQR(x)(x*x)
int main()
{
int a, b=3;
a = SQR(b+2);
printf("%d\n", a);
return 0;
}
A.
25
B.
11
C.
Error
D.
Garbage value
18 What will be the output of the program?
#include
#define CUBE(x) (x*x*x)
int main()
{
int a, b=3;
a = CUBE(b++);
printf("%d, %d\n", a, b);
return 0;
}
A.
9, 4
B.
27, 4
C.
27, 6
D.
Error
19 What will be the output of the program ?
#include
#include
int main()
{
char str[] = "India\0\BIX\0";
printf("%s\n", str);
return 0;
}
A.
BIX
B.
India
C.
India BIX
D.
India\0BIX
20 What will be the output of the program ?
#include
int main()
{
char str[7] = "IndiaBIX";
printf("%s\n", str);
return 0;
}
A.
Error
B.
IndiaBIX
C.
Cannot predict
D.
None of above
21. What will be the output of the program ?
#include
int main()
{
printf("%d, %d, %d", sizeof(3.0f), sizeof(“3”), sizeof(3.0));
return 0;
}
A.
8, 1, 4
B.
4, 2, 8
C.
4, 2, 4
D.
10, 3, 4
22 What is the notation for following functions?
1. int f(int a, float b)
{
/* Some code */
}
2. int f(a, b)
int a; float b;
{
/* Some code */
}
A.
1. KR Notation
2. ANSI Notation
B.
1. Pre ANSI C Notation
2. KR Notation
C.
1. ANSI Notation
2. KR Notation
D.
1. ANSI Notation
2. Pre ANSI Notation
23 What will be the output of the program?
#include
int main()
{
int fun(int);
int i = fun(10);
printf("%d\n", --i);
return 0;
}
int fun(int i)
{
return (i++);
}
A.
9
B.
10
C.
11
D.
8
24. What will be the output of the program if the array begins at 65486 and each integer occupies 2 bytes?
#include
int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr+1, &arr+1);
return 0;
}
A.
65488, 65490
B.
64490, 65492
C.
65488, 65496
D.
64490, 65498
25. What will be the output of the program ?
#include
int main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d\n", sizeof(arr)/sizeof(arr[0]));
return 0;
}
A.
5
B.
4
C.
6
D.
7
c key................
1.a-
2.a-
3.c-
4.a-
5.b-
6.d-
7.a-
8.b-
9.a--
10.c-
11.c-
12.a-
13.b-
14.d-
15.b
--------------------
16.d-
17.b-
18.c-
19.b-
20.c--
21.b-
22.c-
23.a-
24.c-
25.b-
No comments:
Post a Comment