wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Operators in C(29/08)

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which of the following operator takes only integer operands?

a)

+

b)

-

c)

*

d)

%

2.

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

3.

#include <stdio.h>

int main() {

int age=20;

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

return 0; }

a)

eligible

b)

not elgible

4.

#include <stdio.h>

int main() {

int y = 2;

int z = y +(y = 10);

printf("%d\n", z);

}

a)

12

b)

20

c)

Either 12 or 20

d)

4

5.

void main()

{

int a, b = 2, c;

a = 2 * (b++);

c = 2 * (++b);

}

a)

a = 4, c = 8

b)

a = 3, c = 8

c)

b = 3, c = 6

d)

a = 4, c = 6

6.

int a=10;

float b=10.5;

char n[10]="ECEB";

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

(a)  

7.

char name[10];

float m1;

printf("Enter the name and cutoff of yours");

scanf("---------",name,&m1);

a)

%s%f

b)

%c%f

c)

%s%lf

8.

int a;

flloat b;

char n[10];

printf("Enter a,b n values");

scanf("%d%f%s",----------);

a)

&a,&b,&n

b)

&b,&a,&n

c)

&a,&b,n

d)

a,b,n

9.

4<<2

a)

16

b)

8

10.

16>>2

a)

4

b)

8

c)

32

d)

64