Worksheetsoperators & loops
Total questions: 20
Worksheet time: 14mins
In C programming language, which of the following type of operators have the highest precedence
Relational operators
Equality operators
Logical operators
Arithmetic operators
int main()
{
int a = 25%10;
printf("%d", a);
return 0;
}
5
2
2.5
5.5
The modulus operator (%) can be used only with integers.
True
False
!= is the example of ____________________ operator.
Relational
Logical
Assignment
Conditional
The _____________ operator checks if the value of left operand is greater than the value of right operand.
= =
<
>
=
#include <stdio.h>
int main()
{
int i = 95;
char c = 97;
printf("%d, %d\n", sizeof(i), sizeof(c));
return 0;
}
2,1
4,2
2,4
2,8
In an expression involving || operator, evaluation
I. Will be stopped if one of its components evaluates to false
II. Will be stopped if one of its components evaluates to true
III. Takes place from right to left
IV. Takes place from left to right
I and II
I and III
II and III
II and IV
#include <stdio.h>
int main() {
int age=20;
age>=18? printf("eligible") : printf("not eligible");
return 0; }
eligible
not elgible
int a=10;
float b=10.5;
char n[10]="ECEB";
printf("a=---------,b=--------,n=------",a,b,n);
(a)
4<<2
16
8
16>>2
4
8
32
64
inside if
inside elseif
inside ifinside elseif
compile time error
COMPILE TIME ERROR
0.3
0.2
0.1
0
HELLO
Prints Nothing
HELLO HI
HI
1)i<j
2)i<j
1)i>j
2)i>j
1)i<j
2)i>j
1)i>j
2)i<j
a%2==1
a%2<1
a%2>1
a%2==0
Hu Jintao Nicolas Sarkozy Vladimir putin
Barack Obama Hu Jintao Nicolas Sarkozy Vladimir putin
Barack Obama Hu Jintao Nicolas Sarkozy Ben Bernanke Vladimir putin
It will print nothing
compile time error
Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression?
a = ( x > y ) ? (( x > z ) ? x : z) : (( y > z ) ? y : z )
x : 6, y : 5, z : 3
x : 6, y : 3, z : 5
x : 3, y : 4, z : 2
x : 5, y : 4, z : 5
Case-2
Message
Case-2 Case-3 Exit from switch
Message Case-2
Message Case-2 Case-3 Exit from switch
Choice is 1
default statement
compile time error
Choice is 1default statement
