Search Header Logo

Computer Scince Quizz - March 2025

Authored by Himara Senaratne

Computers

11th Grade

Used 1+ times

Computer Scince Quizz - March 2025
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 mins • 20 pts

Media Image

A traffic light simulator uses pseudocode to determine actions based on color input. The rules are:

"Red" → "Stop", "Yellow" → "Caution", "Green" → "Go".

The function trafficLight() mistakenly returns "Go" for "Yellow" due to incorrect condition ordering.

  1. How should the conditions be ordered to fix this?

Swap "Green" and "Red" checks

Place "Yellow" first

Replace ELSEIF with CASE

No changes needed

Answer explanation

The current order checks "Green" before "Yellow," causing incorrect returns. Reordering ensures correct priority.

Therefore teh answer is "Place "Yellow" first"

2.

MULTIPLE CHOICE QUESTION

10 mins • 20 pts

Media Image

A developer is writing a function to check whether a given string consists only of numeric digits.

What method should they use to verify each character is a number?

Checking ASCII values

Using regular expressions

Checking character properties

Using a loop to compare each character manually

Answer explanation

ASCII values for digits range from 48 ('0') to 57 ('9'). By iterating through each character and ensuring its ASCII value falls within this range, we can validate that the string contains only numeric digits.

3.

MULTIPLE CHOICE QUESTION

10 mins • 20 pts

Media Image

A company is developing a program to process a list of customer orders. The program needs to iterate over each order and apply a discount if the order total exceeds a certain amount.

Which loop structure is most suitable?

While loop

Do-while loop

For loop

Recursive function

Answer explanation

A for loop is best suited when iterating through a known number of elements, such as a list of customer orders. It ensures that each order is processed sequentially without unnecessary checks.

4.

MULTIPLE CHOICE QUESTION

10 mins • 20 pts

Media Image

A software engineer is developing a program that performs calculations on large datasets. Instead of rewriting the same logic multiple times, they decide to use functions.

What is the main benefit of using reusable functions?

Reduced memory usage

Increased performance

Code maintainability and reusability

Faster execution speed

Answer explanation

Functions allow code to be reused multiple times without duplication. This improves maintainability, as any changes to logic need to be updated in only one place.


Therefore the answer is :
Code maintainability and reusability

5.

MULTIPLE CHOICE QUESTION

10 mins • 20 pts

Media Image

A weather application determines if it should send a rain alert based on the current precipitation percentage.

Which conditional statement should be used?

If-else statement

Switch-case statement

For loop

While loop

Answer explanation

An if-else statement is ideal for decision-making based on conditions. It allows checking if precipitation is above a certain threshold to trigger an alert.

Therefore teh answer is:
If-else statement

6.

MULTIPLE CHOICE QUESTION

10 mins • 20 pts

Media Image

A software developer needs to sort a list of product prices in ascending order.
Which sorting algorithm is used?

Quick Sort

Merge Sort

Bubble Sort

Insertion Sort

Answer explanation

Bubble Sort repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. It is simple to implement but inefficient for large datasets.

7.

MULTIPLE CHOICE QUESTION

10 mins • 20 pts

Media Image

A teacher wants to print every third number between 1 and 10. The pseudocode uses a FOR loop and MOD operation to identify these numbers.

Which numbers will be printed?

1, 2, 3

3, 6, 9

1, 4, 7

2, 4, 6

Answer explanation

The loop runs from 1 to 10. The MOD operation checks if each number divided by 3 leaves no remainder. Only numbers divisible by 3 (3, 6, 9) satisfy this condition. This demonstrates how MOD can select specific items in a sequence.

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?