LG Soft Technical paper - C and Data structures

LG Soft Technical paper - C and Data structures


1. main(int argc, char *argv[])
{
(main && argc) ? main(argc-1, NULL) : return 0;
}

a. Runtime error.
b. Gets into Infinite loop
c. Compile error. Illegal syntax
d. None of the above

2. main()
{
int i = 0xff;
printf("%d", i<<2);
}

a. 4
b. 512
c. 1020
d. 1024

3.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

4.print % character?

a. printf(“\%”)
b. printf(“\%”)
c. printf(“%%”)
d. printf(“\%%”)

5.main()

{
char *a = "Hello ";
char *b = "World";
printf("%s", stract(a,b));
}

a. “Hello”
b. “Hello World”
c. “HelloWorld”
d. None of the above

6.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

7.main()

{
int i = 100;
printf("%d", sizeof(sizeof(i)));
}

a. 2
b. 100
c. 4
d. none of the above

8.main()

{
printf("%d, %d", sizeof('c'), sizeof(100));
}

a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4

9.main()

{
int c = 5;
printf("%d", main|c);
}

a. 1
b. 5
c. 0
d. none of the above

10.main()

{
char c;
int i = 456;
c = i;
printf("%d", c);
}

a. 456
b. -456
c. random number
d. none of the above

11.main()
{
int x=5;
for(;x!=0;x--) {
printf(“x=%d\n”, x--); }
}

a. 5, 4, 3, 2,1
b. 4, 3, 2, 1, 0
c. 5, 3, 1
d. none of the above

12.main()
{
int x=5;
{
printf(“x=%d ”, x--); }
}
a. 5, 3, 1
b. 5, 2, 1,
c. 5, 3, 1, -1, 3
d. –3, -1, 1, 3, 5

13.main()
{
int i;
for(i=0;i<5;i++)
{
printf("%d\n", 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

Post your comment

    Discussion

  • pperdcjyld -ichnrxefe (10/03/23)
  • http://dokobo.ru/ust-careerride.com-ajt.xml
  • RE: LG Soft Technical paper - C and Data structures -doori singh (03/13/18)
  • please give answers to the above questions.
  • RE: LG Soft Technical paper - C and Data structures -mohit goswami (02/04/15)
  • pls give me the answer..