Program Flow 3
Explain the difference between between a WHILE LOOP and a REPEAT UNTIL loop.
Study the code below 001 print(“Welcome to the Adding Machine”) 002 print(“*****************************”) 003 number1 = int(input(“Enter your first number: “)) 004 number2 = int(input(“Enter your second number: “)) 005 sum = number1 + number2 006 print(“The sum of your inputs is”, sum) State which programming construct this algorithm uses. Explain your answer.
Study the code below: 001 numberToBeGuessed = 72 002 numberTry = 0 003 while numberTry != numberToBeGuessed 004 numberTry = input(“Enter a guess”) 005 if numberTry < numberToBeGuessed 006 print(“Too Low”) 007 elseif numberTry > numberToBeGuessed 008 print(“Too High”) 009 endif 010 endwhile 011 print(“You Got It!”) State what
Describe what is meant by a constant?
Variables and Data Types 3 Read More »
Describe what is meant by a variable?
Variables and Data Types 2 Read More »
A Computer Science student is writing a program that must accept various data about the user. In particular, the program needs to store the user’s first initial, surname, age and whether or not the user likes marmite, in 4 separate variables. State the most appropriate data type(s) for these 4 variables: – first_initial – surname
Variables and Data Types 1 Read More »
Study the following dataset: 5 4 3 6 2 7 Show This command word is requesting that you provide a step by step example how a merge sort would sort the data, step by step.
State This command word requires you to write a statement that clearly highlights one way that an insertion sort is inferior to merge sort a disadvantage of an ‘Insertion Sort’ compared with a ‘Merge Sort’.
Explain This command word requires you to provide details of the how the sorting algorithm works fully, how an insertion sort algorithm orders data.
Study the following dataset: 5 4 3 6 2 Show This command word is requesting that you provide a step by step example how an insertion sort would sort the data, step by step.
Notifications