Python Programming Quiz

Python Programming Quiz

10th Grade

33 Qs

quiz-placeholder

Similar activities

Ôn tập giữa kỳ 2 - Python

Ôn tập giữa kỳ 2 - Python

10th Grade

37 Qs

Python - Syntax, Functions and Control Flow

Python - Syntax, Functions and Control Flow

9th - 12th Grade

28 Qs

Bài kiểm tra cuối kì

Bài kiểm tra cuối kì

9th - 12th Grade

30 Qs

Functions in Python

Functions in Python

10th - 12th Grade

28 Qs

Python Functions and Methods

Python Functions and Methods

10th - 12th Grade

28 Qs

python functions

python functions

10th Grade

33 Qs

TIN HỌC KTRA 15P

TIN HỌC KTRA 15P

10th Grade - University

29 Qs

Python по занятиям

Python по занятиям

1st - 10th Grade

28 Qs

Python Programming Quiz

Python Programming Quiz

Assessment

Quiz

Computers

10th Grade

Medium

Created by

James Dillon

Used 3+ times

FREE Resource

33 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do I print 'Hello, World!' in Python?

print(Hello, World!)

echo 'Hello, World!'

print('Hello, World!')

System.out.println('Hello, World!')

printf('Hello, World!')

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will you get if you call print (str[2:10]) and str = "Dogs are absolutely amazing creatures, far superior to snakes"

"ogs are "

"gs are ab"

"Dogs are abso"

"ogs are a"

"gs are"

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following Python function to find the maximum number in a list:

def find_max(numbers):
    max_num = numbers[0]
    for num in numbers[1:]:
        if num > max_num:
            max_num = num
    return max_num

numbers = [5, 3, 8, 6, 7]
max_number = find_max(numbers)
print("The maximum number is: ", max_number)

What is the issue with this code?

The function does not correctly find the maximum number.

The print statement is outside the function.

There is no issue; the code works as intended.

The list should be sorted before finding the maximum number.

The initial max_num should be set to None.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

def calculate_sum():\n if y == 5:\n return y + 5\n elif y == 10:\n return y + 10\n\nWhat are the issues with this function?

Indentation error in line 2

Incorrect use of equality operator. Use assignment operator instead.

Indentation error in line 4

Variable 'y' is not defined within the function

There are no issues with the function

5.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

What is the result of the operation len('hello') + 2?

Returns the sum of the length of 'hello' and 2.

Concatenates 'hello' with '2'.

Removes 2 characters from 'hello'.

Generates an error.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of executing the following code snippet?

colors = ['Red', 'Green', 'Blue', 'Yellow', 'Black']

# Attempting to access:
print(colors[5])

Yellow

Black

IndexError

Green

Red

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following operation? value = 'data science' list_example = [10, 20, '30', -5, 'analysis'] print(len(value), len(list_example))

12 5

11 5

13 6

10 4

error

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?