Introduction to Programming Quiz 1
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
School of Computer Science
Introduction to Programming Quiz 1
Sample
Question 1 - 7 marks
a) Perform a desk check on the following flowchart showing a new line for each change, and
b) Convert the flowchart diagram to Python3 code.
Question 2 - 1 mark
What will be the value of num after this code executes?
Question 3 - 1 mark
Given the following statement
What is printed to standard output?
Question 4 - 3 mark
Consider the Python3 code:
Evaluate the expressions for x, y and z:
Question 5 - 3 marks
Consider the code:
The program is run using
It produces an error. Describe the error:
Fix the code such that the program produces the output 15
Question 6 - 3 marks
What is the data type of each variable at each line of code? Write your answers in the given table
Question 7 - 5 marks
Write a program to print a message to the screen using the while loop.
N parrots are arranged in a line and one speaks after another. The message will print which parrot is talking from the first to the last.
The message to be printed is "Parrot #x is talking", where x is an integer in the range [1, N].
Given an input integer number n, loop over all the parrots and print which one is talking. After all parrots have spoken, print the words "The parrots have spoken!"
You cannot use any for loops in your answer.
Example:
2021-09-23