wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Ôn Tập Kiểm Tra HK2 TIN HỌC 10

Total questions: 136

Worksheet time: 1hrs 26mins

Name
Class
Date
1.

Trong cửa sổ Python Shell:

a)

Thực thi mỗi lệnh ngay lập tức và xem kết quả.

b)

Không thực thi mỗi lệnh ngay lập tức và không xem kết quả.

c)

Không thể thực thi bất kỳ lệnh nào.

d)

Không thể thực thi mỗi lệnh nhưng thực thi tất cả cùng một lúc.

2.

Lý do chúng ta nên sử dụng ngôn ngữ lập trình cấp cao khi viết chương trình:

a)

Máy tính có thể hiểu và thực thi trực tiếp.

b)

Gần gũi với ngôn ngữ tự nhiên, cú pháp đơn giản, dễ hiểu, dễ học.

c)

Có thể viết tự do mà không cần tuân theo quy tắc của ngôn ngữ lập trình.

d)

Chỉ được sử dụng để học tập, không có ứng dụng trong phát triển ứng dụng web, lập trình game...

3.

Câu nào sau đây về Python là đúng?

a)

Python là một ngôn ngữ lập trình cấp cao.

b)

Python là một ngôn ngữ được biên dịch.

c)

Python là một ngôn ngữ lập trình hướng đối tượng.

d)

Tất cả các câu trả lời đều đúng.

4.

Chọn câu sai?

a)

Cửa sổ Shell cho phép viết và thực thi các biểu thức hoặc lệnh ngay lập tức.

b)

Các ngôn ngữ lập trình trực quan như Scratch dễ sử dụng và phù hợp cho trẻ em.

c)

Trong Python, không có sự phân biệt giữa chữ hoa và chữ thường.

d)

Python là một ngôn ngữ lập trình bậc cao rất phổ biến trên thế giới.

5.

Cho lệnh sau: Print('xin chao') Lệnh trên là không đúng, lệnh đúng là:

a)

print('xin chao')

b)

print(xin chao)

c)

Print(xin chao)

d)

Print('xin chao')

6.

Python là:

a)

Một ngôn ngữ lập trình cấp cao.

b)

Một ngôn ngữ lập trình cấp thấp.

c)

Một trình biên dịch.

d)

Một ngôn ngữ máy.

7.

Trong ngôn ngữ lập trình Python, để in ra màn hình chúng ta sử dụng lệnh:

a)

write()

b)

Print()

c)

cout<<

d)

read()

8.

Trong ngôn ngữ lập trình Python, để in lệnh 'xin chao' chúng ta sử dụng:

4 lines
9.

Trong ngôn ngữ lập trình Python, để in ra màn hình chúng ta sử dụng lệnh:

a)

write()

b)

Print()

c)

cout<<

d)

read()

10.

Trong ngôn ngữ lập trình Python, để in lệnh 'xin chào' chúng ta viết:

a)

print()

b)

print(xin chào)

c)

print('xin chào')

d)

print xin chào

11.

Đ statement nào là sai khi nói về ngôn ngữ Python?

a)

Python phân biệt giữa chữ hoa và chữ thường.

b)

Python là một ngôn ngữ lập trình cấp cao.

c)

Python được sử dụng để phát triển ứng dụng web, phần mềm ứng dụng, điều khiển robot...

d)

Python là một ngôn ngữ máy tính có thể được hiểu và thực thi trực tiếp.

12.

Một chiếc xe ô tô di chuyển từ A đến B với tốc độ v (km/h). Lệnh để tính 'Thời gian mà chiếc xe mất để di chuyển khoảng cách k (km)' là:

a)

print(k/v)

b)

print('k/v')

c)

print("k/v")

d)

print k/v

13.

Python được sử dụng để:

a)

phát triển ứng dụng web, phần mềm ứng dụng

b)

lập trình trò chơi, điều khiển robot

c)

xử lý hình ảnh, phân tích dữ liệu, ...

d)

Tất cả A, B và C.

14.

Chuỗi bạn muốn in trên màn hình bằng lệnh print() cần được đặt trong loại dấu ngoặc nào?

a)

dấu ngoặc đơn

b)

dấu ngoặc kép

c)

dấu nháy

d)

Cả A và B đều đúng.

15.

Trong ngôn ngữ lập trình Python, câu lệnh nào là đúng?

a)

Python là ngôn ngữ lập trình bậc cao duy nhất.

b)

Một chương trình máy tính là một chuỗi lệnh mà máy tính không hiểu.

c)

Python phân biệt giữa chữ hoa và chữ thường.

d)

Chuỗi bạn muốn in ra màn hình bằng lệnh print() không cần sử dụng dấu ngoặc kép.

16.

Cho chương trình sau:

a)

a=b=1

b)

c=1

c)

d=2

d)

print(a+b+c+d)

17.

Kết quả hiển thị trên màn hình là:

a)

3

b)

4

c)

5

d)

6

18.

Một hình vuông có cạnh dài 10 (cm). Chúng ta có thể sử dụng Python để viết một chương trình tính diện tích của hình vuông như sau:

a)

print('diện tích của hình vuông là:',a*a)

b)

print('diện tích của hình vuông là:a*a')

c)

print(diện tích của hình vuông là:a*a)

d)

print 'diện tích của hình vuông là:',a*a

19.

Which statement is correct when...

4 lines
20.

Diện tích của một hình vuông là gì?

a)

print('diện tích của hình vuông là:', a*a)

b)

print('diện tích của hình vuông là:a*a')

c)

print(diện tích của hình vuông là:a*a)

d)

print 'diện tích của hình vuông là:', a*a

21.

Câu nào sau đây là đúng về biến?

a)

Một biến là một số lượng được đặt tên để lưu trữ một giá trị và giá trị có thể thay đổi trong quá trình thực thi chương trình.

b)

Một biến là bất kỳ số lượng nào.

c)

Một biến là một số lượng không thay đổi trong quá trình thực thi chương trình.

d)

Một biến là một số lượng được đặt tên để lưu trữ một giá trị và giá trị không thay đổi trong quá trình thực thi chương trình.

22.

Trong phương trình ax+b=0, các biến là gì?

a)

a, b

b)

a, b, x

c)

x

d)

Không có biến nào.

23.

Trong chương trình sau: x=1 print(x) Biến nào là biến?

a)

1

b)

1, x

c)

x

d)

Không có biến nào.

24.

Trong chương trình sau: y=10 print(y) Giá trị của biến y trên màn hình là gì?

a)

y

b)

0

c)

1

d)

10

25.

Các biến nào sau đây được đặt tên không đúng?

a)

x y

b)

xy

c)

12xy

d)

Cả A và B

26.

Câu lệnh gán trong Python là gì?

a)

Biến=

b)

Biến:=

c)

Biến==

d)

=Biến

27.

Phân công nào là đúng?

a)

x==3

b)

x:=3

c)

x=3

d)

x:3

28.

Trong Python, toán tử chia lấy phần nguyên được biểu diễn bằng:

a)

%

b)

//

c)

/

d)

div

29.

Trong Python, toán tử modulus được biểu diễn bằng:

a)

%

b)

//

c)

/

d)

mod

30.

Biểu thức 2 mũ 4 trong Python được viết là:

a)

2**4

b)

2****4

c)

2*4

d)

2***4

31.

Biểu thức (x+y)^2 trong Python được chuyển đổi thành:

a)

(x**2+y**2)

b)

(x+y)***2

c)

(x+y)**2

d)

(x+y)*2

32.

Trong chương trình sau: x=6 y=2 in(x//y) Giá trị nào được hiển thị trên màn hình?

a)

0

b)

3

c)

2

d)

6

33.

Trong chương trình sau: x=6 y=2 in(x%y) Giá trị nào được hiển thị trên màn hình?

a)

0

b)

3

c)

2

d)

6

34.

Trong Python, tất cả các biến phải tuân theo quy tắc đặt tên nào?

4 lines
35.

Đầu ra của chương trình sau là gì: x=6 y=2 print(x%y)

a)

0

b)

3

c)

2

d)

6

36.

Trong Python, tên biến phải tuân theo quy tắc nào?

a)

Không được trùng với các từ khóa của Python.

b)

Bắt đầu bằng một chữ cái hoặc dấu gạch dưới.

c)

Chỉ chứa chữ cái, số và dấu gạch dưới.

d)

Tất cả A, B và C.

37.

Biểu thức (xy+x):(x-y) trong Python là:

a)

(xy+x)/(x-y)

b)

(x*y+x)//(x-y)

c)

(x*y+x)/(x-y)

d)

(x*y+x)/x-y

38.

Kiểu dữ liệu của đầu ra của chương trình sau: a=3.4 print(type(a))

a)

int

b)

float

c)

str

d)

bool

39.

Lệnh để nhập một biến số nguyên là:

a)

Biến=(input(prompt))

b)

Biến=float(input(prompt))

c)

Biến=input()

d)

Biến=int(input(prompt))

40.

Lệnh để nhập một biến kiểu float là:

a)

Biến=(input(prompt))

b)

Biến=float(input(prompt))

c)

Biến=input()

d)

Biến=int(input(prompt))

41.

Để nhập một biến số nguyên từ bàn phím, chúng ta viết:

a)

a=input('n=')

b)

a=float(input('n='))

c)

a=int(input('n='))

d)

a=int()

42.

Để nhập một biến kiểu float từ bàn phím, chúng ta viết:

a)

b=input('n=')

b)

b=float(input('n='))

c)

b=int(input('n='))

d)

b=int()

43.

Lệnh để hiển thị giá trị của các biểu thức trên màn hình là:

a)

print()

b)

print('danh sách các biểu thức')

c)

print danh sách các biểu thức

d)

print(danh sách các biểu thức)

44.

Cho s là diện tích của tam giác ABC, để hiển thị giá trị của s trên màn hình, chúng ta viết:

a)

print(s)

b)

print s

c)

print('s)

d)

print:(s)

45.

Câu nào đúng khi nói về Hằng số?

a)

Một hằng số là một đại lượng thay đổi trong quá trình thực thi chương trình.

b)

Một hằng số là một đại lượng không thay đổi trong quá trình thực thi chương trình.

c)

Một hằng số là bất kỳ đại lượng nào.

d)

Một hằng số không bao gồm: toán học.

46.

Which statement is correct when talking about commands in Python?

4 lines
47.

Nhận định nào là đúng khi nói về các lệnh trong Python?

a)

Python yêu cầu mỗi lệnh phải được viết trên một dòng riêng biệt, kết thúc bằng dấu chấm phẩy.

b)

Python yêu cầu các lệnh phải được viết trên một dòng.

c)

Python yêu cầu các lệnh phải được viết trên một dòng, kết thúc bằng dấu chấm phẩy.

d)

Python yêu cầu mỗi lệnh phải được viết trên một dòng riêng biệt.

48.

Câu nào là đúng?

a)

Tất cả các biến được sử dụng trong chương trình phải được đặt tên để trình biên dịch có thể lưu trữ và xử lý.

b)

Tất cả các biến được sử dụng trong chương trình không cần phải được đặt tên.

c)

Python có các quy tắc nghiêm ngặt yêu cầu một phần khai báo và một phần thân như Pascal.

d)

Python yêu cầu sử dụng dấu chấm phẩy khi kết thúc một lệnh.

49.

Để tính tổng s của hai số 5 và 6, s thuộc kiểu dữ liệu:

a)

int

b)

float

c)

bool

d)

str

50.

Lệnh gán nào trong Python?

a)

X==6

b)

X=6

c)

X!=6

d)

X:=6

51.

Chọn câu sai?

a)

Trong các ngôn ngữ lập trình cấp cao, có các kiểu dữ liệu số nguyên và kiểu dữ liệu thực.

b)

Lệnh để xuất các giá trị của biểu thức ra màn hình là: print(danh sách biểu thức)

c)

Trong cửa sổ Shell, nếu bạn viết một lệnh chỉ chứa tên của một biến hoặc biểu thức số học, kết quả tương ứng sẽ được hiển thị trên màn hình.

d)

Trong cửa sổ Code, để xuất thông tin và lưu nó trên màn hình, lệnh print() là không cần thiết.

52.

Cho chương trình sau:

a)

3

b)

4

c)

5

d)

6

53.

Given the following program:

a)

-1

b)

0

c)

1

d)

-2

54.

The if command in a Python program has the form:

a)

if

b)

if :

55.

What is the value of x in the above program?

a)

-1

b)

0

c)

1

d)

-2

56.

The if statement in Python has the form:

a)

if

b)

if :

c)

:

d)

if :

57.

When is it necessary to use branching structure in the algorithm?

a)

When it is necessary to base on a specific condition to determine the next step.

b)

When there are calculations.

c)

When repeating a task.

d)

When using mathematical functions.

58.

The if-else branching statement in Python has the form:

a)

if :

b)

if : else

c)

if : else:

d)

if else:

59.

In Python, the if will execute when:

a)

is false.

b)

is true.

c)

is 0.

d)

is not 0.

60.

In Python, with the if-else structure, is executed when:

a)

Condition is false.

b)

Condition is true.

c)

Condition is 0.

d)

Condition is not 0.

61.

In Python, for the if-else structure, is executed when:

a)

Condition is false.

b)

Condition is true.

c)

Condition is 0.

d)

Condition is not 0.

62.

In Python, for the if or if-else structure, how should the statement or group of statements be written?

a)

Write directly in line with the condition.

b)

Indent in a certain number of positions compared to the line containing the condition and do not need to write directly in line with each other.

c)

Only indent in a certain number of positions compared to the line containing the condition when there is a group of statements.

d)

Indent in a certain way.

63.

What is the error in the following program: if d>0: x1=-b-math.sqrt(d)/2*a x1=-b+math.sqrt(d)/2*a?

a)

The command group does not indent relative to the condition line.

b)

Missing a period after each command.

c)

Not capitalizing the first letter of each line.

d)

No end of statement.

64.

What is the in the branching command?

a)

Arithmetic expression.

b)

Logical expression.

c)

Relational expression.

d)

Mathematical functions.

65.

After executing the following program: a=2 b=3 if a>b: a=a*2 else: b=b*2, what is the value of b?

a)

4

b)

2

c)

6

d)

Undefined

66.

After executing the following program: x=10 y=3 d=0 if x%y==0: d=x//y, what is the value of d?

a)

3

b)

1

c)

0

d)

Undefined

67.

Which of the following commands is written correctly?

a)

if a>b print(a)

b)

if a>b:print(a)

c)

if a>b print(a)

d)

if a>b: print(a)

68.

Which of the following commands is written correctly?

a)

if a>b: print(a) else: print(b)

b)

if a>b print(a) else: print(b)

c)

if a>b print(a) else print(b)

d)

if a>b print(a) else print(b)

69.

Choose the correct statement? For the expression: x or y

a)

It results in False if and only if both x and y are False.

b)

It results in True if both x and y are True.

c)

It swaps the values of x and y.

d)

It results in False if and only if either x or y is False.

70.

Which of the following statements is false?

a)

All high-level programming languages have commands that express branching structures.

b)

The condition in the branching command can be an assignment.

c)

In the if or if-else structure, the command or group of commands

d)
71.

How many types of loops are there in Python?

a)

1

b)

2

c)

3

d)

4

72.

The loop structure with a known number of iterations is:

a)

for in range(m,n)

b)

while :

c)

for in range(m,n):

d)

for in range(m,n):

73.

The loop structure with an unknown number of iterations is:

a)

for in range(m,n)

b)

while :

c)

while :

d)

for in range(m,n):

74.

Given the following code: for i in range(5): print(i) What values will i display on the screen?

a)

0 1 2 3 4 5

b)

1 2 3 4 5

c)

0 1 2 3 4

d)

1 2 3 4

75.

Given the following code: for i in range(1,5): print(i) What values will i display on the screen?

a)

0 1 2 3 4 5

b)

1 2 3 4 5

c)

0 1 2 3 4

d)

1 2 3 4

76.

Given the following program: s=0 for i in range(6): s=s+i After executing the above program, what is the value of s?

a)

1

b)

15

c)

6

d)

21

77.

Given the following program: s=0 i=1 while i<=5: s=s+1 i=i+1 After executing the above program, what is the value of s?

a)

9

b)

15

c)

5

d)

10

78.

Which of the following statements is false?

a)

Using the while statement, we can also represent a loop with a known number of iterations.

b)

Using the for statement, we can also represent a loop with an unknown number of iterations.

c)

In Python, there are 2 types of loops: loops with a known number of iterations and loops with an unknown number of iterations.

d)

The statement representing a loop with an unknown number of iterations must be used.

79.

Given the problem of calculating the sum s=1+2+3+...+n. To solve this problem, we can use:

a)

Branching structure.

b)

Loop structure.

c)

Function ceil()

d)

Mathematical function sqrt()

80.

Given the following program: i=1 s=0 while : s=s+i i=i+1 The program calculates the sum s=1+2+3+...+10, is:

a)

i<=10

b)

i==10

c)

i>=10

d)

i>10

81.

in the loop statement with an unknown number of iterations is:

a)

Mathematical function.

b)

Logical expression.

c)

Relational expression.

d)

Computational expression.

82.

The loop with an unknown number of iterations ends when:

a)

is false.

b)

is true.

c)

is greater than 0.

d)

is equal to 0.

83.

The loop with an unknown number of iterations executes when:

a)

is false.

b)

is true.

c)

is greater than 0.

d)

is equal to 0.

84.

Given the following program: for i in range(6): print(i) How many times is the loop executed in the above program?

a)

3

b)

4

c)

5

d)

6

85.

Given the following program: i=0 while i<=5: s=s+i i=i+1 How many times is the loop executed in the above program?

a)

1

b)

2

c)

6

d)

5

86.

A function in Python is declared as:

a)

def function_name(parameter): The statements describing the function

b)

def function_name(parameter) The statements describing the function

c)

def function_name() The statements describing the function

d)

def (parameter): The statements describing the function

87.

"The statements describing the function" must be written:

a)

Aligned with the def statement.

b)

Indented according to Python's rules.

c)

Immediately after the colon (:) and not on a new line.

d)

Written in a block and not indented.

88.

Which of the following statements is incorrect?

4 lines
89.

Which statement is incorrect?

a)

The function name does not need to follow any rules.

b)

A subroutine is a block of code that performs a specific task and is named.

c)

To create a function that returns a processed value, it must end with a return statement along with an expression or variable containing the return value.

d)

The statements describing the function must be indented according to Python's rules.

90.

The math library provides:

a)

Input and output procedures of the program.

b)

Support for creating random choices.

c)

Mathematical constants and functions.

d)

Direct support for compressed formats and data storage.

91.

In the following program segment, what is the error?

a)

Missing function call.

b)

Missing ':' at the end of the first line of the function definition.

c)

Missing formal parameter.

d)

Missing return statement for the value to be returned at the end of the function body.

92.

In the following program segment, what is the result when a=2 and b=4?

a)

-2

b)

4

c)

2

d)

6

93.

At the end of the first line of the function definition, there must be:

a)

A ':'

b)

A ';'

c)

A '.'

d)

A ','

94.

Which statement is correct?

a)

If it is a function with a result, there will be no return statement in the body.

b)

If it is a function with a result, there will be a return statement in the body followed by the return value.

c)

If it is a function with a result, the body will consist of a series of statements calculating the value and there will be no return statement.

d)

If it is a function with a result, the body will contain only the return statement.

95.

To use the sqrt() function, we need to import the library:

a)

math

b)

random

c)

zlib

d)

datetime

96.

When using the sqrt() function, which library must be declared?

a)

math

b)

ramdom

c)

zlib

d)

datetime

97.

Among the following statements, how many are correct?

a)

Using subprograms makes the program easier to understand and debug.

b)

A function can only be called once in the main program.

c)

A function always returns a value through its name.

d)

Python only allows calling a function built-in in Python libraries.

e)

Declaring a function in Python always has a parameter list.

98.

What does the gcd(x,y) function return?

a)

The least common multiple of x and y.

b)

The square root of x and y.

c)

The greatest common divisor of x and y.

d)

The absolute value of x and y.

99.

When using a built-in function (from a library), what do we need?

a)

Call the built-in function without needing to build that function again.

b)

Must rebuild that function.

c)

Must declare the function before calling.

d)

Must declare and rebuild that function.

100.

In the following program segment: def h(a1,b1): s=a1-b1 return s a,b=map(int,input().split()) t=h(a,b) print(t) What is the function call with the passed arguments?

a)

h(a,b)

b)

h(a1,b1):

c)

return s

d)

s=a1-b1

101.

Which statement is incorrect when talking about subprograms?

a)

Helps programming become easier.

b)

Avoids having to write the same sequence of commands repeatedly.

c)

The program is easier to understand and read.

d)

Difficult to detect errors.

102.

In the following program segment: def h(a1,b1): s=a1-b1 return s a,b=map(int,input().split()) t=h(a,b) print(t) In this program segment, a1,b1 are called:

a)

Function name.

b)

Formal parameters.

c)

Actual parameters.

d)

Local variables.

103.

A string is enclosed in:

a)

Single ('') or double ('') quotes.

b)

Parentheses ()

c)

Square brackets []

d)

Curly braces {}

104.

What does the len() function indicate?

4 lines
105.

What are the types of quotes used to enclose a string?

a)

Single ('') or double ('') quotes

b)

Parentheses ()

c)

Square brackets []

d)

Curly braces {}

106.

What does the len() function return?

a)

The length (or number of characters) of the string.

b)

Converts the original string to uppercase.

c)

The position of the first character in the string.

d)

The position of any character in the string.

107.

For the string st='abc', what is the value of len(st)?

a)

1

b)

2

c)

3

d)

4

108.

Given the following code: s1='a', s2='b', print(s1+s2), what will be displayed on the screen?

a)

'a'

b)

'b'

c)

'ab'

d)

'ba'

109.

What does the y.cout(x) function return?

a)

The position of the first occurrence of x in y.

b)

The position of the last occurrence of x in y.

c)

Returns the number of characters in the string x+y.

d)

Counts the number of non-overlapping occurrences of x in y.

110.

Given the following code: S1='abcd', S2='a', print(S1.cout(S2)), what will be displayed on the screen?

a)

1

b)

2

c)

3

d)

4

111.

What is the length of an empty string?

a)

0

b)

1

c)

2

d)

3

112.

For the string st='abc', what is S[0]?

a)

'b'

b)

'a'

c)

'c'

d)

0

113.

What does the y.replace(x1,x2) function mean?

a)

Creates a new string from y by replacing the substring x2 of y with the string x1.

b)

Creates a new string by concatenating x1 and x2.

c)

Replaces the string x1 with the string x1+x2.

d)

Creates a new string from y by replacing the substring x1 of y with the string x2.

114.

Given the strings s1='ha noi' and s2='ha noi cua toi', which statement is correct?

a)

String s2 is greater than string s1.

b)

String s1 is equal to string s2.

c)

String s2 is less than string s1.

d)

String s2 is greater than or equal to string s1.

115.

What does the y.find(x) function indicate?

a)

Returns the position of the last occurrence of string x in string y.

b)

Returns an integer indicating the position of the first occurrence of string x in string y.

c)

Returns an integer indicating the position of the first occurrence of string y in string x.

d)

Returns the position of the last occurrence of string y in string x.

116.

Find the first position in string x where string y appears as a substring of string x.

4 lines
117.

Given the following code: s='abcde' print(s[1:4]) What will be displayed on the screen?

a)

'abc'

b)

'bcde'

c)

'bcd'

d)

'cde'

118.

Given the following code: s='abcde' print(s[:4]) What will be displayed on the screen?

a)

'abc'

b)

'bcde'

c)

'abcd'

d)

'cde'

119.

Given the following code: s='abcde' print(s[3:]) What will be displayed on the screen?

a)

'de'

b)

'bcde'

c)

'abcd'

d)

'cde'

120.

Given the following code: y='abcae' x1='a' x2='d' print(y.replace(x1,x2)) What will be displayed on the screen?

a)

'bce'

b)

'adbcade'

c)

'dbcde'

d)

'dbcae'

121.

To know the size of a list, we use the function:

a)

type()

b)

len()

c)

sort()

d)

pop()

122.

To initialize a list b with 5 elements 1, 2, 3, 4, 5, we write:

a)

b = 1, 2, 3, 4, 5

b)

b = (1, 2, 3, 4, 5)

c)

b = [1..5]

d)

b = [1, 2, 3, 4, 5]

123.

To add an element to the end of a list, we use the function:

a)

append()

b)

pop()

c)

clear()

d)

remove()

124.

To delete the second element in list a, we use the command:

a)

del(2)

b)

del a[2]

c)

del a

d)

remove(2)

125.

To delete all elements in the list, we call the member function:

a)

append()

b)

pop()

c)

clear()

d)

remove()

126.

To access the first element in list a, we use the command:

a)

a[1]

b)

a[0]

c)

a0

d)

a[]

127.

Given the array a=[0,2,4,6]. What is a[1]?

a)

0

b)

2

c)

4

d)

6

128.

Given the following code: a=[1,2,3] a.append(4) print(a) After executing the above code, what will the list a contain?

a)

a=[4,1,2,3]

b)

a=[1,2,3]

c)

a=[1,2,3,4]

d)

a=[1,4,2,3]

129.

Given the following code: a=[1,2,3] a.pop(2) print(a) After executing the above code, what will the list a contain?

a)

a=[1,2]

b)

a=[2,3]

c)

a=[1,3]

d)

a=[2]

130.

Given the program: a=[1,2,3] a.pop(2) print(a) After executing the above program, what does the list a contain?

a)

a=[1,2]

b)

a=[2,3]

c)

a=[1,3]

d)

a=[2]

131.

Given the program: a=[1,2,3] a.insert(0,2) print(a) After executing the above program, what does the list a contain?

a)

a=[0,1,2,3]

b)

a=[2,3]

c)

a=[2,1,2,3]

d)

a=[1,2,3,2]

132.

What does the command a.sort() do?

a)

Deletes the list a.

b)

Sorts the list a in descending order.

c)

Sorts the list a in ascending order.

d)

Accesses the first element in the list a.

133.

Given the program: a=[2,4,6] for i in a: print(2*i) What will be displayed on the screen?

a)

2 4 6

b)

4 6 8

c)

4 6 12

d)

4 8 12

134.

Given the program: a=[3,1,5,2] a.sort() print(a) After executing the above program, what does the list a display on the screen?

a)

[1,2,3,5]

b)

[3,1,5,2]

c)

[5,3,2,1]

d)

[3,5,2,1]

135.

To initialize the list a as an empty list, we write:

a)

a=''

b)

a=[]

c)

a=[0]

d)

a=''

136.

Given the list a containing elements [3,4,5]. What is len(a)?

a)

1

b)

2

c)

3

d)

4