Share python quiz computer science

vietsonhuynh

New member
** #Python #Quiz #ComputerScience #Coding #lập trình **

## Câu đố Python cho sinh viên khoa học máy tính

Bài kiểm tra này được thiết kế để kiểm tra kiến thức của bạn về ngôn ngữ lập trình Python.Nó bao gồm một loạt các chủ đề, bao gồm các kiểu dữ liệu, biến, toán tử, câu lệnh điều khiển, chức năng và mô -đun.

**Hướng dẫn:**

1. Câu đố này có 10 câu hỏi trắc nghiệm.
2. Mỗi câu hỏi có bốn câu trả lời có thể.
3. Bạn có 10 phút để hoàn thành bài kiểm tra.
4. Chúc may mắn!

**Đố:**

1. Kiểu dữ liệu của biểu thức sau đây là gì?

`` `
x = "Hello World"
`` `

(Một chuỗi
(B) Số nguyên
(C) Phao
(D) Boolean

2. Đầu ra của mã sau là gì?

`` `
x = 5
y = 10
in (x + y)
`` `

(A) 15
(B) 20
(C) 50
(D) 100

3. Đầu ra của mã sau là gì?

`` `
x = 5
Nếu x> 0:
In ("Tích cực")
khác:
in ("tiêu cực")
`` `

(A) Tích cực
(B)
(C) không có
(D) Lỗi

4. Đầu ra của mã sau là gì?

`` `
def add (x, y):
trả lại x + y

In (Thêm (5, 10))
`` `

(A) 15
(B) 20
(C) 50
(D) 100

5. Đầu ra của mã sau là gì?

`` `
nhập khẩu toán học

in (Math.sqrt (2))
`` `

(A) 1.4142135623730951
(B) 1.414213562373095
(C) 1.4142135623730953
(D) 1.4142135623730954

6. Đầu ra của mã sau là gì?

`` `
Đối với tôi trong phạm vi (5):
in (i)
`` `

(A) 0, 1, 2, 3, 4
(B) 1, 2, 3, 4, 5
(C) 0, 1, 2, 3, 4, 5
(D) 0, 1, 2, 3, 4, 5, 6

7. Đầu ra của mã sau là gì?

`` `
x = [1, 2, 3, 4, 5]
in (x [0])
in (x [-1])
`` `

(A) 1, 5
(B) 2, 4
(C) 3, 5
(D) 4, 5

8. Đầu ra của mã sau là gì?

`` `
x = {"name": "john", "tuổi": 20}
in (x ["tên"]))
in (x ["tuổi"]))
`` `

(A) John, 20
(B) 20, John
(C) John, 21
(D) 21, John

9. Đầu ra của mã sau là gì?

`` `
Nhập ngẫu nhiên

in (ngẫu nhiên.randint (1, 10))
`` `

(A) Một số nguyên ngẫu nhiên từ 1 đến 10
(B) Một số nguyên ngẫu nhiên từ 0 đến 10
(C) Một số nguyên ngẫu nhiên từ 1 đến 9
(D) Một số nguyên ngẫu nhiên từ 0 đến 9

10. Đầu ra của mã sau là gì?

`` `
nhập khẩu sys

in
=======================================
**#Python #Quiz #ComputerScience #Coding #Programming**

## Python Quiz for Computer Science Students

This quiz is designed to test your knowledge of the Python programming language. It covers a variety of topics, including data types, variables, operators, control flow statements, functions, and modules.

**Instructions:**

1. This quiz has 10 multiple-choice questions.
2. Each question has four possible answers.
3. You have 10 minutes to complete the quiz.
4. Good luck!

**Quiz:**

1. What is the data type of the following expression?

```
x = "hello world"
```

(A) string
(B) integer
(C) float
(D) boolean

2. What is the output of the following code?

```
x = 5
y = 10
print(x + y)
```

(A) 15
(B) 20
(C) 50
(D) 100

3. What is the output of the following code?

```
x = 5
if x > 0:
print("Positive")
else:
print("Negative")
```

(A) Positive
(B) Negative
(C) None
(D) Error

4. What is the output of the following code?

```
def add(x, y):
return x + y

print(add(5, 10))
```

(A) 15
(B) 20
(C) 50
(D) 100

5. What is the output of the following code?

```
import math

print(math.sqrt(2))
```

(A) 1.4142135623730951
(B) 1.414213562373095
(C) 1.4142135623730953
(D) 1.4142135623730954

6. What is the output of the following code?

```
for i in range(5):
print(i)
```

(A) 0, 1, 2, 3, 4
(B) 1, 2, 3, 4, 5
(C) 0, 1, 2, 3, 4, 5
(D) 0, 1, 2, 3, 4, 5, 6

7. What is the output of the following code?

```
x = [1, 2, 3, 4, 5]
print(x[0])
print(x[-1])
```

(A) 1, 5
(B) 2, 4
(C) 3, 5
(D) 4, 5

8. What is the output of the following code?

```
x = {"name": "John", "age": 20}
print(x["name"])
print(x["age"])
```

(A) John, 20
(B) 20, John
(C) John, 21
(D) 21, John

9. What is the output of the following code?

```
import random

print(random.randint(1, 10))
```

(A) A random integer between 1 and 10
(B) A random integer between 0 and 10
(C) A random integer between 1 and 9
(D) A random integer between 0 and 9

10. What is the output of the following code?

```
import sys

print
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top