wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

BPP UNIT-1,2 AID

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.

Who introduced python

a)

Guido Van Rossum

b)

James Gosling

c)

Dennis Ritchie

d)

Charles Babbage

2.

Which one is NOT a legal variable name?

a)

Myvar

b)

my_var

c)

_myvar

d)

my-var

3.

How do you start writing an if statement in Python?

a)

if (x > y)

b)

if x > y:

c)

if x > y then:

4.

How do you start writing a for loop in Python?

a)

for x in y:

b)

for each x in y:

c)

for x > y:

5.

What is the correct file extension for Python files?

a)

.pt

b)

.py

c)

.pyt

d)

.pyth

6.

What is the correct syntax to output the type of a variable or object in Python?

a)

print(type(x))

b)

print(typeof x)

c)

print(typeOf(x))

d)

print(typeof(x))

7.

What is a correct syntax to output "Hello World" in Python?

a)

p("Hello World")

b)

echo "Hello World"

c)

echo("Hello World");

d)

print("Hello World")

8.

In the Python statement x = a + 5 - b:

a and b are ________

a + 5 - b is ________

a)

operators, a statement

b)

terms, a group

c)

operands, an equation

d)

operands, an expression

9.

Which operator can be used to compare two values?

a)

><

b)

=

c)

<>

d)

==

10.

How do you insert COMMENTS in Python code?

a)

#This is a comment

b)

//This is a comment

c)

/*This is a comment*/

11.

How do you create a variable with the numeric value 5?

a)

x = 5

b)

x = int(5)

c)

Both the other answers are correct

12.

What is the correct way to create a function in Python?

a)

create myFunction():

b)

def myFunction():

c)

function myfunction():

13.

Which operator has higher precedence in the following list

a)

% (Modulus)

b)

 & (BitWise AND)

c)

** (Exponent)

d)

> (Comparison)

14.

What is the Output of the following code?

for i in range(10, 15, 1):

print( i, end=', ')

a)

 10, 11, 12, 13, 14,

b)

10, 11, 12, 13, 14, 15,

c)

The Program executed with errors

15.

What is the output of the following

x = 36 / 4 (3 + 2) 4 + 2

print(x)

a)

 182.0

b)

37

c)

117

d)

The Program executed with errors

16.

What is the output of the following code?

valueOne = 5 ** 2

valueTwo = 5 ** 3

print(valueOne)

print(valueTwo)

a)

10

15

b)

25

125

c)

Error: invalid syntax

17.

Can we use the “else” block for for loop?

a)

No

b)

Yes

18.

What is the output of the following code?

a)

JamesJamesJamesJamesJamesJames

b)

JamesJamesJamesJamesJames

c)

Error: invalid syntax

19.

What is the output of the following code

a)

Salary: 12000 Salary: 8000

b)

Salary: 8000 Salary: 12000

c)

The program failed with errors

20.

. What is the output of the following code?

var1 = 1

var2 = 2

var3 = "3"

print(var1 + var2 + var3)

a)

6

b)

33

c)

123

d)

Error. Mixing operators between numbers and strings are not supported