S4: RECAP UNTIL TESTING

S4: RECAP UNTIL TESTING

11th Grade

11 Qs

quiz-placeholder

Similar activities

BÀI TẬP T7 - KHỞI ĐỘNG

BÀI TẬP T7 - KHỞI ĐỘNG

10th - 12th Grade

10 Qs

Sains Komputer Tingkatan 4 - 3.1.1 Mengkaji keperluan intera

Sains Komputer Tingkatan 4 - 3.1.1 Mengkaji keperluan intera

1st Grade - Professional Development

10 Qs

SOAL PTS 1 KOMPUTER AKUNTANSI KELAS XI

SOAL PTS 1 KOMPUTER AKUNTANSI KELAS XI

11th Grade - University

10 Qs

Computer Lab Rules

Computer Lab Rules

9th - 12th Grade

13 Qs

Input Devices of Computer

Input Devices of Computer

11th Grade

10 Qs

VB Controls

VB Controls

11th Grade

10 Qs

AIJ XI TKJ

AIJ XI TKJ

11th Grade

10 Qs

EmTech Q1 Post Test 3

EmTech Q1 Post Test 3

11th Grade

10 Qs

S4: RECAP UNTIL TESTING

S4: RECAP UNTIL TESTING

Assessment

Quiz

Computers

11th Grade

Practice Problem

Medium

Created by

Kieran Kyle

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

x = 10

if x > 5:

print("Greater")

else:

print("Smaller")

Greater

Smaller

Error

No Output

Answer explanation

The if statement checks if x is greater than 5. Since x is 10, the condition is True, and "Greater" is printed.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the final value of sum after this code is executed?

num = 0

for i in range(5):

num = num + i

print(num)

5

10

15

20

Answer explanation

The loop iterates over a range of 5 numbers from 0 to 4. The sum of these numbers (0+1+2+3+4) is 10

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the list my_list = ["apple", "banana", "cherry"]


What does print(len(my_list)) return?

3

6

15

Error

Answer explanation

The len() function returns the number of items in an object. Since my_list contains three items, the result is 3.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be printed by the following code snippet?

fruits = ["apple", "banana", "cherry"]

print(fruits[1])

apple

banana

cherry

IndexError

Answer explanation

Arrays in Python are zero-indexed, so fruits[1] refers to the second element in the list, which is "banana".

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code do?

user_input = 0

while user_input < 1 or user_input > 10:

user_input = int(input("Enter a number between 1 and 10: "))

Repeats until a number less than 1 is entered.

Repeats until a number greater than 10 is entered.

Repeats until a number between 1 and 10 is entered.

Causes an infinite loop.

Answer explanation

The code keeps asking for input until the user enters a number within the range 1-10 (inclusive).

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How does the following code snippet calculate a running total?

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

total = 0

for index in numbers:

total = total + index

Adds the index of each element to total.

Adds the value of each element to total.

Multiplies the value of each element with total.

Subtracts the value of each element from total.

Answer explanation

The code iterates through the list numbers and adds each to the total variable, accumulating the sum of the list elements.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What kind of error will occur when the following code is executed?

for i in range(10)

print(i)

Syntax

Logic

Execution

Extreme

Answer explanation

The code is missing a colon : at the end of the for loop declaration, which is required in Python to indicate the start of the loop's body. This will result in a syntax error when the code is run.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?