Professional Documents
Culture Documents
CSC126
FUNDAMENTALS OF ALGORITHMS
&
COMPUTER PROBLEM SOLVING
QUIZ 1
Name :
Student ID :
Group :
INSTRUCTIONS TO CANDIDATES:
1. This question paper consists of four (4) parts:
Part A (10 Questions) – 10 Marks
Part B (5 Questions) – 10 Marks
Part C (5 Questions) – 10 Marks
Part D (1 Question) – 20 Marks
2. Answer ALL questions
SELF-DECLARATION:
1. I know that plagiarism is wrong. Plagiarism is to use another’s work and pretended that is
in one’s own.
2. This assignment/project/test/quiz/final is my own work.
3. I have not involved, and will not allow, anyone to copy my work with the intention of
passing it off as their own work.
4. I acknowledge that copying someone else’s work (or part of it) is wrong and declare that
my assignment/project/test/quiz/final assessment is my own work.
Part A (10 marks)
1. Select the language that uses mnemonic codes, abbreviations that easy to remember.
A. High level language
B. Assembly language
C. Machine language
D. English language
2. Identify the type of error in a source code that may produce an incorrect output of the
program.
A. syntax error
B. logic error
C. systematic error
D. run-time error
4. Choose of the following that is NOT a correct data type for a variable.
A. char
B. double
C. int
D. real
8. Determine the main purpose of testing during fourth phase in Program Development Life
Cycle (PDLC).
A. It is to detect and remove errors
B. It is to implement the developed application system
C. It is to write a program based on algorithm and analysis done earlier
D. It is to identify and analyze the problem
10. Select the term used for the rule of any programming languages
A. library
B. syntax
C. semantics
D. structure
Q1: Write an assignment statement to implement each of the following equation in C++
programming language.
4+3𝑥 10−𝑥
a) 𝑍= +
6−𝑦 𝑦+2
1
b) 𝑆 = 𝑆 + 𝑉𝑡 + 𝑔𝑡 4
2
c) 𝑌 = √𝑆𝑥 3 + 𝑎𝑏 2
[6 marks]
Q2: Determine the output of the following C++ statements. You have to start at the beginning
and the statements are executed in sequence.
a)
b)
[4 marks]
a) Add 5 to variable named num and stores the result in variable named total
c) Print the message “C++ for Beginners” with each word of the message separated on a
separate line
Create a program to determine the surface area and volume of a cylinder. First, you need to write
the pseudo-code and draw a flowchart. You will write a complete C++ program which it is to
accept the radius and height of the cylinder from a user. Later, the program will display the
surface area and volume of a cylinder. The formula of volume and surface area of a cylinder
with its radius and height is given below: