0% found this document useful (0 votes)
100 views15 pages

C MCQ Set2

This document contains 92 multiple choice questions about C programming. The questions cover topics like operators, control flow, arrays, pointers, functions, preprocessing directives, and more. For each question there are 4 possible answer choices listed from A to D.

Uploaded by

Babu Roy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views15 pages

C MCQ Set2

This document contains 92 multiple choice questions about C programming. The questions cover topics like operators, control flow, arrays, pointers, functions, preprocessing directives, and more. For each question there are 4 possible answer choices listed from A to D.

Uploaded by

Babu Roy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Q55.

Void main()

int a=25;

clrscr();

printf(“%o%x”,a,a);

getch();

A. 25 25
B. 025 0X25
C. 12 42
D. 31 19

Q56. What will be the value of ‘a’ after the following code is executed

#define square(x) x x

a=square(2+3)

A. 25
B. 13
C. 11
D. 10

Q57.what will be the output?

Char x[]=”hello hi”;

Printf(“%d%d”,sizeof(*x),sizeof(x));

A. 88
B. 18
C. 29
D. 19

Q58.

#include<stdio.h>

Int main()

Int a=10,b=2,c;

A=!(c=c==c)&&++b;
C+=(a+b--);

Printf(“%d %d %d”,b,c,a);

Return 0;

A. 230
B. 2 13 0
C. 130
D. 234

Q59.What will be the output?

int a=5,b=6,c=9,d;

d=a>b?(a>c?1:2):(c>b?6:8));

printf(“%d”,d);

A. 1
B. 2
C. 6
D. Error

Q60.What will be the output

int i=3;

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

A. 34
B. 43
C. 44
D. 33

Q.61 Find the output

Int i=3;

Printf(“%d%d%d”,i++,I,++i);

A. 345
B. 444
C. 445
D. 344

Q62.what will be the output

Int i=3;

Printf(“%d%d%d”,--i,I,i--,i++);
A. 2343
B. 2232
C. 2221
D. 2233

Q63.

Int y[4]={6,7,8,9};

Int *ptr=y+2;

Printf(“%d\n”,ptr[1]);

What is printed when the sample code above is executed?

A. 6
B. 7
C. 8
D. 9

Q64.What will be the output

Void main()

If(printf(“cquestationbank”));

Printf(“I know c”);

Else

Printf(“I know c++”);

A. I know c
B. I know c++
C. cquestationbankI know c
D. cquestationbankI know c++

Q65.

#define call(x) #x

Void main()

Printf(“%s”,call(c/c++));

A. c
B. c++
C. #c/c++
D. c/c++

Q66.what will be output if you will compile and execute the following code?

#define messege ”union is power of c”

void main()

clrscr();

printf(“%s”,mesege);

getch();

A. union is \power of c
B. union is power of c
C. union is Power of c
D. compiler error

Q67.

void main()

{ int a,b;

a=1,3,15;

b=(2,4,6);

clrscr();

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

getch();

A. 3
B. 21
C. 17
D. 7

Q68.

Void main()

Int i=0;
If(i==0)

i=((5,(i=3)),i=1);

printf(“%d”,i);}

else

printf(“equal”);

A. 5
B. 3
C. 1
D. Equal

Q69.

Void main()

{ static main();

Int x;

x=call(main);

printf(“%d”,x);

getch();

Int call(int address)

{ address++;

return address;

A. 0
B. 1
C. GARBAGE VALUE
D. COMPILER ERROR

Q70.

#include”string.h”

void main()

{
printf(“%d%d”,sizeof(“string”),strlen(“string”));

getch();

A. 66
B. 77
C. 67
D. 76

Q71.

Struct marks

{ int p:3;

int c:3;

int m:2;

};

Void main()

Struct mrks s={2,-6,5};

Printf(“%d%d%d”,s.p,s.c,s.m);

A. 2 -6 5
B. 2 -6 1
C. 221
D. Compiler Error

Q72.

Int extern x;

Void main()

printf(“%d”,x);

x=2;

getch();

Int x=23;
A. 0
B. 2
C. 23
D. Compiler error

Q73.

#include<stdio.h>

Int main()

Int a[5]={1,2,3,4,5};

int I;

for(i=0;i<5;i++)

if((char)a[i]==’5’)

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

else

printf(“FAIL\n”);

A. The compiler will flag an error


B. The program will compile and print the output 5
C. The program will compile and print the ASCII value of 5
D. The program will compile and print FAIL for 5 times

Q74.

#include<stdio.h>

Int main()

Enum{ORANGE5,MANGO,BANANA=4,PEACH};

Printf(“PEACH=%d\n”,PEACH);

A. PEACH=3
B. PEACH=4
C. PEACH=5
D. PEACH=6

Q75.
#include<stdio.h>

Int main()

int c;

c=printf(“%d”,printf(“%d”,printf(“1234”)));

return 0;

A. 123434
B. 123441
C. Compile time error
D. 123444

Q76.

#include<stdio.h>

Int main()

Int a,b,c;

C=scanf(“%d%d”,&a,&b);// assume a=5 b=6

Printf(“%d”,c);

Return 0;

A. 5
B. 6
C. Compile time error
D. 2

Q77.

#include<stdio.h>

Int main()

Int a,b,c;

c=printf(“hai%d”,scanf(“%d%d”,&a,&b));// assume a=5 b=6

printf(“%d”,c);
return 0;

A. hai 24
B. hai22
C. compiler time error
D. hai 34

Q78.

#include<stdio.h>

Void main()

int x=1,y=Q,z=5;

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

printf(“%d”,z);

A. 6
B. 5
C. 0
D. Varies

Q79.

#include<stdio.h>

Void main()

Int x=1,z=3;

Int y=x<<3;

Printf(“%d\n”,y);

A. -2147483648
B. -1
C. Run time error
D. 8

Q80.

#include<stdio.h>
Int main()

Int i=0,j=0;

If(i &&(j=i + 10))

//do something

Printf(“%d”,j);

A. 0
B. 10
C. Compiler error
D. 11

Q81.

#include<stdio.h>

Int main()

Int i=1;

If(i++ &&(i==1))

Printf(“Yes\n”);

Else

Printf(“No\n”);

A. Yes
B. No
C. Depends on the compiler
D. Depends on the standard

Q82.

#include<stdio.h>

Int main()

Int a=1,b=1,c;
c=a++ +b;

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

A. A=1, b=1
B. a=2, b=1
C. a=1, b=2
D. a=2, b=1

Q83.

#include<stdio.h>

Int main()

Int a=10,b=10;

If(a=5)

b--;

printf(“%d%d”,a,b--);

A. a=10,b=9
B. a=10,b=8
C. a=5,b=9
D. a=15,b=8

Q84.

#include<stdio.h>

Int main()

Int x=2,y=0;

Int z=(y++)?y==1 && x:0;

Printf(“%d\n”,z);

Return 0;

A. 0
B. 1
C. undifind behavior
D. compile time error

Q85.

#include<stdio.h>

Int main()

int y=1,x=0;

int l=(y++,x++)?y:x;

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

A. 1
B. 2
C. Compile time error
D. Undefined behavior

Q.86

#include<stdio.h>

Int main()

Int j=10;

Printf(“%d\n”,j++);

Return 0;

A. 10
B. 11
C. Compile time error
D. 0

Q87.

Void main()

Int i=10;

Static int x=I;


If(x==i)

printf(“Equal”);

Elseif(x>i)

printf(“Greater than”);

Else

printf(“Less than”);

A. Equal
B. Gretter than
C. Less than
D. Compiler error

Q89.

#include<stdio.h>

Int main()

float x=’a’;

printf(“%f”,x);

return 0;

A. A
B. Run time error
C. a.0000000
D. 97.000000

Q90.

#include<stdio.h>

Int main()

float x=’a’;

printf(“%f”,x);

return 0;

}
A. A
B. Run time error
C. a.0000000
D. 97.000000

Q91.

#include<stdio.h>

Int main()

Char p;

char b[10]={1,2,3,4,5,6,9,8};

p=(b+1)[5];

printf(“%d”,p);

return o;

A. 5
B. 6
C. 9
D. None of above

Q92.

Int main()

Char p[]=”csegurus”;

Char t;

Int i,j;

For(i=0,j=strlen(p);i<j;i++)

t=p[i];

p[i]=p[j-1];

p[j-1]=t;

Printf(“%s”,p);
return 0;

A. guruscse
B. Nothing is printed on the screen
C. csegurus
D. gggggggg

You might also like