C Objective Questions 8

C Objective Questions 8

C Langauge Practice Programs-MCQs-Objective-Questions152. What is the output?

void main()
{
int a;
a=100;
printf(“%d %d”,++a,++a);
}


153. What is the output?

void main()
{
int i=-1;
+i;
printf(“i = %d, +i = %d \n”,i,+i);
}


154. Which of the following is not a valid operator?

A) +
B)++
C)+++
D)+=


155. Which of the following daa type cannot be used with operator %?

A) char
B)double
C)float
D) Both B and C


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


156. What is the output of the following code?

void main()
{
int x = 10;
const int y = x;
x = x + 2;
printf(“%d %d” , x, y);
}


157. what is the output of the following code?

void main()
{
int a = 100;
const int b;
b = a;
printf(“%d %d” , a ,b );
}


158. What will be printed by the code given below?

void main()
{
int value = 5;
printf(“%s” , !(value %2) ? “yes” : “no”);
}


159. What will be the output of the following program?

void main()
{
int x = 5;
printf(“%d %d %d\n”, x, x<<2, x>>2);
}


160. How can a ‘%’ character be printed with printf()?


161. What will be the output of the following program?

void main()
{
int a = 2, b = 3;
printf(“%d” , a+++b);
printf(“a=%d , b=%d” , a,b);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


162. What is the output of the following code?

void main()
{
char ch = ‘A’;
ch = ch + 32;
printf(“%c” , ch);
}


163. What is the output of the following code?

void main()
{
char ch = ‘A’;
ch = ch + 1;
printf(“%c”, ch);
}


164. What is the return type of printf() and scanf()?


165. What is the output of the following code?

void main()
{
int a ;
printf(“%d” , a);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


166. What is the output of the following code?

void main()
{
int a = a + 1;
printf(“%d” , a);
}


167. what is the output of the following code?

void main()
{
int a++;
printf(“%d”, a);
}


168. What is the range of “real constants” in ‘C’?


169. How many keywords are there in ‘C’?


170. What will be the output of the following statement?

/* /* printf(“hello”); */ */


171. What will be the output of the following arithmetic expression?

5+3*2%10-8*6


172. What will be the output of the following statement?

printf(“%i”,35,2+8*5%10-2);


173. What will be the output of the following statement?

int a=10;
printf(“%d &i”,a,10);


174. What will be the output of the following statement?

printf(“%X%x%ci%x”,11,10,’s’,12);


175. Following declarative statement is valid or invalid?

long x;


176. What will be the output of the following statements?

int a = 1, b = 2 , c;
c = = a = = b;
printf(“%d”,c);


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


177. What will be the output of the following program?

void main()
{
float a = 3.26;
printf(“%f”,ceil(a));
}


178. What will be the output of the following statements?

int a = 5, b = 2, c = 10, i = a>b<c;
printf(“%d”,i);


179. What will be the output of the following program?

int a = 10;
void main()
{
int a = 50;
printf(“%d”,a);
}


180. What will be the output of the following statements?

float c = 1.3;
printf(“%d%d”,sizeof(c),sizeof(1.3));


181. What will be the output of the following statement?

printf( 3 + “goodbye”);


182. What will be the output of the following statement?

printf(“hello””””world”);
a) error
b) hello””””world
c) hello
d) helloworld


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


183. What will be the output of the following statements?

int i = 1,j;
j=i— -2;
printf(“%d”,j);


184. What will be the output of the following statements?

int k = 12;
k=k–;
printf(“%d”,k);


185.What will be the output of the following statements?

int a=5,b=6,c=9,d;
d=(a<b?(a>c?1:2):(c>b?6:8));
printf(“%d”,d);


186. What will be the output of the following program?

#include<math.h>
void main()
{
int a = fmod(5,3);
printf(“%d”,a);
}


187. What will be the output of the following program ?

#include<math.h>
void main()
{
int n; char *str = “324.89”;
n = atoi(str); printf(“%d”,n);
}


188. What will be the output of following program?

void main()
{
printf(“%d”);
}
a) error
b) no output
c) %d
d) 0


189. What will be the output of the following statements?

int i = 3;
printf(“%d%d”,i,i++);


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


190. What will be the output of the following program ?

void main()
{
int a = 36, b = 9;
printf(“%d”,a>>a/b-2);
}


191. What will be the output of the following program ?

int main()
{
printf(“%d” , main); return 0;
}
a) exits with stack overflow
b) compile error “variable undeclared”
c) base address of the function main
d) 0


192. Is the relational expression a<b<c legal in C?


193. What is the output of the following code?

void main()
{
struct xx
{
int x = 3;
char name[ ] = “hello”;
};
struct xx, *s;
s = &xx;
printf(“%d” , s->x);
printf(“%s” , s->name);
}


194. What is the output of the following code?

#define square(x) x*x
void main()
{
int i;
i = 64 / square(4);
printf(“%d” , i);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert


195. What is the output of the following code?

#define a 10
void main()
{
#define a 50
printf(“%d”,a);
}


196. What is the output of the following code?

#define clrscr() 100
void main()
{
printf(“%d\n”,clrscr());
}

197. What is the output of the following code?

void main()
{
enum colors {BLACK,BLUE,GREEN}
printf(“%d%d%d”,BLACK,BLUE,GREEN);
return(1);
}


198. What is the output of the following code?

void main()
{
int i=1,j=2;
switch(i)
{
case 1: printf(“GOOD”);
break;
case j: printf(“BAD”);
break;
}
}


199. What is the output of the following code?

void main()
{
int i=0;
for( ; i++ ; printf(“%d”,i) ) ;
printf(“%d”,i);
}


200. What is the output of the following code.

void main()
{
register int a=2;
printf(“Address of a = %d” , &a);
printf(“Value of a = %d” , a);
}


Attend Free Demo and Learn   C LANGUAGE ONLINE TRAINING   by Real-Time Expert

Share this post