Memo (UNISA South Africa)
,Question 1:
What is the primary purpose of a programming language?
A) To communicate with hardware
B) To allow users to create software applications
C) To translate human commands into machine-readable code
D) To facilitate the creation of algorithms
Correct Option: D
Rationale: The primary purpose of a programming language is to facilitate the creation
of algorithms. Programming languages provide the syntax and structure necessary to
define algorithms in a way that is understandable and executable by computers.
Question 2:
Which of the following is NOT a fundamental concept in programming?
A) Variables
B) Loops
C) Data structures
D) Formatting
Correct Option: D
Rationale: While formatting is important for code readability, it is not a fundamental
concept in programming. Variables, loops, and data structures are core elements that
form the backbone of programming logic and functionality.
Question 3:
In which of the following programming constructs would you most likely use a
conditional statement?
A) If-else statement
B) For loop
C) Function declaration
D) Variable assignment
Correct Option: A
Rationale: Conditional statements, such as if-else statements, are used to perform
different actions based on whether a specified condition evaluates to true or false. This
is a fundamental construct in programming for decision-making.
Question 4:
Which of the following data types would be best suited for storing a person's age?
, A) String
B) Float
C) Integer
D) Boolean
Correct Option: C
Rationale: An integer data type is best suited for representing whole numbers, such as
a person's age, which does not require decimal places. Using a string or float for this
purpose would be inappropriate and inefficient.
Question 5:
What is the output of the following code snippet?
python
x = 10
y=5
print(x + y)
Run
A) 15
B) 15
C) 105
D) Error
Correct Option: B
Rationale: The code snippet adds two integers, x and y, resulting in 15. The print
function outputs the result of the addition, confirming that option B is the correct
answer.
Question 1:
What is the primary purpose of a programming language?
A) To communicate with hardware
B) To allow users to create software applications
C) To translate human commands into machine-readable code
D) To facilitate the creation of algorithms
Correct Option: D
Rationale: The primary purpose of a programming language is to facilitate the creation
of algorithms. Programming languages provide the syntax and structure necessary to
define algorithms in a way that is understandable and executable by computers.