Wednesday, 30 January 2019

Operator and Expression (Multiple choice type question)

Multiple choice type question
Q.1)
main
{
int x=7 ,y=5;
x=y++ +x++;
y= ++y + ++x;
printf(“%d%d”,x,y)
}
Output:

A) 12 14 B) 9 7 C) 12 20 D) 12 19

Q.2)
#include<stdio.h>

int main()
{
   int x=5,y=15;
   x= x++ + ++y;
   y = ++x + ++y;
   printf("%d %d",x,y);
   return 0;
}
Output:

A) 23 40 B) 22 43 C) 23 42 D) 24 40


Q.3)

#include<stdio.h>

int main ()
{
   int x=2, y=4;
   int z=x+x+x+x+(x++);
   printf("x=%d \n y=%d \n z=%d",x,y,z);
   return 0;
}
OUTPUT
A) x=3, y=4, z=19 B) x=3, y=5, z=10 C) x=2, y=4, z=10 D) x=3, y=4, z=10
Q.4) which one of the following is conditional operator?
A) ?: B)if C)< D)&&

Q.5) What will be the value of a and M after execution of the following code?

int i=5,m ;
m=I++;

A) 5&6 B)5&5 C)6&5 D)6&6


Q.6) Which of the following is a ternary conditional operator? The <<operator is used for
A) && B) if C)<= D) ?


Q.7) The <<operator is used for

A) One return statements B)Two return statements C)More than two return statements D) Left Shift


Q. 8) “C”  allow a three-way transfer of control with the help of

A) Relational operator B) unary operator C) Comparison operators D) Ternary operator


Q.9)The output of
int i=5;
printf("%d%d%d", i,i++,++i);

A) 5 5 7 B) 5 6 7 C)7 6 5 D) 7 6 6


Q.10) Which one of the following is a Bitwise operator?

A) < B) >= C)<< D)&&


Q.11) Which one is the right output?

int x=9;
if(10)
printf("%d",++x);
else
printf("%d",x++);

A) 9 B) 10 C)11 D) 12


Q.12) Which one is the right output?

#define int char
main()
{
int i=65;
printf("sizeof(i)=%d", sizeof(i));
}

A) sizeof(i)=1 B) sizeof(i)=2 C) sizeof(i)= 4 D) sizeof(i)=8


Q.13) Which one is the right output?
main()
{
int i=5, j=6,z;
printf("%d",i+ ++j);
}

A) 12 B) 10 C)11 D)13


Q.14) Which among the following is a special operator?

A) << B) ++ C)sizeof(i) D) ?:


No comments:

Post a Comment

Basic Electronics Engineering (EC101)

Basic Electronics Engineering (EC101)