WorksheetsPYTHON BASICS
Total questions: 23
Worksheet time: 14mins
Features of Python
Easy to learn and read
Portable
GUI programming
All of the above
To display something on the screen, use this command:
print()
Print()
screen()
write()
display()
To display the following on screen
Hello World!
the following command should be used:
print(Hello World!)
print("Hello World!")
print("Hello World" + !)
print"(Hello World!)"
Everything that we want do display in a print() function must:
be inside parentheses - ()
quotation marks - " "
be inside single quotation marks - ''
be inside hash marks - #
An Operator is:
A person that performs operations
a symbol that specifies the operation to perform
a symbol that means the code will run
a line of code
What is the name of the environment in Python that write your programs and then test them out?
Shell
Window
IDLE
CLI
Which operator checks if a value is equal to another value?
+
-
==
!=
x = 5
x%=3
print(x)
2
2.0
3
3.0
What is the value of the expression 100 / 25?
4
4.0
"4.0"
'4.0'
What is the output of the following code :
print 9//2
4.5
4.0
4
3
What is the answer of this expression, 22 % 3 is?
7
1
0
5
Select the valid Octal integer literals
0836
7976
07362
0x1726
Choose the INVALID identifiers from the following
NUmbEr1
1NUMBer
A_B
A&B
(a) is smallest individual unit in a program.
What is the output of the following code :
print 7//2
3.5
3.0
3
4
Which of the following is a correct way to comment a single line in Python?
// This is a comment
# This is a comment
/* This is a comment */
" This is a comment "
What is the purpose of the 'break' statement in Python?
To exit the current loop prematurely
To skip the current iteration of a loop
To continue to the next iteration of a loop
To end the program execution
