Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

operators & loops

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

In C programming language, which of the following type of operators have the highest precedence

a)

Relational operators

b)

Equality operators

c)

Logical operators

d)

Arithmetic operators

2.

int main()

{

int a = 25%10;

printf("%d", a);


return 0;

}

a)

5

b)

2

c)

2.5

d)

5.5

3.

The modulus operator (%) can be used only with integers.

a)

True

b)

False

4.

!= is the example of ____________________ operator.

a)

Relational

b)

Logical

c)

Assignment

d)

Conditional

5.

The _____________ operator checks if the value of left operand is greater than the value of right operand.

a)

= =

b)

<

c)

>

d)

=

6.

#include <stdio.h>


int main()

{


int i = 95;


char c = 97;


printf("%d, %d\n", sizeof(i), sizeof(c));


return 0;

}

a)

2,1

b)

4,2

c)

2,4

d)

2,8

7.

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

a)

I and II

b)

I and III

c)

II and III

d)

II and IV

8.

#include <stdio.h>

int main() {

int age=20;

age>=18? printf("eligible") : printf("not eligible");

return 0; }

a)

eligible

b)

not elgible

9.

int a=10;

float b=10.5;

char n[10]="ECEB";

printf("a=---------,b=--------,n=------",a,b,n);

(a)  

10.

4<<2

a)

16

b)

8

11.

16>>2

a)

4

b)

8

c)

32

d)

64

12.
a)

inside if

b)

inside elseif

c)

inside ifinside elseif

d)

compile time error

13.

a)

COMPILE TIME ERROR

b)

0.3

c)

0.2

d)

0.1

e)

0

14.

a)

HELLO

b)

Prints Nothing

c)

HELLO HI

d)

HI

15.

a)

1)i<j

2)i<j

b)

1)i>j

2)i>j

c)

1)i<j

2)i>j

d)

1)i>j

2)i<j

16.

a)

a%2==1

b)

a%2<1

c)

a%2>1

d)

a%2==0

17.

a)

Hu Jintao Nicolas Sarkozy Vladimir putin

b)

Barack Obama Hu Jintao Nicolas Sarkozy Vladimir putin

c)

Barack Obama Hu Jintao Nicolas Sarkozy Ben Bernanke Vladimir putin

d)

It will print nothing

e)

compile time error

18.

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 )

a)

x : 6, y : 5, z : 3

b)

x : 6, y : 3, z : 5

c)

x : 3, y : 4, z : 2

d)

x : 5, y : 4, z : 5

19.
a)

Case-2

b)

Message

c)

Case-2 Case-3 Exit from switch

d)

Message Case-2

e)

Message Case-2 Case-3 Exit from switch

20.

a)

Choice is 1

b)

default statement

c)

compile time error

d)

Choice is 1default statement