WorksheetsComputer Pretest2(Python Grade7_t1)
Total questions: 30
Worksheet time: 15mins
in Python what is the addistion sign?
=
+
^
"
what is a string in Python?
a long piece of woven material
text, or keyboard characters
something that ties words together
yarn
This is Sample of ?
Multi Line Comment
Single Line Comment
Number Value
String Value
The correct syntax for converting the string x to uppercase is :
X.upper()
upper(x)
x.UPPER[ ]
x.upper()
The correct syntax for converting the string myname to lowercase is :
myNAME.lower[ ]
myname.lower( )
myname.upper( )
myname_lower(12 )
Let x= "Python", the output of print(x.upper()) is
python
PYTHON
_PYTHON
"PYTHON"
which function is used for datetime for current dateand time
now
today
strftime
current
The module used for doing the date and time related tasks is ?
os
datetime
random
numpy
2022-01-01 13:21:00
date
datetime
time
timestamp
15:01:20
date
time
timestamp
datetime
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).
datetime
calendar
time
date
Module that only provides date information (day, month and year).
datetime
calendar
time
date
n object of datetime that represents duration or a change in time and is used to calculate future and past times or dates.
timedelta
timediff
timechange
delta
You have the code shown here. Which of the selections should be placed in code location R ?
import
dt
.today
today
You have the code shown here. Which of the selections should be placed in code location T ?
datetime
dt
.today
today
You have the code shown here. Which of the selections should be placed in code location U ?
datetime
dt
.today
today
Divide by zero
Syntax Error
Run-time Error
Logical Error
Input("Enter num1")
Syntax Error
Run-time Error
Logical Error
infinite repetition
Syntax Error
Run-time Error
Logical Error
print("Here is some text")
print(1/0)
Syntax Error
Run-time Error
Logical Error
prnt("Hello World")
Syntax Error
Run-time Error
Logical Error
Lists are used to store single item in a single variable.
True
False
List items are ordered, changeable, and allow duplicate values.
True
False
List items can be of any data type:
True
False
If you add new items to a list, the new items will be placed at the end of the list.
True
False
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John"]
nameList[0]
nameList[1]
nameList[2]
nameList[3]
Output of this code?
[2,4,6,8,10]
['2','4','6','8','10']
[0,2,4,6,8]
[10,8,6,4,2]
