Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

More About Python & AI

Total questions: 45

Worksheet time: 4hrs 45mins

Name
Class
Date
1.

The program above

a)

prints all the odd numbers between 1 and 20

b)

prints all even numbers between 1 and 20

c)

print all the odd numbers between 1 and 21

d)

prints all the even numbers between 1 and 21

2.

for i in 100 :

print ( i )

a)

Syntax error

b)

prints numbers 0 to 100

c)

prints numbers 1 to 100

d)

prints numbers 0 to 99

e)

prints numbers 1 to 99

3.

In programming, what is iteration?

a)

The repetition of steps within a program

b)

The order in which instructions are carried out

c)

A decision point in a program

d)

Testing a program to make sure it works

4.
Why is iteration important?
a)
It determines the order in which instructions are carried out
b)
It allows code to be simplified by removing duplicated steps
c)
It allows multiple paths through a program
d)
It ensures the code works correctly
5.
Which two statements are used to implement iteration?
a)
IF and WHILE
b)
ELSE and WHILE
c)
FOR and WHILE
d)
IF and ELSE
6.

FOR loops are

a)

loops which run an unknown number of times

b)

loops which run for a specific number of times

c)

the same as if statements

d)

not part of programming

7.

WHILE loops are

a)

loops which run an unknown number of times

b)

loops which run for a specific number of times

c)

the same as if statements

d)

not part of programming

8.

Which kind of loop would be used?


I need a program that will keep letting me add a monthly payment for 12 months.

a)

FOR Loop

b)

WHILE Loop

9.

Which kind of loop would be used?


I need a guessing game program that will let me keep guessing until I get the right answer.

a)

FOR Loop

b)

WHILE Loop

10.

Which kind of loop would be used?


I need a revision program that will run through revision questions 4 times.

a)

FOR Loop

b)

WHILE Loop

11.

Which kind of loop would be used?


I need a program that will keep letting me add money to a piggy bank until I get to £100.

a)

FOR Loop

b)

WHILE Loop

12.

What does this program print

a)

2 + 2 = 4

4 + 4 = 8

8 + 8 = 16

16 + 16 = 32

32 + 32 = 64

b)

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

c)

2 + 2 = 4

2 + 4 = 6

2 + 6 = 8

2 + 8 = 10

2 + 10 = 12

d)

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

e)

2 + 2 = 4

2 + 4 = 6

2 + 6 = 8

2 + 8 = 10

13.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

14.

what will this display?

a)

0,1,2,3,4,5

b)

0,1,2,3,4

c)

1,2,3,4,5

d)

Error

15.
What will print?
a)
1
2
11
b)
1
2
21
c)
1
2
3
11
d)
1
2
3
21
16.

What is the output of range(1,10)

a)

0123456789

b)

123456789

c)

1 to 10

d)

012345

17.

In a Python program, what would be the increment value for the looping variable in the FOR LOOP code?

a)

15

b)

7

c)

10

d)

1

18.

Which of these will allow me to count from 0-20 in steps of 5?

a)

for x in range(0,20):

print(x)

b)

while x = (0,20,5):

print(x)

c)

for x in range(0,21,5):

print(x)

d)

for x in range(0,21,5):

print(y)

19.

What is output of given python code ?

for i in range(2,10,2):

print(i)

a)

Error

b)

2 4 6 8

c)

2 4 6 8 10

d)

2 3 4 5 6 7 8 9 10

20.

What is output of given python code ?

a)

Error

b)

2 5 8

c)

2 5 8 10

d)

2 5 8 10 Manju

21.

What will be the output to the console for the code shown?

a)

0

2

6

b)

2

4

6

8

c)

2

3

4

5

d)

2

4

22.

Look at the following code, what will it generate

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,1,2,3,4,5,6,7,8,9,10,11,12

c)

1,2,3,4,5,6,7,8,9,10,11,12,13

d)

0,1,2,3,4,5,6,7,8,9,10,11,12,13

23.

What does the following program display?

a)

1,2,3,4

b)

1,2,3,4,5

c)

counter,counter,counter,counter,counter

d)

0,1,2,3,4,5

24.

Look at the following code, what will it generate

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,1,2,3,4,5,6,7,8,9,10,11,12

c)

1,2,3,4,5,6,7,8,9,10,11,12,13

d)

0,1,2,3,4,5,6,7,8,9,10,11,12,13

25.

What does the following program display?

a)

1,2,3,4

b)

1,2,3,4,5

c)

counter,counter,counter,counter,counter

d)

0,1,2,3,4,5

26.

When do you know when you come to the end of the loop?

a)

Its states End loop

b)

The command End is given

c)

The indentation stops

27.

if you wished a loop to repeat 3 times what should you use?

a)

for counter in range(0,5):

b)

for counter in range(1,3):

c)

for counter in range(0,3):

28.

what is the name of the variable used in the following code?

a)

counter

b)

print

c)

for

d)

#

29.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
30.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
31.
What type of loop is used when you know how many times you want to repeat something?
a)
A WHILE Loop
b)
An IF function
c)
A FOR Loop
d)
A Variable
32.

what is the name of the variable used in the following code?

a)

counter

b)

print

c)

for

d)

#

33.

What value will "num" start with when the code is run?

a)

0

b)

1

c)

10

d)

2

e)

Whatever is input from the user

34.

Correct this line of code

input=num

(a)  

35.

Below are some example of using AI in gaming world, except?

a)

Chess

b)

Rock-Paper-Scissors

c)

Mystery Animal

d)

Emoji Scavenger Hunt

e)

None of the above

36.

A step in problem solving by AI where the best solution is chosen from the identified solutions to achieve the target.

a)

defining the problem

b)

analysing the problem

c)

identification of solutions

d)

choosing a solution

e)

implementation

37.

A step in problem solving by AI where the problem analysis and its requirements must be done to have an impact on the resulting solution.

a)

defining the problem

b)

analysing the problem

c)

identification of solutions

d)

choosing a solution

e)

implementation

38.

A step in problem solving by AI where the problem must be defined explicitly and precisely.

a)

defining the problem

b)

analysing the problem

c)

identification of solutions

d)

choosing a solution

e)

implementation

39.

A step in problem solving by AI where it is the last step of them all.

a)

defining the problem

b)

analysing the problem

c)

identification of solutions

d)

choosing a solution

e)

implementation

40.

A step in problem solving by AI where it generates reasonable amount of solution to the given problem falling in a particular range.

a)

defining the problem

b)

analysing the problem

c)

identification of solutions

d)

choosing a solution

e)

implementation

41.

A tool used by AI inspired by the human nervous sytem.

a)

Logic

b)

Classifiers

c)

Probabilistic

d)

Artificial Neural Network

42.

A tool used for AI where proportional logic which involves truth functions such as 'or' 'and' 'not' is called?

a)

Search and Optimization

b)

Classifiers and Statistical Learning Methods

c)

Artificial Neural Network

d)

Logic

43.

(a)   are require educational qualification like engineering to make expert systems that comes under functional expert systems.

44.

_ are tasks you do on a routine basis.

(a)  

45.

Which are not the advantages of AI?

a)

Enhance creative assignments

b)

Substitution for human in dangerous jobs and environments

c)

Take break for coffee

d)

Searching for better solution