0% found this document useful (0 votes)
146 views29 pages

INF1 Past Paper

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views29 pages

INF1 Past Paper

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

The University of Cape Town

Department of Information Systems

Foundations of Information Systems

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

Excel Part 1 (10 marks)

(1 mark for each correct answer)

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:

7. What does the PMT function in Excel primarily calculate?


A. The total number of payments required to pay off a loan or investment.
B. The monthly payment amount needed to repay a loan or investment.
C. The current market price of a financial asset.
D. The interest rate applied to a loan or investment.
Answer B:
8. What is the primary difference between absolute and relative references in spreadsheet
applications like Microsoft Excel?
A. Absolute references always refer to fixed cell addresses, while relative
references adjust to the position of the formula when copied.
B. Absolute references allow you to use cell names instead of cell addresses,
while relative references require cell addresses.
C. Absolute references are used for mathematical calculations, while relative
references are used for text-based operations.
D. Absolute references are only used in advanced spreadsheet functions, while
relative references are basic references for cell values.
Answer A:

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

Excel Part 2 (20 marks)

(2 marks for each correct answer)

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 :

A. The “function” used is incorrect, instead use AVERAGE.


B. The “range” specified is incorrect, hence a wrong average amount is generated.
C. The “average range” is incorrect; hence a wrong average amount is
generated.
D. The “criteria specified is not required. The formula will still generate the correct
average amount.
Answer : C

5. What Product ID has the highest total sales amount in Rands?


A. 490017
B. 490021
C. 490027
D. 490020
Answer C:

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

10. Identify the customer with the least product count.


A. Royal Supermarket
B. Aldie Foods
C. MayoMart
D. Boxer Supermarket

Answer A

8
Section C

Python Programming Part 1 (30 marks)

(1 mark for each correct answer)

1. Which of the following expression evaluates to 33?


A. 100 % 3
B. 100 // 3
C. 100 * 3
D. 100 / 3
Answer B

2. The Python interpreter treats all numbers the same, regardless of numerical value.
A. True
B. False
Answer : B

3. The _____________ is used in Python to define a function?


A. def
B. func
C. function
D. sub
Answer : A

4. The code contained inside a function is called a ___________


A. function method
B. function definition
C. function call
D. function block
Answer : D

5. Which of the following operators is used in Python to compare values equal to each
other?

A. >

B. ==

9
C. =

D. !=
Answer : B

6. What is the output of the following code?

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. Opening the file will return a NameERROR


B. Opening the file will return a FileNotFoundError
C. Opening the file will return a FilePermissionError
D. Opening the file will fail and return IError
Answer: B

8. Which of the following represents a comment in Python?

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

14. Which of the following best defines a chained conditional statement?


A. statement that consists of a header and a body. The header ends with a colon (:).
B. a conditional statement with a series of alternative decisions.
C. a statement that controls the flow of execution limited to one condition.
D. statement is another term for functions used for conditional execution.
Answer : B

15. A _______ is an example of an input device


a. Keyboard
b. Speakers
c. Printer
d. Headphones
ANSWER: A

16. A ________ is an example of an output device


a. Keyboard
b. Mouse
c. Printer
d. Microphone
ANSWER: C
17.Choose the correct statement
a. Comments in Python help to speed up program execution
b. Comments in Python are used to reduce the impact of loadshedding
c. Comments are used to minimise syntax errors
d. Comments are used to document sequence of code
ANSWER: D

18.Which of the following is a valid variable assignment?


a. for = 5
b. if = 7

12
c. try = 3
d. abc = 2
ANSWER: D

19.What is the conventional file extension for Python scripts?


a. .doc
b. .zip
c. .pdf
d. .py
ANSWER: D

20.Which of the following is NOT a valid variable name?


a. 2023_var
b. _var
c. Var23023
d. NAME
ANSWER: A

21._____ is the Python division operator


a. /
b. %
c. **
d. ÷
ANSWER: A

22.What is the following “%” operator used for?


a. Raising a number to a power
b. Calculating the sum of numbers
c. Calculating the remainder

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

26.Select the correct statement about Python programming.


a. Python is case-insensitive
b. We can convert an integer to a string
c. A float cannot be converted to an integer
d. An integer cannot be converted to a float
ANSWER: B
27.Which of the following is NOT a valid Boolean operator?
a. and

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

Python Programming Part 2 (40 marks)

(2 marks for each correct answer)

1. Analyse the program given below

Which input would produce the output, Hard luck ?

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?

NameError: name ‘ time’ is not defined .

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

3. What output does the following program produce?

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

4. What output will be printed by the following code?

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
=

numbers(10, 20, 15, 25)


print(result)
B. print(result(10, 20, 15, 25))
C. numbers = result(10, 20, 15, 25)

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?

A. Indentation error in Line 7,


1
2
4

B. Indentation error in Line 2,


0
2
4

C. Indentation error in Line 3,


0
2
4

D. Indentation error in Line 8,


1
2
4
ANSWER: A

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.

D. None of the above

ANSWER: A

22
8. Evaluate the following code and debug. Which lines of code consist of errors?

A. Line [14]; Line [15]; Line [24]


B. Line [8]; Line[20]; Line [24]
C. Line [2]; Line[14]; Line [15]
D. Line [8]; Line [13]; Line [14]

Answer : A

9. Evaluate the following code snippet, what will be the output?

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

11. What is the output of the following program?


print (“12” + “12”)
A. 24
B. 12
C. 1212
D. No output because of a syntax error
ANSWER: C

12.What is the output of the following program?


print(5//2)
A. 2

25
B. 2.5
C. 1
D. No output because of a syntax error
ANSWER: A

13.What is the output of the following program?


print("Hello \\")
a. Hello \
b. Hello \\
c. Hello
d. Hello “
ANSWER: A

14.What is the output of the following program?

a. 4, 5
b. 5, 4
c. 20
d. 4 4
ANSWER: D

15.What is the output of the following program?


print(2 + 6 - 4 / 2 **2)

a. 7.0
b. 4
c. 1
d. 0
ANSWER: A

16.What is the output of the program given below?

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?

a. function3 and function4


b. function1 and function2
c. function1
d. function2
ANSWER: A

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

You might also like