NEW
Font size
WorksheetsBPP UNIT-1,2 AID
Total questions: 20
Worksheet time: 13mins
Who introduced python
Guido Van Rossum
James Gosling
Dennis Ritchie
Charles Babbage
Which one is NOT a legal variable name?
Myvar
my_var
_myvar
my-var
How do you start writing an if statement in Python?
if (x > y)
if x > y:
if x > y then:
How do you start writing a for loop in Python?
for x in y:
for each x in y:
for x > y:
What is the correct file extension for Python files?
.pt
.py
.pyt
.pyth
What is the correct syntax to output the type of a variable or object in Python?
print(type(x))
print(typeof x)
print(typeOf(x))
print(typeof(x))
What is a correct syntax to output "Hello World" in Python?
p("Hello World")
echo "Hello World"
echo("Hello World");
print("Hello World")
In the Python statement x = a + 5 - b:
a and b are ________
a + 5 - b is ________
operators, a statement
terms, a group
operands, an equation
operands, an expression
Which operator can be used to compare two values?
><
=
<>
==
How do you insert COMMENTS in Python code?
#This is a comment
//This is a comment
/*This is a comment*/
How do you create a variable with the numeric value 5?
x = 5
x = int(5)
Both the other answers are correct
What is the correct way to create a function in Python?
create myFunction():
def myFunction():
function myfunction():
Which operator has higher precedence in the following list
% (Modulus)
& (BitWise AND)
** (Exponent)
> (Comparison)
What is the Output of the following code?
for i in range(10, 15, 1):
print( i, end=', ')
10, 11, 12, 13, 14,
10, 11, 12, 13, 14, 15,
The Program executed with errors
What is the output of the following
x = 36 / 4 (3 + 2) 4 + 2
print(x)
182.0
37
117
The Program executed with errors
What is the output of the following code?
valueOne = 5 ** 2
valueTwo = 5 ** 3
print(valueOne)
print(valueTwo)
10
15
25
125
Error: invalid syntax
Can we use the “else” block for for loop?
No
Yes
What is the output of the following code?
JamesJamesJamesJamesJamesJames
JamesJamesJamesJamesJames
Error: invalid syntax
What is the output of the following code
Salary: 12000 Salary: 8000
Salary: 8000 Salary: 12000
The program failed with errors
. What is the output of the following code?
var1 = 1
var2 = 2
var3 = "3"
print(var1 + var2 + var3)
6
33
123
Error. Mixing operators between numbers and strings are not supported
