Answer Posted / subhani
LG Placement Papers | LG Interview Procedure |
LG Aptitude Questions | LG Technical Questions
|LG Interview Questions.
1.
main()
{
int i;
printf("%d", &i)+1;
scanf("%d", i)-1;
}
a. Runtime error. b. Runtime error. Access violation. c. Compile error.
Illegal syntax d. None of the above
2. main(int argc, char *argv[])
{
(main && argc) ? main(argc-1, NULL) : return 0;
}
a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite
loop d. None of the above
3. main()
{
int i;
float *pf;
pf = (float *)&i;
*pf = 100.00;
printf("%d", i);
}
a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above
4. main()
{
int i = 0xff;
printf("%d", i<<2);
}
a. 4 b. 512 c. 1020 d. 1024
5. #define SQR(x) x * x
main()
{
printf("%d", 225/SQR(15));
}
a. 1 b. 225 c. 15 d. none of the above
6. 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 d. 40, 4, 0
7. 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
LG Placement Papers | LG Interview Procedure |
LG Aptitude Questions | LG Technical Questions
|LG Interview Questions.
8. 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
9. 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 d. 0.00000
10. 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
11. main()
{
char *p = "hello world";
p[0] = 'H';
printf("%s", p);
}
a. Runtime error. b. "Hello world" c. Compile error d. "hello world"
12. main()
{ char * strA;
char * strB = "I am OK";
memcpy( strA, strB, 6);
}
a. Runtime error. b. "I am OK" c. Compile error d. "I am O"
13. How will you print % character?
a. printf("%") b. printf("%") c. printf("%%") d. printf("%%")
14. const int perplexed = 2;
#define perplexed 3
main()
{
#ifdef perplexed
#undef perplexed
#define perplexed 4
#endif
printf("%d",perplexed);
}
a. 0 b. 2 c. 4 d. none of the above
15. struct Foo
{
char *pName;
};
main()
{ struct Foo *obj = malloc(sizeof(struct Foo));
strcpy(obj->pName,"Your Name");
printf("%s", obj->pName); }
a. "Your Name" b. compile error c. "Name" d. Runtime error
16. struct Foo
{ char *pName;
char *pAddress; };
main() { struct Foo *obj = malloc(sizeof(struct Foo));
obj->pName = malloc(100);
obj->pAddress = malloc(100);
strcpy(obj->pName,"Your Name");
strcpy(obj->pAddress, "Your Address");
free(obj); printf("%s", obj->pName);
printf("%s", obj->pAddress); }
a. "Your Name", "Your Address" b. "Your Address", "Your Address" c. "Your
Name" "Your Name" d. None of the above
17. main()
{ char *a = "Hello "; char *b = "World";
printf("%s", stract(a,b));
}
a. "Hello" b. "Hello World" c. "HelloWorld" d. None of the above
18. main()
{ char *a = "Hello ";
char *b = "World";
printf("%s", strcpy(a,b));
}
a. "Hello" b. "Hello World" c. "HelloWorld" d. None of the above
19. void func1
(int (*a)[10])
{ printf("Ok it works");
}
void func2(int a[][10])
{ printf("Will this work?");
}
main()
{ int a[10][10];
func1(a);
func2(a); }
a. "Ok it works" b. "Will this work?" c. "Ok it works Will this work?" d.
None of the above .
20. main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
LG Placement Papers | LG Interview Procedure |
LG Aptitude Questions | LG Technical Questions
|LG Interview Questions.
a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4
20. main()
{ int i = 100;
printf("%d", sizeof(sizeof(i)));
}
a. 2 b. 100 c. 4 d. none of the above
21. main()
{ int c = 5;
printf("%d", mainc);
}
a. 1 b. 5 c. 0 d. none of the above
22. main()
{ char c; int i = 456; c = i;
printf("%d", c);
}
a. 456 b. -456 c. random number d. none of the above
23. void main ()
{ int x = 10;
printf ("x = %d, y = %d", x,--x++);
}
a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above
24 main()
{ int i =10, j = 20;
printf("%d, %d ", j-- , --i);
printf("%d, %d ", j++ , ++i); }
a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10
25. main()
{ int x=5;
for(;x==0;x--)
{ printf("x=%d", x--);
}
}
a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
26. main()
{ int x=5; for(;x!=0;x--)
{ printf("x=%d ", x--);
} }
a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above
27. main()
{ int x=5;
{ printf("x=%d", x--);
}
}
LG Placement Papers | LG Interview Procedure |
LG Aptitude Questions | LG Technical Questions
|LG Interview Questions.
a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. -3, -1, 1, 3, 5
28. main()
{ unsigned int bit=256;
printf("%d", bit); }
{ unsigned int bit=512;
printf(%d", bit); } }
a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error
29 main()
{ int i; for(i=0;i<5;i++)
{ printf("%d ", 1L << i);
} }
a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16
30. main()
{ signed int bit=512, i=5;
for(;i;i--)
{ printf("%d ", bit = (bit >> (i - (i -1)))); } }
a.512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d.
64, 32, 16, 8, 4
31. main()
{ signed int bit=512, i=5;
for(;i;i--)
{ printf("%d ", bit >> (i - (i -1))); }
}
a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d.
256, 256, 256, 256, 256
32. main() {
if (!(1&&0)) { printf("OK I am done.");
}
else { printf("OK I am gone.");
} }
a. OK I am done b. OK I am gone c. compile error d. none of the above
33. main()
{
if ((10) && (01))
{ printf("OK I am done.");
}
else
{ printf("OK I am gone.");
} } a. OK I am done b. OK I am gone c. compile error d. none of the above
34. main()
{ signed int bit=512, mBit;
{ mBit = ~bit; bit = bit & ~bit ;
printf("%d %d", bit, mBit);
} }
a. 0, 0 b. 0, 513 c. 512, 0 d. 0, -513
LG Placement Papers | LG Interview Procedure |
LG Aptitude Questions | LG Technical Questions
|LG Interview Questions.
| Is This Answer Correct ? | 16 Yes | 2 No |
Post New Answer View All Answers
Hi.. Guys Im pranitha, presently im working in a organisation & im look for job at MNC's like DELL, Delloitte, Bank of America, Genpect, etc., I have completed B.com . Pls help me...
HI SIR I WANT PREVIOUS QUESTION PAPER OF HPCL I M CHEMICAL ENGG.
printf("%d",printf("%d",printf("%d",printf("%s","ILOVECPROGRAM")))); whats the output
why didn't get placed so far?
If anybody knows the recruitment procedure of IOTL & POWER MECHANICAL. send me the placement papers if u hav... very urgent ...
your project to describe and tell about : 1. My favorite things 2. My favorite places at home 3. Animals *Choose one of them to describe *Write on your paper *If you done, Send me *Did you get it
Give me Medha Sevo previous written test question papers
Zero setting of sejong rottary press
how did you celebrate your last birthday?
aptitude
what is bidirectional?
What were the occupations of the people who lived within the Mauryan Empire?
Sks Microfinance
What kind of Issues/bugs arise in ETL projects? I would like to know few issues (critical to somewhat bugs ) normally occur in ETL process especially when testing? Domains can be banking, retail or any.
email me previous question papers of bob bank for po exams