INF1 Past Paper
INF1 Past Paper
02 November 2023
100 Marks
Duration (3 Hours)
1
Exam Instructions
Read the assessment instructions carefully before you start.
1. The time allocated for this exam is 3 hours (180 minutes), which includes reading
time.
2. The exam is out of 100 marks.
3. The exam consists of four 4 sections:
a. Section A: Excel Part 1 (10 marks)
b. Section B: Excel Part 2 (20 marks)
c. Section C: Python Part 1 (30 marks, 30 MCQs)
d. Section D: Python Part 2 (40 marks, 20 MCQs)
4. You are allowed to use MS Excel, Visual Studio to test your code and answers.
5. For Sections A and B: Excel, Answer the questions based on the ExamData.xlsx file.
The file is available on the Exam storage.
6. Read each question, answer carefully, and select ONE best answer.
7. Try to answer all questions. You will not be penalised for guessing as this exam has
no negative marking.
Note:
Upon finishing, hand in your Exam paper. No question papers are allowed to be taken out of
the examination venue.
2
Section A
1. Which of the following lookup function (s) is the most appropriate for returning values
in a long vertical list?
A. MATCH only
B. VLOOKUP
C. HLOOKUP and XLOOKUP
D. VLOOKUP and XLOOKUP
Answer : D
2. Your worksheet consists of TEXT in cell E2 and F2. What does this formula do?
A. Joins the string in cell E2, a space character, and the string in cell F2.
B. Joins the string in cell E2, a string with a comma and a space character, and the
value in cell F2.
C. Joins the string in cell E2 and F2 separated by “” quotes.
D. Shows E2; “”; F2 on the excel worksheet
Answer : A
3. What is the LEN function used for in Excel?
A. Find the position of a specified value in a range of cells
B. Replace a specified number of characters in a text string with new text
C. Find out the number of characters in a text string
D. Extract a specific number of characters from a text string
Answer : C
4. The NPER function returns the number of periods for an investment based on periodic,
constant payments and a constant interest rate. Which of the following is the correct
syntax for NPER in Excel?
A. =NPER(pmt, rate, pv, [fv], [type])
B. =NPER(rate, [fv], pmt, pv, [type])
C. =NPER(rate,pmt,pv,[fv],[type])
D. =NPER(pv, pmt, rate, [fv], [type])
Answer : C
5. Which of the following actions can you perform using a pivot table in Excel?
A. Edit the original dataset
B. Perform word processing tasks
C. Create macros to automate tasks
D. Summarize and filter data for analysis
Answer D:
3
6. Which of the following accurately describes the main difference between the COUNTIF
and SUMIF functions in Excel?
A. COUNTIF is used for text data, while SUMIF is used for numeric data.
B. COUNTIF is a mathematical function, while SUMIF is a logical function.
C. COUNTIF counts the number of cells that meet a specified condition, while
SUMIF calculates the sum of values in cells that meet a specified condition.
D. COUNTIF and SUMIF perform the same function and can be used
interchangeably.
Answer C:
9. Which of the following statements accurately differentiates between pivot tables and
slicers in Microsoft Excel?
A. Pivot tables are used for data visualization, while slicers are used for data
analysis.
B. Pivot tables allow you to summarize and analyze data, while slicers
provide a way to filter and interact with pivot tables or data tables.
C. Pivot tables are a type of chart, while slicers are a type of formatting tool.
D. Pivot tables are exclusively used for sorting data, while slicers are used for
mathematical calculations.
Answer B:
10. You are tracking the cost of products sold per province. You have a table consisting of
sales data (A2:G17), which includes the branch, province and year. If you would like to
copy this table to another worksheet, What is the best way to make rows into columns?
A. Copy the Province column, highlight the column header, use Paste Special, and then
select Values.
B. Copy the table data by highlighting the table content, use Paste Special, and
then select Values and Transpose.
C. Copy row 1, highlight the column header, use Paste Special, and then select Values
and Transpose.
D. Copy row 1, highlight the column header, use Paste Special, and then select Values.
4
Answer : B
5
Section B
For this section you are encouraged to use either function or filters of pivot tables to find
solutions to the following questions.
1. Use a function to populate Total Sales Amounts in Column J and identify the least total
sales for all products.
A. R769
B. R5600
C. R3300
D. R4000
Answer C
2. On the “RiteMart Sales” worksheet, the manager for E&I Mart in Paarl needs to decide
whether the store should operate on a public holiday. The manager wants to compare
the operational costs including overtime wages he needs to pay his employees. The
operational costs are R 85 000 daily. Assuming the 28 April 2023 is a public holiday,
what total amount was generated by the store?
A. R81 420,00
B. R85 432,00
C. R352 348,00
D. R237 416,00
Answer: A
3. On the “RiteMart Sales” worksheet in Column L, you are required to compute the
discount for Sales ID 693, based on the following criteria:
If the total sales amount in cell J13 is between 500,000 and 600,000 (inclusive), a
5% discount is applied.
If the total sales amount is between 600,001 and 780,000 (inclusive), a 6%
discount is applied.
If the total sales amount is greater than 780,000, a 10% discount is applied.
If none of the conditions are met, no discount (0%) is applied.
Which of the following is the correct formula to return the discount amount for this Sales
ID (693) ?
6
A. =IF(AND(J13>=500000;J13<=600000);0,05;
IF(AND(J13>600000;J13<=780000); 0,06;IF(J13>780000; 0,1; 0)))
B. =IF((J13>=500000;J13<=600000);0,05*J13; IF((J13>600000;J13<=780000);
0,06*J13;IF(J13>780000; 0,1*J13; 0)))
C. =IF(J13>=500000;J13<=600000);0,05*J13; IF(J13>600000;J13<=780000);
0,06*J13;IF(J13>780000; 0,1*J13; 0))
D. =IF(AND(J13>=500000;J13<=600000);0,05*J13;
IF(AND(J13>600000;J13<=780000); 0,06*J13;IF(J13>780000; 0,1*J13; 0)))
Answer : D
4. On the “RiteMart Sales” worksheet, If you are to calculate (Cell J809) the average sales
generated from the BENONI branch. The following formula consists of an error. Evaluate
the formula below and indicate the cause of the error :
6. This formula will help you populate the accurate Provinces in Column E from the
“Branch per Province” sheet.
A. =VLOOKUP(D4;Table1;2;FALSE)
B. =VLOOKUP(D3;Table1;1;0)
C. =VLOOKUP(D3;Table 2;2;1)
D. =VLOOKUP(D3;Table1;2;FALSE)
Answer D:
7. Using Pivot Tables, find the difference in revenue for the Mpumalanga between 2020 and
2021.
A. R368 160.00
B. -R368 160.00
C. R1 555 911.00
7
D. -R28 054 673.00
Answer: B
8. Which is the correct formula to use in column L, starting in cell L3, to calculate how
many times Product ID 490017 had a sale of less than 50 units.
A. =IF(OR(H3<50;K3=490017);1;0)
B. =IF(H3<50 AND K3=490017);1;0)
C. =IF(AND(H3>50;K3=490017);1;0)
D. =IF(AND(H3<50;K3=490017);1;0)
Answer D
9. What is the Total Sales Amount for Benoni from 2019 to 2023?
A. R4 288 888.00
B. R36 362 856.00
C. R13 339 570.00
D. R3 606 943.00
Answer C
Answer A
8
Section C
2. The Python interpreter treats all numbers the same, regardless of numerical value.
A. True
B. False
Answer : B
5. Which of the following operators is used in Python to compare values equal to each
other?
A. >
B. ==
9
C. =
D. !=
Answer : B
A. Exception
B. ArithmeticError
C. DivisionByZero
D. Return 0
Answer : B
7. What type of error is returned by the Python interpreter when the file does not exist?
A. // Comments
B. # Comments
C. */ Comments
D. % Comments
Answer : B
10
9. Which one of the following is an example of a syntax error?
A. Forgetting a colon at the end of a line in Python code
B. Incorrectly ordering statements in a program
C. Misspelling a keyword in Python code
D. Providing instructions that lead to a different outcome than intended
Answer : C
10. A (an) reads the source code of the Python program as written by
the programmer.
A. interpreter
B. compiler
C. variable
D. function
Answer : A
11. The following are valid variable names in Python, except which one?
A. 1variable
B. Var
C. Num
D. Variable_1
Answer: A
12. A(n) _______ error is when your program has good syntax but there is a mistake in
the order of the statements or perhaps a mistake in how the statements relate to one
another.
A. runtime
B. logic
C. semantic
D. syntax
Answer : B
13. A floating point is a datatype that represents numbers with fractional parts.
A. True
B. False
11
Answer : A
12
c. try = 3
d. abc = 2
ANSWER: D
13
d. Calculating the product
ANSWER: C
23.When we string operators together - Python must know which one to do first. This is
called _____
a. Scripting
b. Interpretation
c. Operator precedence
d. Slicing
ANSWER: C
24.Consider the following assignment: name = 1234
What data type is name?
a. int
b. float
c. string
d. noneType
ANSWER: A
25.Consider the following assignment: name = “1.5432”
What data type is name?
a. int
b. float
c. string
d. bool
ANSWER: C
14
b. or
c. not
d. hence
ANSWER: D
28. Select the correct statement concerning the Python code given below:
Var = eval(X)
a. X is an example of a function name
b. X is an example of a function parameter
c. X is an example of a function argument
d. X a conversion function
ANSWER: C
29.When building our own functions, the ___________ keyword is used to return a value
from the function
a. return
b. void
c. greet()
d. print()
ANSWER: A
30.Which of the following statements gives the best motivation for creating functions?
a. Functions help to break up long and complex code into logical chunks
b. Functions help to minimise repetition of code. A function is created once and
can then be re-used.
c. A and B
d. None of the above
ANSWER: C
15
Section D
A. 0
B. 15
C. 5
D. 4
Answer D
E.
16
2. When you run this code you will encounter an error message. What is the meaning of this
error message?
17
A. This is semantic error, the import time statement must be added in line 2 to fix the
error
B. This is syntax error, the while loop is not correctly indented.
C. This is a semantic error, the import datetime statement is used out of its scope
D. This is a runtime error, the import time statement must be added in line 2 to
fix the error
Answer: D
A. Excel
Python
Excel
Web Python
Excel
Python
B. Web Python
Python
Excel
C. Excel
Python
Web Python
D. Python
Excel
Web Python
Excel
Python
Excel
Answer : A
18
a. 18, 23
b. 23, 18
c. 3, 23
d. 23, 3
Answer : C
5. Which of the following statements can be used to invoke the function in the code below?
A. result
=
19
D. print(numbers)
Answer : A
20
6. The following code consists of an error. What is the error generated by the code and if
corrected what will be the output?
21
7. You have assigned the value 20 to a variable number. Which of the following is the
incorrect code statement to check if this value is equal to 20 and if this condition is true,
replace the value with 25.
A.
B.
C.
ANSWER: A
22
8. Evaluate the following code and debug. Which lines of code consist of errors?
Answer : A
A. The code splits the original string printing the output to Py cool
B. The code determines the length of the original string, printing 14 as an output
C. The concatenates the original string into two slices, printing a combination of
Pyiscool.
23
D. The code uses string slicing to extract a portion of the original string. Printing
output Py is cool.
Answer : D
10.What is the Syntax error(s) in the code snippet below? The code is designed to print the
list of names in ascending order.
24
A. Python is case sensitive, the list is defined as Names but the output use names.
The sort function is missing parenthesis.
B. Python is case sensitive, the list is defined as Names but the output use names. A
wrong function name is used, instead use order ( ) function.
C. A list should use curly braces {} and not square brackets [] to create a list. The sort
function is missing parenthesis.
D. A list should use curly braces {} and not square brackets [] to create a list. A wrong
function name is used, instead use order function.
Answer : A
25
B. 2.5
C. 1
D. No output because of a syntax error
ANSWER: A
a. 4, 5
b. 5, 4
c. 20
d. 4 4
ANSWER: D
a. 7.0
b. 4
c. 1
d. 0
ANSWER: A
26
a. Z
b. Y
c. X
d. No output
ANSWER: D
17.Consider the program given below. Suppose the user enters “Richard”, what will be the
output?
a. 0
b. Great stuff
c. Good stuff
d. TypeError
ANSWER: B
18.You have been tasked to create a function that accepts two numbers and return the sum
of the two numbers. Which of the functions shown below accomplishes that task?
27
a. function1
b. function2
c. function3
d. function4
ANSWER: B
19.Technically speaking, which of the function(s) given below is/are void functions?
28
20.BMI calculation divides an adult’s weight in kilograms by their height in metres squared.
For example, if the weight is 100 and the height is 2: squaring the height: 2 x2 =4; Diving
100 by 4 =25.
A colleague is trying to write a program that calculate a person’s body mass index (BMI),
but is not getting the desired result. Can you spot where the bug is?
a. Line 1
b. Line 2
c. Line 3
d. Line 4
e. There is no bug, the issue must be with the user input
ANSWER: C
29