Chapter 1 to Chapter 5 python

Chapter 1 to Chapter 5 python

University

45 Qs

quiz-placeholder

Similar activities

Дастурлаш 1

Дастурлаш 1

University

40 Qs

Quiz Pengetahuan Umum

Quiz Pengetahuan Umum

10th Grade - University

50 Qs

Python 3

Python 3

University

42 Qs

DSA Quiz # 1

DSA Quiz # 1

University

50 Qs

Python Programming Quiz

Python Programming Quiz

University

49 Qs

Python Design Patterns Quiz

Python Design Patterns Quiz

University

50 Qs

Final Test preparation and recap

Final Test preparation and recap

University

40 Qs

Питон 1-50

Питон 1-50

University

50 Qs

Chapter 1 to Chapter 5 python

Chapter 1 to Chapter 5 python

Assessment

Quiz

Information Technology (IT)

University

Hard

Created by

Chong May

FREE Resource

45 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What symbol is used to write a single-line comment in Python?

//

<!--

#

/*

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following best describes the difference between Python 2 and Python 3?

Python 3 is just a faster version of Python 2.

Python 2 uses print as a function, while Python 3 uses print as a statement.

Python 3 uses print as a function, while Python 2 uses print as a statement.

Python 2 supports more libraries than Python 3.

3.

OPEN ENDED QUESTION

5 mins • 5 pts

Write a simple python program to remove duplicate elements from a list.
Input: [1, 2, 2, 3, 4, 4, 5]
Output: [1, 2, 3, 4, 5]

Evaluate responses using AI:

OFF

Answer explanation

Answer 1:
numbers = [1, 2, 2, 3, 4, 4, 5]

unique_numbers = []

for num in numbers:

if num not in unique_numbers:

unique_numbers.append(num)

print("List after removing duplicates:", unique_numbers)

Answer 2:
# Input list

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

# Remove duplicates using set and convert back to list

unique_numbers = list(set(numbers))

# Optional: sort the result to maintain order

unique_numbers.sort()

# Output

print("List after removing duplicates:", unique_numbers)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct extension of a Python file?

.pyth

.pt

.py

.p

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to define a function in Python?

function

def

fun

define

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of: print(type("Hello"))

<type 'string'>

<class 'int'>

<class 'str'>

str

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not a valid Python data type?

array

tuple

list

dictionary

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?