wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Internship Quiz

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What will be the output?

S=50.6

number=int(S)

new_number=number-1

print(new_number)

a)

49.6

b)

49

c)

50

d)

51.6

e)

52

2.

What does the term 'debug' mean?

a)

Identify errors and fix them.

b)

Making a calculation

c)

A set of instructions

d)

Looking at code

e)

Running a code in Jupyter

3.

Python is an example of a....

a)

Text-based programming language

b)

Object orientated programming language

c)

language written in java script

d)

Visual-based programming language

4.

What does the print function do in python?

a)

It's a variable.

b)

It can input data.

c)

It displays something like a string or integer

d)

It loops the code.

5.

Which of these is the correct code for creating a list of names?

a)

Name_List = Apple, Banana, Grape, Apple, Banana, Banana

b)

Name_List = ("Apple", "Banana", "Grape", "Apple", "Banana", "Banana")

c)

Name_List = ["Apple", "Banana", "Grape", "Apple", "Banana", "Banana"]

d)

Name_List = [Apple, Banana, Grape, Apple, Banana, Banana]

6.

What output will this code produce?

Colours=[]

Colours.append(“blue”)

Colours.append(“green”)

Colours.append(“red”)

Print(colours[2])

a)

blue

b)

green

c)

red

d)

error

e)

none of these

7.

Which of the following is not valid variable name in Python?

a)

_var

b)

var_name

c)

Elephant

d)

var11

e)

11var

8.

Which of the following is incorrect regarding variables in Python?

a)

Variable names in Python cannot start with number. However, it can contain number in any other position of variable name.

b)

Variable names can start with an underscore.

c)

Data type of variable names should not be declared

d)

None of the above

9.

Choose the correct option.

a)

In Python, a tuple can contain only integers as its elements.

b)

In Python, a tuple can contain only strings as its elements.

c)

In Python, a tuple can contain both integers and strings as its elements.

d)

In Python, a tuple can contain either string or integer but not both at a time.

10.

Why are local variable names beginning with an underscore discouraged?

a)

they are used to indicate a private variables of a class

b)

they confuse the interpreter

c)

they are used to indicate global variables

d)

they slow down execution

11.

Which of the following statements create a dictionary?

a)

d = {}

b)

d = {"brand": "Tesla","electric": True}

c)

d = {2012:"Model S", 2016:"Model 3"}

d)

d = {"brand": "Tesla","electric": True,"colors": ["red", "white", "blue"]}

e)

All of the mentioned

12.

Which of the following will give "Simon" as output?

If str1="John,Simon,Aryan"

a)

print(str1[-7:-12])

b)

print(str1[-11:-7])

c)

print(str1[-11:-6])

d)

print(str1[-7:-11])

13.

Which of the following will result in an error?

a)

str1="python"

b)

print(str1[2])

c)

print(str1[0:9])

d)

str1[1]="x"

e)

Both (a) and (b)

14.

What will be the output of below Python code?

str1="6/4"

print("str1")

a)

1

b)

6/4

c)

1.5

d)

str1

e)

error

15.

What is the name of the environment in Python that write your programs and then test them out?

a)

Shell

b)

Window

c)

IDLE

d)

CLI