wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Object Types and Data Types Worksheet

Total questions: 101

Worksheet time: 51mins

Name
Class
Date
1.

1. В Python типы объектов определяются в процессе исполнения программы (runtime) (т.е. с определенным типом связывается не переменная, а ее значение):

a)

Data analysis

b)

Dynamic typing

c)

Flow control

d)

Vectorization

e)

Clustering

2.

Representation of name (Names given to object references) in code Python:

a)

Literal

b)

Numbers

c)

Identifier

d)

String

e)

Operator

3.

The name associated with the value of the data type is used to track changes in the values during the calculation in Python:

a)

Literal

b)

Variable

c)

Numbers

d)

String

e)

Identifier

4.

The str data type for processing character sequences:

a)

Literal

b)

Numbers

c)

String

d)

Identifier

e)

Operator

5.

The int data type:

a)

Literal

b)

String

c)

Float

d)

Integer

e)

Operator

6.

Float data type, decimal digits:

a)

Literal

b)

Integer

c)

Float

d)

String

e)

Operator

7.

Bool data type, True and False values:

a)

Integer

b)

String

c)

Float

d)

Boolean

e)

Operator

8.

Python. To describe the change in the order of operators in the program, the term is used.

a)

Change case

b)

Concatenation

c)

Control flow

d)

Delete Gaps

e)

Logical OR

9.

Instructions when operators may or may not be executed depending on certain conditions:

a)

Control flow

b)

Concatenation

c)

Conditional expressions

d)

Delete Gaps

e)

Logical OR

10.

Python. Logical Operator - Inverse:

a)

Control flow

b)

Logical NOT

c)

Concatenation

d)

Delete Gaps

e)

Logical OR

11.

Python. Instructions, if the condition is true, then an expression block (called an “if block”) is executed, otherwise another expression block (called an “else block”) is executed:

a)

if – elif – else

b)

Контроль потока (control flow)

c)

Циклы (loop)

d)

for

e)

while

12.

12. Python. Comment Operator:

a)

Контроль потока (control flow)

b)

Циклы (loop)

c)

if – elif - else

d)

for

e)

#

13.

Operator to print any value passed to it:

a)

Control flow

b)

print ()

c)

continue

d)

for -in

e)

while

14.

14. Python. Input operator:

a)

if – elif - else

b)

for -in

c)

while

d)

input ()

e)

print ()

15.

Instructions where certain operators can be executed multiple times, depending on certain conditions:

a)

Control flow

b)

Условные выражения if – elif - else

c)

Циклы (loop)

d)

Пакет

e)

Словарь

16.

Function that is used to input text:

a)

input ()

b)

key()

c)

values()

d)

del

e)

pop()

17.

Python. Built-in function that converts object x to an integer:

a)

list(x)

b)

int (x)

c)

float(x)

d)

tuple(x)

e)

str (x)

18.

Python. Built-in function that converts object x to a string:

a)

int(x)

b)

list(x)

c)

str(x)

d)

float(x)

e)

tuple(x)

19.

Built-in function that converts object x to float:

a)

str(x)

b)

int(x)

c)

float(x)

d)

list(x)

e)

tuple(x)

20.

Instruction for displaying the first values of the list:

a)

print(lst[1])

b)

print(lst[0])

c)

lst = [[1, 2, 3], [4, 5, 6]]

d)

max(lst)

e)

list = ['January', 'February', 'March'], 3

21.

The value of the variable c after program run:

a)

c = 440

b)

c = -240

c)

a = 40

d)

a = 2.5

e)

b = 10

22.

Determine the values of the variables x and y, with conditions that x = 15, y = 2:

a)

x = 15, y = 2

b)

x = 2, y = 15

c)

x = 10, y = 5

d)

x = 5, y = 10

e)

m= 40

23.

The result of the program with a value of x=6: if x>5: print('x>5') elif x<5: print('x<5') else: print('x=5') if x>7 and x<9: print('x=8') if x == 1 or x == 3: print('x=1 or 3')

a)

x= 2

b)

x>5

c)

x= 5

d)

x< 5

e)

x= 8

24.

Operators to output the float value of a variable x=5.123:

a)

print ('%.3f' % x)

b)

print('x=5')

c)

print(5)

d)

print(a*b)

e)

print ('% 8.5f' % x)

25.

Operators to output the float value of a variable x = -2.12 (наиболее оптимальный):

a)

print('x=5')

b)

print ('% 5.2f' % x)

c)

print(5)

d)

рrint (‘% .3f ‘% x)

e)

рrint (‘% 7.5f ‘% x)

26.

Loop executing loop body until boolean expression is True:

a)

if

b)

else

c)

elif

d)

while

e)

for …in

27.

A loop executing a loop body a specific number of times (конкретное число раз):

a)

if

b)

else

c)

elif

d)

for …in

e)

while

28.

Python. Loop statement that interrupts a loop:

a)

Control flow

b)

break

c)

continue

d)

if – elif – else

e)

for -in

29.

An operator that gives instructions that it is necessary to skip all the remaining commands in the current block of the loop and continue from the next iteration of the loop:

a)

Control flow

b)

continue

c)

if – elif – else

d)

for -in

e)

while

30.

The result of the program for i in 1, 2, 3, 'one', 'two': print(i, end=' ')

a)

1 2 3

b)

1 2 3 one two

c)

1 2 3 one

d)

1,2,3, one, two

e)

1-2-3-one-two

31.

The result of the program for i in range (4): print (i, end='/ ')

a)

0 1 2 3

b)

1 2 3 one

c)

0\1\2\3

d)

1 2 3 one two

e)

1,2,3, one, two

32.

The result of the program sum = 0 n = 3 for i in range (1, n + 1): sum += i print (sum)

a)

15

b)

6

c)

3

d)

10

e)

25

33.

The result of the program n = 0 for i in range (1, 6): n = n+i print(n)

a)

5

b)

15

c)

6

d)

10

e)

25

34.

The result of the program: value i and j: for i in range (1, 2): print ('i', i) for j in range (1, 3): print ('j', j)

a)
i = 2, j = 1
b)

i =1, j = 2

c)

i = 2, j = 3

d)

i = 3, j = 4

e)

i = 3, j = 3

35.

The result of the program: value s1 and s2: s=0 s1=0 i=1 while i<4: s=s+1 i+=1 j=1 while j<2: s1=s1+1 j+=1 print(s) print(s1)

a)

s = 2, s1 = 1

b)

s = 1, s1 = 2

c)

s = 3, s1 = 3

d)

s = 0, s1 = 2

e)

s = 1, s1 = 3

36.

The values of the variable i when executing the loop: for i in range(2, 10, 2): print(i, end=" ")

a)

0, 1, 2, 3

b)

5, 4, 3, 2, 1

c)

2, 4, 6, 8

d)

1, 2, 3, 4, 5

e)

1 2 4 6 8

37.

The values of the variable i when executing the loop: a = 6 b = 2 for i in range(a, b+1, -1): print(i, end=", ")

a)

2, 4, 6, 8

b)

6, 5, 4

c)

0, 1, 2, 3

d)

5, 4, 3, 2, 1

e)

1 2 4 6 8

38.

How many times the loop will run (How many numbers will the program print): i = 4 while i >= 0: print(i) i = i - 1

a)

3

b)

4

c)

5

d)

10

e)

2

39.

Insert missing statement in program that prints even numbers (печатает четные числа): x = 0 ____ x <= 20: print(x) x += 2

a)

if

b)

elif

c)

while

d)

for

e)

list

40.

Set the step value in the function range() to the program so that numbers are printed: 2 5 8 11: a = 2 b = 11 for i in range(a, b+1, __): print(i, end=' ');

a)

2

b)

3

c)

1

d)

4

e)

-3

41.

A set of elements in a specific order is indicated by square brackets ([ ]):

a)

Literal

b)

List

c)

Numbers

d)

String

e)

Operator

42.

Python. List items are accessed based on:

a)

Literal

b)

Index

c)

Numbers

d)

String

e)

Operator

43.

Method for adding new element x to the end of the lst list:

a)

lst.extend(t)

b)

lst.append(x)

c)

lst.index(x)

d)

lst.pop(i)

e)

lst.insert(i, x)

44.

Method for adding new element x to position i of the lst list:

a)

lst.append(x)

b)

lst.extend(t)

c)

lst.insert(i, x)

d)

lst.index(x)

e)

lst.pop(i)

45.

Method for Determining the first left position of element x in the lst list:

a)

lst.insert(i, x)

b)

lst.append(x)

c)

lst.extend(t)

d)

lst.pop(i)

e)

lst.index(x)

46.

Method for Deleting an element with the number i from the lst list:

a)

lst.index(x)

b)

lst.pop(i)

c)

lst.insert(i, x)

d)

lst.append(x)

e)

lst.extend(t)

47.

Python. Method for removing the element x from the list lst at the first position on the left (Метод для Удаления элемента x в списке lst в первой слева позиции):

a)

lst.sort()

b)

lst.pop(i)

c)

lst.index(x)

d)

lst.remove(x)

e)

lst.insert(i, x)

48.

Python. Method for Sorting the list in ascending order (Метод для Сортировки списка по возрастанию):

a)

lst.reverse()

b)

lst.pop(i)

c)

lst.sort()

d)

lst.index(x)

e)

lst.insert(i, x)

49.

Python. A method that reverses the order of the list (Метод который меняет порядок списка на обратный):

a)

lst.sort()

b)

lst.pop(i)

c)

lst.reverse()

d)

lst.index(x)

e)

lst.insert(i, x)

50.

Python. A method that returns the number of elements in the list lst with the value x (Метод который возвращает количество элементов в списке lst с указанным значением):

a)

lst.sort()

b)

lst.pop(i)

c)

lst.index(x)

d)

lst.count(x)

e)

lst.insert(i, x)

51.

Python. Function for determining the length of a list (Определяется количество элементов списка):

a)

append()

b)

insert()

c)

len()

d)

reverse()

e)

remove()

52.

Python.  Function for combining lists (Функция для объединения списков):

a)

len()

b)

lst1+lst2

c)

insert()

d)

reverse()

e)

remove()

53.

Method to Remove all elements from the list (Метод для удаления всех элементы из списка):

a)

lst.sort()

b)

lst.pop(i)

c)

lst.clear(x)

d)

lst.index(x)

e)

lst.insert(i, x)

54.

In the list lst = ["apple", "banana", "cherry"], print the last element of the list:

a)

print (lst [0])

b)

print (lst [1])

c)

print (lst [-1])

d)

print (lst [3])

e)

print (lst [-2])

55.

55. Python. There is a list lst = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"] Print the elements: "cherry", "orange", "kiwi":

a)

print (lst [-1])

b)

print (lst [2:5])

c)

print (lst [3:5])

d)

print (lst [3:6])

e)

print (lst [-2])

56.

Python. Built-in function that converts object x to a list:

a)

float(x)

b)

tuple(x)

c)

list(x)

d)

int(x)

e)

str(x)

57.

Instruction for creating a multidimensional list of two elements, each of which  is a list of three elements containing integer values (Инструкция по созданию многомерного списка из двух элементов, каждый из которых представляет собой список из трех элементов, содержащих целочисленные значения): 

a)

lst = [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ]

b)

lst = [ 'January' , 'February' , 'March' ], 3

c)

print (lst[0] )

d)

print ( '\nTop Left 0,0 :' , lst[1][0] )

e)

max(lst)

58.

Instructions for printing the values of a two-dimensional list (Инструкция для печати значений двумерного списка): list = [ 'January', 'February', 'March' ], 3 print(lst[0] ) print ('\nTop Left 0,0 :', lst[1][0] ) print(lst[0] ) list = [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] max(lst)

a)

print(lst[0] )

b)

print ('\nTop Left 0,0 :', lst[1][0] )

c)

print(lst[0] )

d)

max(lst)

59.

59. Instruction for finding a slice of a list (среза списка) containing elements of the list with numbers from i to j with step  k (Инструкция для нахождения среза списка, содержащего элементы списка с номерами от i до j с шагом k)

a)

list = [ 'January', 'February', 'March' ],3

b)

print(lst[0] )

c)

print ('\nTop Left 0,0 :', lst[1][0] )

d)

list = [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ]

e)

lst[i:j:k]

60.

Operation to find a slice (среза) of a list lst:

a)

lst[i:j:k]

b)

len (lst)

c)

lst * n

d)

del lst [i]

e)

del lst [i:j]

61.

The result of the program: n=5 b = [0 for i in range (n - 1)] print (b)

a)

{2, 4, 6, 8}

b)

[0, 0, 0, 0]

c)

[0, 1, 2, 3]

62.

A block of code that runs only when called to solve a specific task:

a)

Выражение (expression)

b)

Функция (Function)

c)

Выявление ошибки (raise an error)

d)

Глобальный код (global code)

e)

Идентификатор (identifier)

63.

Definition of the Function (Определение функции):

a)

tuple

b)

set

c)

def

d)

dictionary

e)

boolean

64.

Calling a function with arguments (Вызов функции с аргументами): def my_function(fname): print(fname + ' Refsnes')

a)

my_func ()

b)

my_function()

c)

my_function('Emil')

d)

my_func1('python')

e)

func ()

65.

Function result (Результат функции): def f(x): x = 2**x+4*x return x print (f(2))

a)

8

b)

4

c)

12

d)

16

e)

88

66.

66. Local variable of the Function (Локальная переменная функции) is:

a)

A variable declared inside a function and accessible only within itThe value of the variable is assigned inside the functions (Значение переменной присваивается внутри функций)

b)

A variable declared outside any functionA variable created outside of a function (if it is visible throughout the program) (Переменная, создаваемая вне функции (если она видна  во всей программе)) 

c)

Positional arguments (Позиционные аргументы)

d)

Named arguments (Именованные аргументы)

e)

Argument (Аргумент)

67.

67. Global variable of the Function (Глобальная переменная функции):

a)

A variable created outside of a function (if it is visible throughout the program) (Переменная, создаваемая вне функции (если она видна во всей программе))

b)

Positional arguments (Позиционные аргументы)

c)

Named arguments (Именованные аргументы)

d)

Argument (Аргумент)

e)

The value of the variable is assigned inside the functions (Значение переменной присваивается внутри функций)

68.

The arguments of the function are specified in the order exactly corresponding to the order in which the parameters are written.

a)

Named arguments (Именованные аргументы)

b)

Positional arguments (Позиционные аргументы)

c)

A variable created outside of a function (it is visible throughout the program) (Переменная, создаваемая вне функции, видима во всей программе)

d)

The value of the variable is assigned inside the functions (Значение переменной присваивается внутри функции)

e)

Argument (Аргумент)

69.

The result of a function with a list as an named argument: Code: def my_function(food): for x in food: print(x) lst = [1, 2, 3] my_function(lst)

a)

6

b)

1 2 3

c)

12

70.

The result of a function with a default parameter: def summa(x, y=2): return x + y a = summa(3) print(a)

a)

3

b)

2

c)

4

d)

5

e)

6

71.

The result of a function with a default parameter: def summa(x, y=2): return x + y b = summa(10, 40) print(b)

a)

12

b)

42

c)

50

d)

4

e)

62

72.

Operator for returning function values (Оператор для возвращения значений функции):

a)

def

b)

return

c)

tuple

d)

global

e)

dictionary

73.

Definition of an anonymous function (Определение анонимной функции):

a)

return

b)

lambda

c)

def 

d)

global 

e)

dictionary

74.

The result of the function: x = lambda a, b: a * b print(x(5, 6))

a)

30

b)

5

c)

6

d)

11

e)

35

75.

The result of the function: triple = lambda x: x * 3; add = lambda x, y: x + y; print(add(triple(3), 4))

a)

12

b)

13

c)

6

d)

11

e)

35

76.

Instructions for creating (packing- упаковки) a tuple:

a)

list = [ 'January' , 'February' , 'March' ] ,3

b)

printf('\nTop Left 0,0 :' , list[1][0] )

c)

colors-tuple = ('Red', 'Green', 'Red', 'Blue', 'Red')

d)

list = [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ]

e)

len (list)

77.

An ordered and immutable collection of data (Упорядоченная и неизменяемая коллекция данных):

a)

dictionary

b)

string

c)

tuple

d)

float

e)

operator

78.

78. Python. Data type – tuple (кортеж):

a)
tuple()
b)

key()

c)

del 

d)

pop()

e)

remove()

79.

Python. Program result: a = (10, 12, 50, 10, 2, 4, 15) print(a[2:5])

a)

[50, 10, 2]

b)

{50, 10}

c)

(50, 10)

d)

(12, 50, 10, 2)

e)

(50, 10, 2)

80.

Python. Program result: a = (10, 12, 50, 10, 2, 4, 15) print(a[3:])

a)

[50, 10, 2, 4]

b)

(10, 2, 4, 15)

c)

{50, 10}

d)

(50, 10, 2)

81.

Python. Insert the required operator to print out all the elements of the tuple: a = (20, 10, 30) for i in ____________: print(a[i])

a)

range(len(a))

b)

range(1:6)

c)

len(a)

d)

range(len(turple))

e)

(50, 10, 2)

82.

Set of Python:

a)

a = 154.02

b)

a = 'Red'

c)

a = {'Alpha', 'Bravo', 'Charlie'}

d)

a = [20, 61, 2, 37, 4, 55, 36, 7, 18, 39]

e)

a = ('Red', 'Green', 'Red', 'Blue', 'Red')

83.

The result of the program chars = ['A', 'B', 'C'] for i in enumerate(chars): print(i, end = ' ')

a)

A B C

b)

(0, 'A') (1, 'B') (2, 'C')

c)

0 1 2

d)

10

e)

25

84.

The result of the program: a = set([3, 6, 3, 5]) print(a)

a)

{2, 4, 6, 8}

b)

{3, 5, 6}

c)

[2, 3]

d)

['П', 'Р', 'И', 'B', 'E', 'T', '!']

e)

{3, 6, 3, 5}

85.

86. Instructions for creating a set

a)

phonetic-set = { 'Alpha' , 'Bravo' , 'Charlie' }

b)

list = [ 'January' , 'February' , 'March' ] ,3

c)

colors-tuple = ( 'Red' , 'Green' , 'Red' , 'Blue' , 'Red' )

d)

list = [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ]

e)

len (list)

86.

A set method that returns elements from the set set1 that are not in set2 (разность множеств set1 - set2):

a)

set.add(x)

b)

set1.difference(set2)

c)

set.update(x, y, z)

d)

set.pop()

e)

set1.intersection(set2)

87.

Definition of a set:

a)

color

b)

pr = (200, 50)

c)

s1 = {'cat': 'кошка', 'dog': 'собака', 'mouse': 'мышь'}

d)

s2 = {3, 6, 3, 5} 

e)

[2, 3]

88.

The result of the program: s1=set(range(5)) s1.add('5') print(s1)

a)

A) {0, 1, 2, 3, 4, 5}

b)

B) {0, 1, 2, 3, 4, '5'}

c)

C) {'cat': 'кошка', 'dog': 'собака', 'mouse': 'мышь'}

d)

D) {3, 5, 6, 7}

e)

E) {7, 3, 6, 3, 7, 5}

89.

The result of the program: s1=set(range(5)) s2=set(range(2)) s1.add('5') s3 = s1.intersection(s2) print(s3)

a)

{0, 1}

b)

{0, 1, 2, 3, 4, '5'}

c)

{200, 50}

d)

{'cat': 'кошка', 'dog': 'собака', 'mouse': 'мышь'}

90.

The result of the program: s1=set(range(5)) s2=set(range(2)) s1.add('5') s3 = s1.union(s2) print(s3)

a)

{0, 1, 2, 3, 4, 5}

b)

{200, 50}

c)

{0, 1, 2, 3, 4, '5'}

d)

{'cat': 'кошка', 'dog': 'собака', 'mouse': 'мышь'}

e)

{0, 1}

91.

90. Python. Имеется кортеж . my_tuple = (4, 2, 3, [6, 5])

Какое действие приведет к ошибке:

a)

del my_tuple[3]

b)

my_tuple[3][0] = 9

c)

del my_tuple

d)

print(my_tuple[:])

e)

print(my_tuple[-1])

92.

91. Method to merge two sets and returns a new set (Метод объединяет два множества и возвращает новое множество):

a)

set.update (x, y, z)

b)

set.add (x) 

c)

set.pop ()

d)

set1.union(set2)

e)

set1.difference(set2)

93.

92. A container that can contain multiple data elements as unique key and associated with it some value «key: value»:   

a)

turple

b)

dictionary

c)

string

d)

float

e)

operator

94.

93. A function that returns an empty dictionary (Функция, которая возвращает пустой словарь):

a)

list()

b)

turple()

c)

dict()

d)

set()

e)

type() 

95.

94. A dictionary method that returns a representation of all pairs (key, value) in dictionary d:

a)

d.keys()

b)

d.items()

c)

set.pop ()    

d)

set1.difference (set2)      

e)

d.pop(k)

96.

95. The result of the program: adding an element to the dictionary using a new index key and assigning a value to it (Результат программы: добавление элемента в словарь с помощью нового ключа индекса и присвоения ему значения)

a)

{'brand': 'Форд', 'model': 'Мустанг', 'year': 1964}

b)

{'brand': 'Форд', 'model': 'Мустанг', 'year': 1964, 'color': 'красный'

c)

('brand': 'Форд', 'model': 'Мустанг', 'year': 1964) 

d)

> ['brand': 'Форд', 'model': 'Мустанг', 'year': 1964, 'color': 'красный']

e)

{'color': 'красный'}

97.

96. Method for deleting an element from the dictionary with the specified key name (Метод  удаления элемента из словаря  с указанным именем ключа):

a)

update() 

b)

pop()

c)

popitem()

d)

del 

e)

clear()

98.

97. Method for the method for returning dictionary keys (Метод  для возвращения ключей словаря):

a)

pop()

b)

keys()

c)

update() 

d)

popitem()

e)

del 

99.

98. A method that returns a dictionary with the specified keys and value (Метод, который возвращает словарь с указанными ключами и значением):

a)

key()

c)

del 

d)

pop()

e)

remove()

100.

99. A method that returns an element with the key «key» (Метод, который возвращает элемент с ключом “key»):

a)

keys()

b)

get(key)

c)

update() 

d)

popitem()

e)

values() 

101.

100. Output the value of the "model" key of the car dictionary using the get method (Вывести значение ключа "model" словаря car  используя метод get):

a)

car.get ("model")

b)

get("model")

c)

key. get("model")

d)

pop(car)

e)

remove()