FPL 1 UNIT 2

 


FPL 1 UNIT 2

Question 1.What will be the output of the following program?

#include<stdio.h>

void main()

{             int   i=20;

             printf(“%d \n”,sizeof(i));

}

Option A

2

Option D

20

Option B

4

Option E

None 


Question 2 What is the output of the program?

#include<stdio.h>

void main()

{    int   a;

    printf(“%d  \n”,a);

}

Option A

Error

Option C

-1

Option B

0

Option D

Garbage Value


Question 3 What is the output of the program

#include<stdio.h>

void main()

{     int  x=10, y=20, z=5, i;

     i=x<y<z;

     printf(“%d \n”,i);

}

Option A

0

Option C

Error

Option B

1

Option D

None 


Question 4

Find the output of the following program?

#include<stdio.h>

void main()

{

      char letter = ‘A’;

      printf(“\n %c”,letter);

}

Option A

A

Option C

Error

Option B

65

Option D

Garbage Value




Question 5

Find the output of the following program

#include<stdio.h>

void main()

{     int a;

     printf(“%d”, a^a) ;

}

Option A

1

Option C

Infinite

Option B

0

Option D

Error


Question 6

Find the output of the following c program?

#include<stdio.h>

#define a 5+2

int main()

{        int  ans;

       ans=a*a*a;

       printf(“%d”,ans);

       return 0;

}

Option A

133

Option C

27

Option B

343

Option D

None 


Question 7 Find the output of #include<stdio.h>

void main()

{          int x=0, y=0;

          x=(y=75)+9;

          printf(“\n%d, %d”,x,y);

}

Option A

75,9

Option C

84,75

Option B

75,84

Option D

None 


Question 8

Find the output of the following program?

#include<stdio.h>

int main()

{char x=65;

x=x+10;

printf("\n%d",x);

return 0;

}

Option A

K

Option C

65+10

Option B

75

Option D

Error

Question 9 Find the output of the following program?

#include<stdio.h>

int main()

{ int i=4,ans;

ans=++i + ++i + ++i;

printf("\n%d",ans);

return 0;

}

Option A

21

Option C

15

Option B

18

Option D

None 


Question 10

#include<stdio.h>

int main()

{

int x=10;

printf("\n%d %d %d",x,x++,++x);

return 0;

}

Option A

11 11 11

Option C

12 11 10

Option B

12 10 10

Option D

12 11 11


Question 11

Find the output of the following c program?

#include<stdio.h>

int main()

{

      printf(“%d”,sizeof(3.3));

      return 0;

}

Option A

2

Option C

8

Option B

4

Option D

Compiler Error


Question 12

Find the output of the following c program?

#include<stdio.h>

int main()

{

  int i=32, j=32, 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;

}

Option A

0, 0, 0, 0, 0

Option C

32, 32, 32, 32, 0

Option B

0, 32, 32, 32, 32

Option D

32, 32, 32, 32, 32


Question 13

Find the output of the following c program?

#include<stdio.h>

int main()

{

int k,num=30;

k= (num<10)?100:200;

printf("\n%d %d",num,k);

return 0;

}

Option A

200 30

Option C

100 200

Option B

30 200

Option D

500 500


Question 14

What will be the output of the program?

#include<stdio.h>

int main()

{

int x, y, z;

x=y=z=1;

z=++x || ++y && ++z;

printf(“x=%d, y=%d,z=%d\n”,x,y,z);

return 0;

}

Option A

x=2, y=1, z=1

Option C

x=2,

 y=2,

 z=2

Option B

x=2, y=2, z=1

Option D

x=1, 

y=2,

 z=1






Question 13

Suppose the following statements are written:

int i=9, j=6;

float x=0.5, y=0.1;

char a='a', b='b';

Find the values of the following expression

(3*i-2*j)%(2*a-b)

Option A

10

Option C

11

Option B

15

Option D

16


Question 14

Suppose the following statements are written:

int i=9, j=6;

float x=0.5, y=0.1;

char a='a', b='b';

Find the values of the following expression

2*(j/5)+(4*(j-3))%(i+j-2)

Option A

7

Option C

14

Option B

15

Option D

16


Question 15

Suppose the following statements are written:

int i=9, j=6;

float x=0.5, y=0.1;

char a='a', b='b';

Find the values of the following expression

(x>y) && (i>0)&&(j>5)

Option A

-1

Option C

1

Option B

65+10

Option D

2


Question 15

Suppose the following statements are written:

int i=9, j=6;

float x=0.5, y=0.1;

char a='a', b='b';

Find the values of the following expression

((x<y)&&(i>0))||(j>3)

Option A

-1

Option C

1

Option B

0

Option D

2



Question 16

Suppose the following statements are written:

int i=9, j=6;

float x=0.5, y=0.1;

char a='a', b='b';

Find the values of the following expression

a==99

Option A

-1

Option C

1

Option B

0

Option D

2


Question 17

Suppose the following statements are written:

int i=9, j=6;

float x=0.5, y=0.1;

char a='a', b='b';

Find the values of the following expression

++i

Option A

10

Option C

9

Option B

11

Option D

8


Question 18

Suppose the following statements are written:

int i=9, j=6;

float x=0.5, y=0.1;

char a='a', b='b';

Find the values of the following expression

!(b==98)

Option A

0

Option C

-1

Option B

1

Option D

98


Question 19

Find the output of the following program.

#include<stdio.h>

void main()

{

  int a=2,b=3,ab=4;

  int I;

  int in=’2’*2;

  char ch=’c’;

  printf(“%c %c\n”,ch,++ch);

  printf(“%d %d %d\n”,a,a,++a);

  printf(“%d %d %d\n”,b,b,++b);

  printf(“%d %d %d\n”,ab,ab,++ab);

  printf(“%d %d\n”,a,!!a);

}

Option A

d d

3 3 3

4 4 4

5 5 5

3 1

Option B

c d

2 2 3

3 3 4

4 4 5

3 0

Option C

d c

3 2 2

4 3 3

5 4 4

3 1


Question 20

Find the output of the following program.

#include<stdio.h>

void main()

{

   int a=5,b=3;

   float c;

   c=a/b;

   printf(“%d\n”,c);

}

Option A

0

Option C

-1

Option B

1

Option D

none 


Question 21

Find the output of the following program.

#include<stdio.h>

void main()

{   clrscr();

   int a=3;

   printf(“%d”,a);

   printf(“%d”,a++);

   printf(“%d”,++a);

}

Option A

3 3 3

Option C

3 3 5

Option B

5 5 5

Option D

5 3 3

Question 22

Find the output of the following program.

#include<stdio.h>

void main()

{

   int x=4, y=9;

   int z;

   z=(x++)+(--y)+y;

   printf(“Value=%d\n”,z);

   z=(--x)+x+(y--);

  printf(“Value=%d\n”,z);

}

Option A

Value=22 Value=17

Option C

Value=22

Value=18

Option B

Value=19

Value=16

Option D

Value=20

Value=16


Question 23

Find the output of the following program.

#include<stdio.h>

void main()

{

   int a,b,c;

   a=2;b=5;c=10;

   printf(“Value=%d\n”,(a+b*-c));

   printf(“Value=%d\n”,(-c/b*c-a));

   printf(“Value=%d\n”,(-a+ ++b %a));

}

Option A

Value=-70

Value=-18

Value=0

Option C

Value=-48

Value=-18

Value=-2

Option B

Value=-48

Value=-22

Value=0

Option D

Value=-48

Value=-22

Value=-2


Question 24

Find the output of the following program.

#include<stdio.h>

void main()

{

     clrscr();

     int a=10,b,c;

     c=b=a;

     b-=a--;

     c-=--a;

     a-=--a-a--;

printf(“a=%d\nb=%d\nc=%d\n”,a,b,c);

}

Option A

a=7 

b=1

c=3

Option C

a=6

b=0

c=2

Option B

a=5

b=-1

c=1

Option D

None 


Question 25

Find the output of the following program.

#include<stdio.h>

void main()

{

  int k=3,l=4,m;

  m=++k +l--;

  printf(“Value of m %d\n”,m);

  m=k++ + --l;

  printf(“Value of m %d\n”,m);

}

Option A

Value of m 7

Value of m 6

Option C

Value of m 7

Value of m 6

Option B

Value of m 8

Value of m 6

Option D

None 


Question 26

Find the output of the following program.

#include<stdio.h>

void main()

{

   int a=1,b=2,c=3,d=4.75,x;

   x= ++a + b++ * ++c % d++;

printf(“ %d %d %d %d %d”, a,b,c,d,x);

}

Option A

2 3 4 5 2

Option C

1 2 3 4 2

Option B

2 3 4 1

Option D

1 2 3 4 5


Question 27

Find the output of the following program.

#include<stdio.h>

void main()

{

    int x=1;

printf(“%d %d %d\n”,x,(x=x+2), (x<<2));

x<<2;

printf(“%d %d %d\n”,++x,x++,++x);

}


Option A

334

644

Option C

343

464

Option B

433

446

Option D

None of the above



Option A




Option B







Question 28

Find the output of the following program?

#include<stdio.h>

void main()

{

 int x;

 for(x=1;x<=5;x++);

  printf("%d",x);

}

Option A

12  3  4  5  6 

Option C

1  2  3  4  5

Option B

6

Option D

5


Question 29

Find the output of the following program?

#include<stdio.h>

void main()

{ int x=4;

 float y=4.0;

 if(x==y)

 printf("x and y are equal");}

Option A

x and y are equal

Option C

Unpredictable


Question 30

What will be the output of the program?

#include<stdio.h>

int X=40;

void main()

{  int X=20;

 printf("%d\n"); }

Option A

20

Option C

60

Option B

40

Option D

Error 


Question 31

What will be the output of the program?

#include<stdio.h>

void main()

{    int fun(float);

   int a;

   a=fun(3.14);

   printf("%d\n",a);  }

int fun(int aa)

{

  return(int)++a;

}

Option A

3

Option C

0

Option B

4

Option D

Error 


Question 32

What will be the output of the program?

#include<stdio.h>

void main()

{

  int a[5]={2,3};

  printf("%d,%d,%d\n",a[2],a[3],a[4]);

}

Option A

Garbage Values

Option C

3,2,2

Option B

2,3,3

Option D

0,0,0


Question 33

What will be the output of the program?

#include<stdio.h>

void main()

{

  char *str="Hello world";

  printf("%s",str);

}

Option A

Hello world

Option C

Garbage value

Option B

Error

Option D

None of the above




Question 35

What will be the output of the program?

#include<stdio.h>

void main()

{

  char str[]="C-program";

 int a=5;

printf(a>10?"Ps\n":"%s\n",str);

}

Option A

C-program

Option C

Error

Option B

Ps

Option D

None 

















Post a Comment (0)
Previous Post Next Post