wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

1st Embedded & Ai T

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What is Python?

a)
Python is a high-level programming language.
b)
Python is a type of snake.
c)
Python is a low-level programming language.
d)
Python is a web development framework.
2.

How do you print something in Python?

a)
Use the print() function, e.g., print('Hello, World!')
b)
Print to the console using log()
c)
Use the echo() function
d)
Display output with output()
3.

What symbol is used to assign a value to a variable in Python?

a)
=
b)
::
c)
=>
d)
==
4.

What function is used to get input from the user in Python?

a)
read()
b)
get_input()
c)
input()
d)
scan()
5.

How do you create a list in Python?

a)
You create a list in Python with the list() function, e.g., my_list = list(1, 2, 3).
b)
You create a list in Python using curly braces, e.g., my_list = {1, 2, 3}.
c)
You create a list in Python by using parentheses, e.g., my_list = (1, 2, 3).
d)
You create a list in Python using square brackets, e.g., my_list = [1, 2, 3].
6.

What is the output of print(2 + 3)?

a)
4
b)
6
c)
7
d)
5
7.

What does len() function do?

a)
The len() function calculates the sum of numbers in a list.
b)
The len() function checks if an object is empty.
c)
The len() function returns the length of an object.
d)
The len() function converts an object to a string.
8.

Which keyword is used to define a function in Python?

a)
function
b)
method
c)
def
d)
define
9.

How do you create an empty dictionary in Python?

a)
[]
b)
{} or dict()
c)
new dict()
d)
{}[]
10.

What is the result of 5 // 2?

a)
1
b)
3
c)
2.5
d)
2
11.

What does the range() function return?

a)
A list of strings
b)
A single random number
c)
A sequence of numbers (range object)
d)
An array of objects
12.

What is the output of print("Hello" + "World")?

a)
Hello World
b)
HelloWorld
c)
Hello-World
d)
HelloWorld!
13.

What does break do in a loop?

a)
Exits the loop immediately.
b)
Repeats the current iteration.
c)
Pauses the loop temporarily.
d)
Skips the current iteration.
14.

What is the result of 3 ** 2?

a)
9
b)
6
c)
12
d)
3
15.

What is the result of 5 % 2?

a)
1
b)
0
c)
3
d)
2
16.

How do you convert a string to an integer in Python?

a)
Use int('string') to convert a string to an integer.
b)
Use eval('string') to convert a string to an integer.
c)
Apply float('string') to get an integer from a string.
d)
Use str('string') to convert a string to an integer.
17.

Which of the following is immutable in Python?

a)
Lists
b)
Tuples
c)
Dictionaries
d)
Sets
18.

What is a list comprehension in Python?

a)

A way to create lists using a for loop in a single line.

b)

A method to convert lists to strings.

c)

A function to sort lists in Python.

d)

A type of data structure similar to arrays.

19.

What is the purpose of the 'pass' statement in Python?

a)

To exit a loop

b)

To create an empty function or class

c)

To skip the current iteration

d)

To raise an exception

20.

How do you check the type of a variable in Python?

a)

type(variable)

b)

checktype(variable)

c)

var_type(variable)

d)

typeof(variable)

21.

What is the output of print("Hello" * 3)?

a)

HelloHelloHello

b)

Hello 3

c)

3 Hello

d)

HelloHello Hello

22.

Which of the following is a valid way to import a module in Python?

a)

import module_name

b)

include module_name

c)

require module_name

d)

using module_name

23.

What is the output of print(10 - 4)?

a)

6

b)

4

c)

10

d)

14

24.

Which of the following is used to create a class in Python?

a)

class

b)

def

c)

create

d)

function

25.

What does the 'continue' statement do in a loop?

a)

Exits the loop immediately.

b)

Skips the current iteration and continues with the next one.

c)

Pauses the loop temporarily.

d)

Ends the program.