LLucent Previous Years Solved Sample Placement Papers
-
main()
{
int i;
printf("%d", &i)+1;
scanf("%d", i)-1;
}
a. Runtime error.
b. Runtime error. Access violation.
c. Compile error. Illegal syntax Ans: c. Compile error. Illegal syntax
d. None of the above
-
main(int argc, char *argv[])
{
(main && argc) ? main(argc-1, NULL) : return 0;
}
a. Runtime error.
b. Compile error. Illegal syntax Ans: b. Compile error. Illegal syntax
c. Gets into Infinite loop
d. None of the above
-
main()
{
int i;
float *pf;
pf = (float *)&i;
*pf = 100.00;
printf("%d", i);
}
a. Runtime error.
b. 100
c. Some Integer not 100 Ans: c. Some Integer not 100
d. None of the above
-
main()
{
int i = 0xff;
printf("%d", i<<2);
}
a. 4
b. 512
c. 1020
d. 1024 Ans: d. 1024
-
#define SQR(x) x * x
main()
{
printf("%d", 225/SQR(15));
}
a. 1
b. 225
c. 15
d. none of the above Ans: d. none of the above
-
union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l;
} st;
int i;
} u;
main()
{
u.i = 100;
printf("%d, %d, %d",u.i, u.st.i, u.st.l);
}
a. 4, 4, 0
b. 0, 0, 0
c. 100, 4, 0 Ans: c. 100, 4, 0
d. 40, 4, 0
-
union u
{
union u
{
int i;
int j;
} a[10];
int b[10];
} u;
main()
{
printf("%d", sizeof(u));
printf("%d", sizeof(u.a));
printf("%d", sizeof(u.a[0].i));
}
a. 4, 4, 0
b. 0, 0, 0
c. 100, 4, 0
d. 40, 4, 0 Ans: d. 40, 4, 0
-
main()
{
int (*functable[2])(char *format, ...) ={printf, scanf};
int i = 100;
(*functable[0])("%d", i);
(*functable[1])("%d", i);
(*functable[1])("%d", i);
(*functable[0])("%d", &i);
}
a. 100, Runtime error.
b. 100, Random number, Random number, Random number.
c. Compile error
d. 100, Random number Ans: d. 100, Random number
-
main()
{
int i, j, *p;
i = 25;
j = 100;
p = &i; /* Address of i is assigned to pointer p */
printf("%f", i/(*p)); /* i is divided by pointer p */
}
a. Runtime error.
b. 1.00000
c. Compile error Ans: c. Compile error
d. 0.00000
-
main()
{
int i, j;
scanf("%d %d"+scanf("%d %d", &i, &j));
printf("%d %d", i, j);
}
a. Runtime error.
b. 0, 0
c. Compile error
d. the first two values entered by the user Ans: d. the first two values entered by the user
-
main()
{
char *p = "hello world";
p[0] = 'H';
printf("%s", p);
}
a. Runtime error Ans: a. Runtime error
b. “Hello world”
c. Compile error
d. “hello world”