NEW
Font size
WorksheetsSession 2
Total questions: 10
Worksheet time: 5mins
Which of the following is a correct way to declare a variable in Python?
int x = 5
x = 5
declare x = 5
var x = 5
Which data type is used to store textual data in Python?
int
float
string
bool
How do you take user input in Python and store it in a variable named name?
name = get_input("Enter your name: ")
name = input("Enter your name: ")
name = input_string("Enter your name: ")
name = get_string("Enter your name: ")
What will be the output of the following code if the user enters "Alice"?
Hello, Alice
Hello,
Hello, name
Enter your name: Alice
What is the result of the following code?
7
5
2
Error
How do you check if a number stored in variable x is greater than 10?
if x > 10:
if (x > 10)
if x is greater than 10:
if x > 10 then:
What will be the output of the following code?
x is greater than 5
x is not greater than 5
x = 3
Error
What will be the output of the following code?
HELLO, WORLD!
hello, world!
Hello, World!
error
What is the correct way to check if a string s is empty in Python?
if s == ""
if s.isEmpty()
if s.empty()
if s == None
Which of the following is the correct syntax to comment a single line in Python?
// This is a comment
# This is a comment
This is a comment
// This is a comment //
