wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

X-Quiz #4

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Name the error that doesn’t cause program to stop/end, but the output is not the desired result or is incorrect

a)

Syntax error

b)

Runtime error

c)

Logical error

d)

All of the above

2.

What is output of following code −

l = [1,2,6,5,7,8]

l.insert(9)

a)

l=[9,1,2,6,5,7,8]

b)

l=[1,2,6,5,9.7,8] (insert randomly at any position)

c)

l=[1,2,6,5,7,8,9]

d)

Type Error

3.

Analyze the code −

a)

Recursive Function 40320.

b)

Recursive Function.

c)

Function runs infinitely and causes a StackOverflowError.

d)

Syntax Error.

4.

Which of the following is more accurate for the following declaration?


x = Circle()

a)

Now you can assign int value to x

b)

x contains a reference to a Circle object.

c)

x actually contains a object of type circle

d)

x contains an int value

5.

What will be the output of the following code?


print(type(1/5))

a)

<class 'float'>

b)

<class 'int'>

c)

NameError: '1/2' not defined

d)

0.5

6.

What is output for following code


y = [4, 5,1j]y.sort()

a)

[1j,4,5]

b)

[5,4,1j]

c)

[4,5,1j]

d)

Type Error

7.

What is the output of the following code

a)

50

b)

NameError

c)

None

d)

0

8.

In Java, Class is a ___ data type

a)

User Defined

b)

Pre-Defined

c)

System Defined

d)

None of the above

9.

What is the output of the python expression :


print '{0:-2%}'.format(1.0 / 3)

a)

33.33%

b)

33%

c)

1/3%

d)

.33%

10.

Predict the output:


#include <stdio.h>

int main()

{

char a = 012;

printf("%d", a);

return 0;

}

a)

10

b)

012

c)

12

d)

010