WorksheetsIntroduction to Python Programming
Total questions: 20
Worksheet time: 10mins
What is Python?
High-level programming language
Easy to read & write
Used for Web development, Data Science, AI & ML, Automation, Games & Apps
What is a variable?
A name used to store data
A type of function
A method to execute code
What does the 'print' function do?
Displays output to the console
Stores data in a variable
Defines a function
What is the output of print('Hello World')?
Hello World
Hello
World
What is the correct way to declare a variable in Python?
age = 25
int age = 25
var age = 25
Python code runs __________.
Bottom to top
Randomly
Line by line
What will print(type(age)) return if age = 25?
int
str
float
What is the output of print('OK')?
OK
Error
Nothing
What is the purpose of comments in Python?
To explain code
To execute code
To define variables
What will happen if indentation is incorrect?
An error will occur
The code will run
Nothing will happen
What is the correct syntax to take user input?
name = input('Enter name: ')
name = read('Enter name: ')
name = get('Enter name: ')
What type of number is 'height = 5.8'?
Float
Integer
String
What will print(type(name)) return if name = 'Abhishek'?
str
int
bool
What is the output of print('Welcome to Python')?
Welcome to Python
Welcome
Python
What is the correct way to define a string in Python?
name = 'Abhishek'
name = Abhishek
name = ""Abhishek""
What will happen if you try to print a variable that hasn't been defined?
An error will occur
It will print None
It will print an empty string
What is the output of print('I will become a Python Pro')?
I will become a Python Pro
I will become a Pro
I will become a Python
What is the correct way to write a comment in Python?
# This is a comment
// This is a comment
/* This is a comment */
What will the following code print? print('Name:', name)
Name: Abhishek
Name:
Abhishek
What is the output of print('Age:', age) if age = 25?
Age: 25
Age:
25
