WorksheetsPython Intro
Total questions: 50
Worksheet time: 1hrs 15mins
What is a correct syntax to output "Hello World" in Python?
print("Hello World")
echo "Hello World"
echo("Hello World");
p("Hello World")
How do you insert COMMENTS in Python code?
//This is a comment
/*This is a comment*/
#This is a comment
Which one is NOT a legal variable name?
_myvar
my_var
Myvar
my-var
How do you create a variable with the numeric value 5?
x = 5
x = int(5)
Both answers are correct
How do you create a variable with the floating number 2.8?
x = 2.8
x = float(2.8)
Both answers are correct
In Python, 'Hello', is the same as "Hello"
False
True
Which operator is used to multiply numbers?
%
#
*
x
How do you start writing an if statement in Python?
if (x > y)
if x > y then:
if x > y:
How do you start writing a while loop in Python?
while x > y:
while (x > y)
while x > y {
x > y while {
Which statement is used to stop a loop?
stop
exit
break
return
Which is the Python logo?
print("Hello world!")
print("Hello" + "world" + "today")
print("3+4")
Gjdk is not a good name for a variable, why?
It starts with a capital letter.
It does not contain any spaces.
There are no vowels.
It's meaningless.
name = 'Dave'
print (name)
What is a input?
A function that allows us to ask the user to enter some data.
To plug in something.
Data displayed on a screen.
A function
Which operator checks if a value is equal to another value?
+
=
==
!=
What is the name of the variable in this program?
colour
input
" "
1
0
5
___________ is a memory location that stores the data
variable
edit
memory
which of the following type is not supported by Python?
LIst
String
Numbers
the data type of 12.4 is _____
float
str
int
A variable name can consists of alphabets, digits and underscore
true
flase
print() function is used to accept the value of a variable from the user.
False
true
Python keyword cannot be used as a variable name.
true
false
The data type for integers is?
Int
Float
Double
Char
string
Which of the following is a syntax rule in Python?
Must use Tag (<> )
Must use symbol (;) at the end of each script
Case Sensitive
Indentation does not matter
Must use uppercase letters
The symbol # is?
Variable identity
Data type identity
Providing input
Providing comments
Providing commands
What is a character in Python that can be letters, digits, or symbols, starting and ending with quotes?
Statement
Program
String
Syntax
Scratch
What do you know about " " in Python programming? For data type....?
String
Int
Char
Float
Double
What is the data type in Python that can be True (1) or False (0)?
Binary
Hexa
Char
Int
Float
What function is used for looping in Python?
for or while
if or else or elif
arithmetic
choose
lookup
What data structure in Python stores a collection of data in order?
Set
List
Global
True
Dictionary
What does the break command do in a loop?
Continue to the next iteration
Stop the loop
Stop the program
Return a value
Destroy the program
a program that will use a stored decimal value and then convert into an integer and display it
x = 7.8
y = int(x)
print(y)
x = 7.8
y = float(x)
print(y)
x = 7.8
y = int(x)
x = 7.8
y = int(x)
print(x)
Choose the three types of logical operators
and
not
with
or
'5545.2' comes under which data type in Python?
String
Float
Integer
Number
i = 1
while i < 6:
print("i")
i += 1
1
2
3
4
5
1
2
3
4
1
2
3
4
5
6
i
i = 1
while i <6:
print(i)
i += 3
1
4
1
2
3
4
1
3
4
i
