wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CS1010 Lab 02

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What will be the value of result?

a)

1

b)

0

c)

Compilation Error

d)

Undefined

2.

What is the output of the following code? (printf %d means printing Decimal value)

a)

0

b)

1

c)

2

d)

3

3.

Which of the following logical expressions evaluates to true in C?

a)

!(0 || 1)

b)

0 && 1

c)

1 && (0 || 1)

d)

0 || (1 && 0)

4.

What is the value of the logical expression?

a)

True

b)

False

c)

Undefined

d)

Null

5.

Which of the following expressions is equivalent to !(a && b) according to De Morgan's laws?

a)

!a && !b

b)

a || b

c)

!a || !b

d)

a && !b

6.

What will be the value of result after executing the following code?

a)

Compilation Error

b)

0

c)

5

d)

7

7.

What will be the output of the following code? (printf is a output printing function in C)

a)

Compilation Error

b)

Undefined Behavior

c)

Condition met

d)

Condition not met

8.

Which of the following expressions is equivalent to !(p || q) && (r || s) using De Morgan's laws?

a)

(!p && !q) && (r || s)

b)

(!p || !q) && (r && s)

c)

!p && !q && (r || s)

d)

p && q && (r || s)

9.

What will be the value of max after executing the following code?

a)

0

b)

10

c)

20

d)

Undefined

10.

Which of the following code snippets correctly finds the smallest of three numbers x, y, and z?

a)

b)

c)