
2.1 Algorithms (Past Questions)
Authored by Ian Currie
Computers
10th - 12th Grade
Used 20+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
51 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
There is a subroutine, HEX(), that takes a denary number between 10 and 15 and returns the corresponding hexadecimal number. E.g. HEX(10) would return "A", HEX(15) would return "F".
Write an algorithm, using the subroutine HEX(), to convert any whole decimal number between 0 and 255 into a 2 digit hexadecimal number.
The image contains an example answer.
There were four marks available:
- Taking a number as input
- Using HEX subroutine correctly
- Calculating Digit 1
- Calculating Digit 2
Which line(s) of code earned mark: Taking a number as input
INPUT decimal
digitl = decimal DIV 16
IF digitl>=10 THEN
...digit1 = HEX(digit1)
IF digit2>=10 THEN
...digit2=HEX(digit2)
digit2 = decimal - (digit1*16)
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
There is a subroutine, HEX(), that takes a denary number between 10 and 15 and returns the corresponding hexadecimal number. E.g. HEX(10) would return "A", HEX(15) would return "F".
Write an algorithm, using the subroutine HEX(), to convert any whole decimal number between 0 and 255 into a 2 digit hexadecimal number.
The image contains an example answer.
There were four marks available:
- Taking a number as input
- Using HEX subroutine correctly
- Calculating Digit 1
- Calculating Digit 2
Which line(s) of code earned mark: Using HEX subroutine correctly
INPUT decimal
digitl = decimal DIV 16
IF digitl>=10 THEN
...digit1 = HEX(digit1)
IF digit2>=10 THEN
...digit2=HEX(digit2)
digit2 = decimal - (digit1*16)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
There is a subroutine, HEX(), that takes a denary number between 10 and 15 and returns the corresponding hexadecimal number. E.g. HEX(10) would return "A", HEX(15) would return "F".
Write an algorithm, using the subroutine HEX(), to convert any whole decimal number between 0 and 255 into a 2 digit hexadecimal number.
The image contains an example answer.
There were four marks available:
- Taking a number as input
- Using HEX subroutine correctly
- Calculating Digit 1
- Calculating Digit 2
Which line(s) of code earned mark: Calculating Digit 1
INPUT decimal
digitl = decimal DIV 16
IF digitl>=10 THEN
...digit1 = HEX(digit1)
IF digit2>=10 THEN
...digit2=HEX(digit2)
digit2 = decimal - (digit1*16)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
There is a subroutine, HEX(), that takes a denary number between 10 and 15 and returns the corresponding hexadecimal number. E.g. HEX(10) would return "A", HEX(15) would return "F".
Write an algorithm, using the subroutine HEX(), to convert any whole decimal number between 0 and 255 into a 2 digit hexadecimal number.
The image contains an example answer.
There were four marks available:
- Taking a number as input
- Using HEX subroutine correctly
- Calculating Digit 1
- Calculating Digit 2
Which line(s) of code earned mark: Calculating Digit 2
INPUT decimal
digitl = decimal DIV 16
IF digitl>=10 THEN
...digit1 = HEX(digit1)
IF digit2>=10 THEN
...digit2=HEX(digit2)
digit2 = decimal - (digit1*16)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Johnny is writing a program to create usernames. The first process he has developed is shown in the flowchart in Fig. 1.
[Start]
↓
[Input firstname]
↓
[Input surname]
↓
[name = LEFT(firstName, 3)]
↓
[username = name + left(Surname,2)]
↓
[OUTPUT username]
↓
[Stop]
For example, using the process in Fig. 1, Tom Ward's user name would be TomWa.
State, using the process in Fig. 1, the username for Rebecca Ellis.
RebEl
EllRe
ElReb
ReEll
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Johnny has updated the process used to create usernames as follows:
If the person is male, then their username is the last 3 letters of their surname and the first 2 letters of their first name.
If the person is female, then their username is the first 3 letters of their first name and the first 2 letters of their surname.
What would be the username for a male called Fred Biscuit using the updated process?
UitFr
FreBi
FrUit
BiFre
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Johnny has updated the process used to create usernames as follows:
If the person is male, then their username is the last 3 letters of their surname and the first 2 letters of their first name.
If the person is female, then their username is the first 3 letters of their first name and the first 2 letters of their surname.
Write an algorithm for Johnny to output a username using the updated process.
An example answer can be seen in the image.
There were six marks available:
- Taking firstname, surname and gender as input
- Checking IF gender is male / female (using appropriate selection)
- For male ...Generating last 3 letters of surname using appropriate string manipulation
- ...Generating first 2 of letters of firstname and adding to previous
- For female.... correctly calculating as before
- Correct concatenation and output
Which line(s) earned the mark: - Taking firstname, surname and gender as input
input firstname, surname, gender
if gender = "Male" then
else
...username = RIGHT(surname, 3) + LEFT(firstname,2)
...username = LEFT (firstname,3) + LEFT(surname,2)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
50 questions
Ulangan Harian Bab V TIK Kelas XI
Quiz
•
11th Grade
54 questions
eSkill-8
Quiz
•
12th Grade
53 questions
Intro To Networking 123
Quiz
•
9th - 12th Grade
50 questions
SOAL INFORMATIKA KELAS XI SEMESTER 1
Quiz
•
11th Grade
50 questions
kuis Jaringan Internet
Quiz
•
9th Grade - University
55 questions
K11 - Giữa HK II - CS Cánh diều
Quiz
•
11th Grade
50 questions
PAS_TIK_Kelas XII
Quiz
•
12th Grade
47 questions
Empowerment Technology
Quiz
•
12th Grade
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
Exploring Valentine's Day with Charlie Brown
Interactive video
•
6th - 10th Grade
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
10 questions
Valentine's Day History and Traditions
Interactive video
•
6th - 10th Grade
21 questions
Presidents Day Trivia
Quiz
•
6th - 12th Grade
10 questions
Valentine's Day: History and Modern Celebration
Interactive video
•
9th - 12th Grade
11 questions
Valentine's Day Trivia
Quiz
•
8th - 12th Grade
10 questions
Elijah McCoy: Innovations and Impact in Black History
Interactive video
•
6th - 10th Grade