wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DECODEX

Total questions: 25

Worksheet time: 8mins

Name
Class
Date
1.

What will this code print?

printf("%d", printf("CQuiz"));

a)

CQuiz

b)

CQuiz5

c)

5

d)

Compilation Error

2.

What is a generator function?

a)

A function that returns a list

b)

A function that uses yield

c)

A function that returns all values at once

d)

A normal function

3.

What is the result of sum([[]])?

a)

0

b)

[]

c)

Error

d)

None

4.

Which of the following is immutable?

a)

list

b)

set

c)

dictionary

d)

tuples

5.

What is the output of:

def gen():

for i in range(3):

yield i

g = gen()

print(next(g), next(g))

a)

0 1

b)

1 2

c)

0 1 2

d)

error

6.

Which statement is used to handle exceptions in Python?

a)

catch

b)

error

c)

try-except

d)

handle

7.

What is the purpose of a decorator in Python?

a)

to decorate strings

b)

To modify the behavior of functions

c)

To add colors to output

d)

To create loops

8.

What will this print?

def sumDigits(n):

if n == 0:

return 0

return n % 10 + sumDigits(n // 10)

print(sumDigits(123))

a)

123

b)

6

c)

3

d)

Error

9.

Who owns the internet?

a)

Internet Engineering Task Force

b)

ICANN

c)

Internet Architecture Board

d)

None

10.

What is the output of sizeof('A') in C?

a)

1

b)

2

c)

4

d)

Depends on compiler

11.

What happens if a subclass defines an init method but does not call super().init()?

a)

The parent’s constructor runs automatically

b)

The parent’s constructor is skipped

c)

Syntax error

d)

Parent and child constructors both run

12.

Which operator has the highest precedence in C?

a)

++

b)

*

c)

()

d)

sizeof

13.

What is the output of:

def addToList(val, lst=[]):

lst.append(val)

return lst

print(addToList(1))

print(addToList(2, []))

print(addToList(3))

a)

[1] [2] [3]

b)

[1] [2] [1, 3]

c)

[1, 2, 3]

d)

[1] [2, 3] [1, 3]

14.

What is Python’s duck typing principle?

a)

Type checking at compile time

b)

Type checking based on variable name

c)

If an object behaves like a type, it’s treated as that type

d)

Python rejects objects of unknown types

15.

Which of these is not a web server?

a)

Apache

b)

IIS

c)

Jigsaw

d)

Zaob

16.

What will be the output of the following code?

x = [[0]*3]*3

x[0][0] = 1

print(x)

a)

[[1, 0, 0], [0, 0, 0], [0, 0, 0]]

b)

[[1, 0, 0], [1, 0, 0], [1, 0, 0]]

c)

[[1, 1, 1], [0, 0, 0], [0, 0, 0]]

d)

error

17.

What is the default value of a global variable in C?

a)

0

b)

garbage value

c)

NULL

d)

depends on compiler

18.

Which was the first browser?

a)

WorldWideWeb

b)

Netscape Navigator

c)

Internet Explorer

d)

Safari

19.

Which of the following is not a valid macro definition?

a)

#define SQR(x) (x*x)

b)

#define MAX 100

c)

#define x = 10

d)

#define PI 3.14

20.

What is the output?

a = [1, 2, 3]

print(list(map(lambda x: x**2, a)))

a)

[1, 4, 9]

b)

[2, 3, 4]

c)

[1, 2, 3]

d)

Error

21.

Which company is named "Big Blue"

a)

TCS

b)

IBM

c)

Microsoft

d)

Sathayam

22.

What will ''.join(['a', 'b', 'c']) return?

a)

['a', 'b', 'c']

b)

abc

c)

'abc'

d)

a,b,c

23.

Its a small peice of text stored in the user's computer by the user for maintaining the state. What is it?

a)

Application

b)

Session

c)

Cookie

d)

QueryString

24.

Which of these is the first web based e-mail service?

a)

Gmail

b)

Yahoo mail

c)

Hotmail

d)

Rediff mail

25.

Which of these is a correct format of IP address?

a)

192.168.1.1

b)

192.168.111.111

c)

192.168.900.1

d)

192.900.168.1