wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Computer Pretest2(Python Grade7_t1)

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

in Python what is the addistion sign?

a)

=

b)

+

c)

^

d)

"

2.

what is a string in Python?

a)

a long piece of woven material

b)

text, or keyboard characters

c)

something that ties words together

d)

yarn

3.

This is Sample of ?

a)

Multi Line Comment

b)

Single Line Comment

c)

Number Value

d)

String Value

4.

The correct syntax for converting the string x to uppercase is :

a)

X.upper()

b)

upper(x)

c)

x.UPPER[ ]

d)

x.upper()

5.

The correct syntax for converting the string myname to lowercase is :

a)

myNAME.lower[ ]

b)

myname.lower( )

c)

myname.upper( )

d)

myname_lower(12 )

6.

Let x= "Python", the output of print(x.upper()) is

a)

python

b)

PYTHON

c)

_PYTHON

d)

"PYTHON"

7.

which function is used for datetime for current dateand time

a)

now

b)

today

c)

strftime

d)

current

8.

The module used for doing the date and time related tasks is ?

a)

os

b)

datetime

c)

random

d)

numpy

9.

2022-01-01 13:21:00

a)

date

b)

datetime

c)

time

d)

timestamp

10.

15:01:20

a)

date

b)

time

c)

timestamp

d)

datetime

11.

Python module handles the basic date and time classes for manipulating date and time. For manipulating times & dates together (month, day, year, hour, minute, second, microsecond).

a)

datetime

b)

calendar

c)

time

d)

date

12.

Module that only provides date information (day, month and year).

a)

datetime

b)

calendar

c)

time

d)

date

13.

n object of datetime that represents duration or a change in time and is used to calculate future and past times or dates.

a)

timedelta

b)

timediff

c)

timechange

d)

delta

14.

You have the code shown here. Which of the selections should be placed in code location R ?

a)

import

b)

dt

c)

.today

d)

today

15.

You have the code shown here. Which of the selections should be placed in code location T ?

a)

datetime

b)

dt

c)

.today

d)

today

16.

You have the code shown here. Which of the selections should be placed in code location U ?

a)

datetime

b)

dt

c)

.today

d)

today

17.

Divide by zero

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

18.

Input("Enter num1")

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

19.

infinite repetition

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

20.

print("Here is some text")

print(1/0)

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

21.

prnt("Hello World")

a)

Syntax Error

b)

Run-time Error

c)

Logical Error

22.

Lists are used to store single item in a single variable.

a)

True

b)

False

23.

List items are ordered, changeable, and allow duplicate values.

a)

True

b)

False

24.

List items can be of any data type:

a)

True

b)

False

25.

If you add new items to a list, the new items will be placed at the end of the list.

a)

True

b)

False

26.

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

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

27.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

28.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John"]

a)

nameList[0]

b)

nameList[1]

c)

nameList[2]

d)

nameList[3]

29.

Output of this code?

a)

[2,4,6,8,10]

b)

['2','4','6','8','10']

c)

[0,2,4,6,8]

d)

[10,8,6,4,2]

30.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error