National
Computing Challenge

2024 Computing Contest and Solutions - Gr 5 - 8

Question 1: Binary Search Tree

Solution

Explanation:

When adding new nodes to a binary search tree, it's crucial to understand the correct placement rules to ensure the tree remains sorted.

In tree C, the insertion of 13 in the right subtree of a node with a value smaller than 13 (12) follows this rule correctly. In contrast, trees A and B violate these rules by placing 13 in incorrect positions within their respective subtrees.


Final Tree:

The new tree looks like this (Answer C) :

Why Is This Important in Computer Science?

Binary Search Trees (BSTs) are like smart organizers. They make it easy to:

BSTs are used in apps, games, and websites to store and organize data, making them faster and more efficient. Learning about BSTs helps you understand how computers keep things neat and easy to find!

Question 2: Modulo

Solution

Correct Answer: D) 2


Explanation:

This question uses the modulo operation, which tells us the remainder when one number is divided by another.


Step-by-Step Process:


Final Answer:
The number of markers left after distribution is 2, which matches Option D.


Why Is This Important in Computer Science?

The modulo operation is a powerful tool used in computer science to solve problems like:

By understanding modulo, you learn how computers solve these problems quickly and efficiently!



Question 3: Audio Sampling

Solution

Correct Answer: B) Sound B


Explanation:

To find the total number of samples recorded, multiply the sampling rate (how many samples are taken per second) by the duration (how long the sound is recorded). This gives the total number of snapshots taken for each sound.


Step-by-Step Process:


Comparison of Totals:


Final Answer:
Sound B has the highest total number of samples recorded: 9,200 samples, which matches Option B.


Why Is This Important in Computer Science?

Audio sampling is how computers store sound by breaking it into tiny pieces, or "snapshots." This is important for:

Understanding audio sampling helps students learn how computers turn real-world sounds into data they can process and store!

Question 4: Encryption

Solution

Correct Answer: A) PBZPHGRE


Explanation:

The ROT13 encryption shifts each letter in a word 13 places forward in the alphabet. If the shift goes past "Z," it wraps around to the beginning of the alphabet.


Step-by-Step Process:

Let’s encrypt the word "COMPUTER":


Final Answer:
The encrypted version of "COMPUTER" using ROT13 is PBZPHGRE, which matches Option A.


Why Is This Important in Computer Science?

Encryption like ROT13 is used to:

ROT13 is a simple example of encryption, and understanding it helps students learn how computers keep information safe!


Question 5: Bitfields

Solution

Correct Answer: C) Compass and binoculars


Explanation:

A bitfield is a row of bits (1s and 0s) that represent information. In this game:

The bitfield 0110 represents the following:


Breakdown of 0110:


Final Answer:
The player has a compass and binoculars, which matches Option C.


Why Is This Important in Computer Science?

Bitfields are a simple but powerful way for computers to store information efficiently:

Learning bitfields shows how computers store and manage lots of small pieces of information!


Question 6: Conditional Logic

Solution

Correct Answer: C) 10


Explanation:

We start with x = 14 and apply each rule step by step, updating x after each rule.


Step-by-Step Process:


Final Answer:
The final result after applying all the rules is 10, which matches Option C.


Why Is This Important in Computer Science?

Conditional logic is essential in programming because it:

By learning conditional logic, you understand how computers make decisions step by step!


Question 7: Boolean Logic

Solution

Correct Answer: D) Statement 2 ∧ (Statement 3 ∨ Statement 4)


Explanation:

In Boolean logic:

Let’s evaluate each option step by step.


Step-by-Step Evaluation

This is True, but let’s check Option D for accuracy.


Final Answer: D


Why Is This Important in Computer Science?

Boolean logic is a fundamental concept in computer science that helps process and make decisions about digital information. Understanding Boolean logic is important for various reasons:

Boolean logic is a fundamental concept in computer science that helps process and make decisions about digital information. Understanding Boolean logic is important because it enables developers to create more efficient algorithms, validate data accurately, and design reliable software systems.

Question 8: Time Complexity

Solution

Correct Answer: B) 680 mb


Explanation:

To find the file size where the time for Option A (uploading) equals the time for Option B (driving), calculate the total time for both options and solve for the file size.


Step-by-Step Process:


Final Answer:
The file size that makes the time for Option A equal to Option B is 680 mb, which matches Option B.


Why Is This Important in Computer Science?

Time complexity helps compare how efficient different methods (algorithms) are for solving a problem. Learning this concept helps you:

Question 9: Variables

Solution

Correct Answer: B) 14


Explanation:

To find the value of w, we calculate each variable step by step based on the given assignments.


Step-by-Step Process:


Final Answer:
The value of w is 14, which matches Option B.


Why Is This Important in Computer Science?

Variables are essential in programming because they:

Learning how variables work helps you understand how programs perform calculations and make decisions.


Question 10: Compression

Solution

Part 1: What is the compressed version of the string using RLE?

Correct Answer: D) 4P2Q6R4E9W5A3G4H


Explanation:

To compress the string using Run-Length Encoding (RLE), count how many times each character repeats consecutively and write the count followed by the character. Let’s break it down:

Original string: PPPPQQRRRRRREEEEWWWWWWWWWAAAAAGGGHHHH


Part 2: Calculate the percentage of space saved by using RLE.

Correct Answer: C) 57%


Explanation:

= 37 − 16

= 21​

= (21 ÷ 37) × 100

57%


Final Answers:


Why Is This Important in Computer Science?

Data compression reduces the amount of space needed to store or transfer information, which is critical for:

Learning about RLE helps you understand how computers handle large amounts of data efficiently!

Question 11: Assembly

Solution

Correct Answer: B) 16


Explanation:

The program involves looping through steps with specific conditions. Each loop iteration and instruction execution counts as one step. Let’s simulate the process step by step.


Step-by-Step Simulation:

[0]: Start with the counter at 1

counter = 1

next step = 1


[1]: Multiply the counter by A

counter = 3

next step = 2


[2]: If the counter is even, add B; otherwise, don't change it

counter = 3

next step = 3


[3]: If the counter is still less than the Target Value (50), go back to step [1]; otherwise don't change it

counter = 3

next step = 1


[1]: Multiply the counter by A

counter = 9

next step = 2


[2]: If the counter is even, add B; otherwise, don't change it

counter = 9

next step = 3


[3]: If the counter is still less than the Target Value (50), go back to step [1]; otherwise don't change it

counter = 9

next step = 1


[1]: Multiply the counter by A

counter = 27

next step = 2


[2]: If the counter is even, add B; otherwise, don't change it

counter = 27

next step = 3


[3]: If the counter is still less than the Target Value (50), go back to step [1]; otherwise don't change it

counter = 27

next step = 1


[1]: Multiply the counter by A

counter = 81

next step = 2


[2]: If the counter is even, add B; otherwise, don't change it

counter = 81

next step = 3


[3]: If the counter is still less than the Target Value (50), go back to step [1]; otherwise don't change it

counter = 81

next step = 4


[4]: Subtract C from the counter

counter = 76

next step = 5


[5]: If the counter is less than the Target Value (50), go back to step [1]; otherwise don't change it

counter = 76

next step = 6


[6]: Stop (Program stops here if counter is equal to or greater than the Target Value)

counter = 76


The program took 16 steps to complete.


Why Is This Important in Computer Science?


Assembling code involves translating high-level programming languages into machine-specific instructions that can be executed directly by a computer's processor. Understanding assembly language is crucial for:



In this specific solution, understanding the steps involved in simulating a program's execution demonstrates the importance of low-level programming concepts like looping, conditional statements, and iteration.

Question 12: Password Hashing

Solution

Correct Answer: C) TREE


Explanation:

We use the password hashing algorithm to calculate the hash for each option and find the one that matches the given hash value of 101.

Algorithm Recap:


Option A: DOG


Option B: BEAR


Option C: TREE


Option D: MOON


Final Answer: C) TREE produces the hash value of 101.


Why Is This Important in Computer Science?

Password hashing algorithms are essential for:

Understanding hashing builds a strong foundation in cybersecurity and data protection.


Question 13: Pathfinding

Solution

Correct Answer: B) 26


Explanation:

To find the shortest path from A to P, we use the given grid and calculate the step costs. This involves trying different possible paths and summing up their costs to identify the path with the lowest total cost.


Step-by-Step Process


Shortest Path:

Total Step Cost: 6 + 2 + 6 + 4 + 5 + 3 = 26


Why Is This Path the Best?


Why Is This Important in Computer Science?

Pathfinding algorithms like this are used in:

By practicing these problems, you build an understanding of how computers solve optimization problems efficiently!