Python Basics
Data Types & Variables
String Operations
Arithmetic & Operators
Functions & Modules
100

What function is used to display output in Python?

print

100

What will be the type of the variable x after x = '10'?

string

100

What operator is used for string concatenation in Python?

+

100

What is the result of 5 + 3 * 2?

11

100

What module do you import to generate random numbers?

random

200

What function do you use to take user input?

input

200

What function is used to convert a string into an integer?

int()

200

What function returns the length of a string?

len()

200

What operator is used for exponentiation in Python?

**

200

How do you define a function named greet?

def greet():

300

What keyword is used to define a function in Python?

def

300

What data type is True in Python?

boolean

300

How do you access the first character of a string s?

s[0]

300

What is the remainder of 17 % 4?

1

300

What statement is used to return a value from a function?

return

400

What is the result of type(42) in Python?

<class 'int'>

400

What is the difference between a list and a tuple?

Lists are mutable, tuples are immutable.

400

What method converts a string to lowercase?

.lower()

400

What is the result of int(4.7)?

4

400

What function is used to get the absolute value of a number?

abs()

500

What symbol is used for single-line comments in Python?

#

500

What keyword is used to declare a variable in Python?

None (Python variables are assigned dynamically)

500

What is the result of "Hello" * 3?

"HelloHelloHello"

500

What operator is used for floor division in Python?

//

500

What is the purpose of if __name__ == "__main__": in Python?

It ensures the script runs only when executed directly, not when imported.

M
e
n
u