Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

FASTEST DECODER_PART 1

Total questions: 30

Worksheet time: 30mins

Name
Class
Date
1.

What will be the output of the following C code?

a)

a = 1, b = 1

b)

a = 2, b = 1

c)

a = 1, b = 2

d)

a = 2, b = 2

2.

What will be the output of the following C code?

a)

a = 10, b = 9

b)

a = 10, b = 8

c)

a = 5, b = 9

d)

None of the above

3.

What is the output of this program?

a)

Compilation error

b)

Run time error

c)

Output : a, b and c 10 20 30

d)

None of the above

4.

What is the output of this program?

a)

n=7

b)

n=6

c)

n goes into infinite loop

d)

None of the above

5.

Suppose that in a C program snippet, followings statements are used.

i) sizeof(int)

ii) sizeof(int*)

iii) sizeof(int**)

Assuming size of pointer is 4 bytes and size of int is also 4 bytes, pick the most correct answer from the given options.

a)

Only i) would compile successfully and it would return size as 4.

b)

i), ii) and iii) would compile successfully and size of each would be same i.e. 4

c)

i), ii) and iii) would compile successfully but the size of each would be different and would be decided at run time.

d)

ii) and iii) would result in compile error but i) would compile and result in size as 4.

6.
Suppose a, b, c and d are int variables. For ternary operator in C ( ? : ), pick the best statement.
a)
a>b ? : ; is valid statement i.e. 2nd and 3rd operands can be empty and they are implicitly replaced with non-zero value at run-time.
b)
a>b ? c=10 : d=10; is valid statement. Based on the value of a and b, either c or d gets assigned the value of 10.
c)
a>b ? (c=10,d=20) : (c=20,d=10); is valid statement. Based on the value of a and b, either c=10,d=20 gets executed or c=20,d=10 gets executed.
d)
All of the above are valid statements for ternary operator.
7.

What’s the meaning of following declaration in C language?int (*p)[5];

a)

It will result in compile error because there shouldn’t be any parenthesis i.e. “int *p[5]” is valid.

b)

p is a pointer to 5 integers.

c)

p is a pointer to integer array.

d)

p is a pointer to an array of 5 integers

8.

Predict the output of following Python Program

a)

0

b)

4

c)

2

d)

None of the above

9.

What is the output of the following python program?

a)

33

b)

(1,2,4)

c)

18

d)

Error

10.

What is the output of this program?

a)

Error

b)

true

c)

false

d)

9

11.

What is the output of this program?

a)

['AB','CD']

b)

Error

c)

['ab', 'cd']

d)

['AB','cd']

12.

What is the output of this program?

a)

260

b)

160

c)

155

d)

255

13.

What is the output of this program?

a)

1

b)

2

c)

5

d)

Error

14.

What is the output of this program?

a)

(1, 2, 3, 1, 2, 3)

b)

(1, 2, 3, 4, 5, 6)

c)

(3, 6, 9)

d)

Error

15.

What will be the output of the following program ?print("abcdef".find("cd"))

a)

true

b)

2

c)

3

d)

None of these

16.

What is the output of the following Python program?

a)

1 2 3 4 5 6.

b)

1 2 3 4 5 6 7.

c)

Error.

d)

None of these

17.

What is the output of this program?

a)

False.

b)

True.

c)

Error.

d)

None of these

18.

What is the output of this program?

a)

1 2 3.

b)

1 2.

c)

Syntax Error.

d)

None of these

19.

For the following declaration of a function in C, pick the best statement

int [ ] fun(void (*fptr)(int *));

(i) It will result in compile error.

(ii) No compile error.

(iii) fun is a function which takes a function pointer fptr as argument and returns an array of int.

(iv) The array of int depends on the body of fun i.e. what size array is returned.

a)

only i is correct

b)

both i and ii are correct

c)

i, ii , iii are correct

d)

none of the above

20.

What is the output of this program?

a)

a

b)

b

c)

97

d)

Run time error

21.
When double is converted to float, then the value is?
a)
Truncated
b)
Rounded
c)
Depends on the compiler
d)
Depends on the standard
22.

What will be the output of the following C code?

a)

Yes

b)

No

c)

Depends on the compiler

d)

Depends on the operating system

23.

What will be the final value of d in the following C code?

a)

Syntax error

b)

1

c)

5

d)

10

24.

What will be the output of the following C code?

a)

6

b)

5

c)

0

d)

None of the above

25.

What will be the output of the following C code?

a)

6

b)

5

c)

0

d)

None of the above

26.

What will be the final value of j in the following C code?

a)

0

b)

10

c)

Depends on the compiler

d)

None of the above

27.
Which of the following data type will throw an error on modulus operation(%)?
a)
char
b)
short
c)
int
d)
float
28.

What will be the output of the following C code?

a)

15

b)

16

c)

15.6

d)

10

29.

What will be the output of the following C code?

a)

Syntax error

b)

1

c)

10

d)

5

30.

What will be the final value of x in the following C code?

a)

3.75

b)

Depends on compiler

c)

24

d)

3