Computer Science Paper 2
Computer Science Paper 2
er
ev
is
ion
.c
om
gc
er
ev
is
ion
.c
om
gc
er
ev
is
ion
.c
om
0795/2/2023
CSC A/L
IN COLLABORATION WITH
En collaboration avec
INSTRUCTIONS TO CANDIDATES:
All questions carry 17 marks each. For your guidance, the approximate mark for each part of a question is
indicated in brackets.
You are reminded of the necessity for good English and orderly presentation in your answers.
In calculations, you are advised to show all the steps in your working, giving your answer at each stage.
©TRU/RPI/SWATICT/CSC 795/P2/MOCK 2023. This document is the property of the TRU and the Inspectorate of Pedagogy
and should not be reproduced without the permission of the authors Page 1 of 4
1. (i) Figure 1 shows an 8-bit pattern.
1 0 1 1 0 1 1 0
Figure 1
(a) If the bit pattern in Figure 1 is a two’s complement binary integer, what is the denary equivalent of this bit pattern?
(2 marks)
(b) What is the range of denary numbers that can be represented using 8-bit two’s complement binary integers?
(2 marks)
(c) What is the hexadecimal equivalent of the bit pattern in Figure 1? (2 marks)
(d) Why are bit patterns often displayed using hexadecimal instead of binary? (1 mark)
(ii) (a) RISC processors use of a load/store architecture. Explain the implication of the load/store architecture on RISC
instruction sets. (2 marks)
(b) State two advantages of RISC processors over CISC processors. (2 marks)
(c) Consider the high-level language statement: C = A + B, that instructs the computer to add the values of two variables
A and B, and then assign the sum to a variable C.
Using the mnemonics LDR, ADD and STR which represent the operations load, add and store respectively, show how
the above statement would be evaluated in a load/store based CPU organization. (4 marks)
_________________________________________________________________________________________________
3. (i) (a) What is a scheduling policy in operating systems? (1 mark)
(b) Describe the terms throughput and turnaround time as used in scheduling, stating how each can be used as a metric
for a given scheduling policy. (4 marks)
(c) Explain what a convoy effect is and state a scheduling policy that could cause convoy effect when scheduling
processes. (3 marks)
(ii) (a) State two activities of the operating system in relation to memory management. (2 marks)
(b) Explain the difference between a virtual address and a physical address. (2 marks)
(c) Describe how virtual memory can allow a word processor and a spreadsheet to run simultaneously on a computer
even when both applications are too large to fit into the computer’s main memory. (3 marks)
(d) State two advantages of dynamic partitioning in contiguous memory allocation. (2 marks)
_____________________________________________________________________________________________
4. (i) A bank uses a computer file to store customer records. One field in the the customer record is a 4-digit
customer ID (in the range 1000 and 1999).
The file can store a maximum of 1024 records. An algorithm for inserting a new record in this file uses the following
hash function:
RecordKey= CustomerIDmod1024, where RecordKey is the record’s position in the file and mod is
the modulus arithmetic operator.
©TRU/RPI/SWATICT/CSC 795/P2/MOCK 2023. This document is the property of the TRU and the Inspectorate of Pedagogy
and should not be reproduced without the permission of the authors Page 2 of 4
(a) In database context, what is a record? (1 mark)
(b) State the type of file organization that is used to store records in this file and give two advantages of using this file
organisation. (3 marks)
(c) Determine the RecordKey values for the CustomerIDs: 1081, 1239 and 1999. (3 marks)
(a) Give an SQL DDL definition for the table tblResults. (4 marks)
(b) Explain the term referential integrity as used in databases. (2 marks)
(c) Identify one referential integrity constraint that has been included in the DDL definition in ii(a) above. (1 mark)
(d) Present exactly one row of sample data for the table tblStudents and two rows of sample data for each of the
tablestblSubjects and tblResults. (3 marks)
_____________________________________________________________________________________________
5. (i) Consider a sorting algorithm whose steps are given below.
(a) Show all the steps of the above algorithm for sorting the list [18, 15, 25, 7]. (6 marks)
(b) How many comparisons and swaps were required to sort the list in (a) above? (2 marks)
(c) Show that the runtime complexity for the total number of comparisons when the above algorithm is used to sort a list
of size n, is O(n2) or quadratic time. (3 marks)
(ii) The data byte 10011101 is to be transmitted using asynchronous serial data transmission.
(a) Explain what is meant by serial data transmission. (2 marks)
(b) Serial transmission can be synchronous or asynchronous. Explain the difference between synchronous and
asynchronous data transmission. (2 marks)
(c) A parity bit will be added to the data byte before it is transmitted. Explain the purpose of the parity bit and state the
value of the parity bit that will be added if odd parity is used. (2 marks)
E O
C G Q
Figure 2
(a) What is a complete binary tree? Is the tree above complete? (2 marks)
(b) State in what order a Node, its Left child and its Right child would be visited in each of pre-order and post-order.
Hence, determine the pre-order and post-order traversals of the tree above. (4 marks)
(c) Node L is to be deleted from the tree above. Draw the resulting binary tree when a replacement node is chosen from
the left subtree. (2 marks)
(d) Give an array representation of the binary tree in Figure 4. (3 marks)
(ii) Suppose you have three stacks S1, S2 and S3 with starting configuration shown on the left of Figure 3, where stack
S1 contains the letters A, B, C and D, and finishing configuration shown on the right, where the letters have been
moved into stack S3. Give a sequence of push and pop operations which move the letters A, B, C, and D from S1 to
S3 as shown below. For example, to pop the top element of S1 and push it onto S2, you would write
S2.push(S1.pop()) or x = S1.pop() and thenS2.push(x). (6 marks)
start finish
A A
B B
C D
D C
S1 S2 S3 S1 S2 S3
Figure 3
©TRU/RPI/SWATICT/CSC 795/P2/MOCK 2023. This document is the property of the TRU and the Inspectorate of Pedagogy
and should not be reproduced without the permission of the authors Page 4 of 4
Computer Science 2
0795
CAMEROON GENERAL CERTIFICATE OF EDUCATION BOARD
General Certificate of Education Examination
m
JUNE 2019 ADVANCED LEVEL
co
Subject Title Computer Science
Paper No./Title 2
h.
Subject Code No 0795
c
te
Two and a half Hours
Answer any SIX questions.
in
All questions carry 17 marks each. For your guidance, the appropriate mark for each part of a question is indicated in
po
brackets.
You are reminded of the necessity for good English and orderly presentation in your answers.
m
In calculations, you are advised to show all the steps in your working, giving your answer at each stage/
ea
dr
Download More Free GCE Questions and Answers at www.dreampointech.com Turn Over
1. (i) (a) Briefly explain the following giving one practical application of each: EEPROM, RAM (4 marks)
(b) With respect to computer organization, explain briefly why address mapping is important (2 marks)
(ii) (a) State what a cache memory is, and briefly describes how it works, (3 marks)
(b) Briefly justify the needs for caching in memory hierarchies (4 marks)
(iii) (a) Draw a process state diagram and explain the transitions in it. (4 marks)
(b) What causes a new process to be created? (1 marks)
(c) using appropriate computing terms explain what can cause a running process to halt. (2 marks)
m
2. (i) Suppose X is a register whose current contents:
co
1 0 0 0 0 1 1 1
h.
(a) It represents unsigned binary integer. (1 mark)
(b) It is a Binary Coded Decimal. (2 marks)
(c) It stores a two’s complement binary integer. (2 marks)
c
(ii) Convert the following octal numbers to binary numbers: (4 marks)
(a) 2148 (b) 17F616 (4 marks)
te
(iii) From the truth table below:
in
(a) Consider the corresponding logic gate. (4 marks)
(b) Deduce the Boolean expressions for sum and remainder. (4 marks)
A B Sum Remainder
po
0 0 0 0
0 1 1 0
1 0 1 0
m
1 1 0 1
(iii) A school database has two tables TEACHERS and SUBJECT, with primary keys Teacher ID and Subject Code
respectively. Study the tables below and answer the questions that follow.
TEACHER
TEACHER_ID* Teacher Name DOB Phone Subject Code
SUBJECT: table
Subject Code* Title Hours_per_Week
(a) Define the term referential integrity as used in databases. How does it affect the records in a database
Download More Free GCE Questions and Answers at www.dreampointech.com
table? Explain your answer using this database. (3 marks)
(b) Present exactly ONE row of sample data for the database entity TEACHER, and exactly TWO rows for the
entity SUBJECTS. (4 marks)
(c) The relationship “Teaches” exists between the TEACHER table and SUBJECT table. What in the cardinality of
this relationship? Explain what this cardinality means. (2 marks)
(d) Draw an entity relationship diagram that shows how these tables are related. Primary key and cardinality
should be clearly shown. (4 marks)
m
(b) Draw a resources allocation diagram with three processes (P1 P2 and P3) and three resources (R1 R2 and R3),
each having one instance, where the three processes are deadlocked. In your diagram, P1 should be holding the
resources R2 and requesting for R1. (3 marks)
co
(c) How could an operating system recover from a deadlock situation? (3 marks)
(ii) Jobs P1, P2, P3 need 6, 4 and 3 units of execution time respectively. They arrive at time units 1, 4 and 7.
h.
(a) Which job is completed last if each executes for at most 2 time units at a time? (2 marks)
(b) Draw a Gantt chart for job execution if a Round Robin scheduling algorithm is used with a time quantum
of 2 time units (4 marks)
c
(c) Calculate the average turnaround time for each of the processes (4 marks)
te
5. (i) The World Wide Web is supported by a network infrastructure
(a) What is a computer network? (1 mark)
(b) Describe the tasks carried out by: a router and a web server. (4 marks)
in
(ii) EnohMakia is won a contract to network a university campus that has story buildings spread out in a large
campus. The campus is situated in a geographical region where the is plenty of rainfall and thunder storms.
po
Besides having a campus-wide network, each story buildings has to be networked, and computers must be
locally connected if they are found within a given room (such as an office or teaching laboratory). EnohMakia
can only network the university with one or more of twisted pair, coaxial and fiber optic cables.
m
(a) State which kind of cabling is best suited for each of campus-wide, story building and room networking
justify your answer from properties associated with each network transmission medium. (6 marks)
(b) State and justify a network topology you would use to connect campus buildings. (2 marks)
ea
(iii) Briefly explain why protocols and standards are vital for the operation of the internet. (4 marks)
dr
6. (i) State what you understand by the term System Development Life Cycle. (1 mark)
(ii) A school has expanded rapidly. A system analyst is employed to plan the introduction of a computer system
which will store student records and details of student marks. For two distinct areas describe what the system
analysts should report on during feasibility study. (4 marks)
(iii) After determining the information requirements of users of an organization, briefly discuss four main phases
or activities involved in information systems development, from analyzing systems need to testing and
maintaining the system, for each phase or activity, your answer should describe its activities, the deliverables
expected, and EITHER benefits OR challenges expected. (12 marks)
(iii) (a) Many problems can be solved bottom-up, such as the assembly of equipment’s. Describe, in words only
m
a simple problem of your choice that could be solved bottom-up (3 marks)
(c) Briefly outline how your bottom-up design technique in ii(b) could be applied to solve your problem in iii(a).
(3 marks)
co
8. (i) figure 3a shows a flow chart of the algorithm in figure 3b.
c h.
te
in
po
m
ea
dr
(ii) (a) Explain informally how the bubble sort algorithm for elements of an array works. (2 marks)
Download More Free GCE Questions and Answers at www.dreampointech.com
(b) Show how bubble sort sorts the following array, by writing out its content after each pass (also called
scan) of the array.
4 15 1 16 10
m
co
c h.
te
in
po
m
ea
dr
All questions carry 17 marks each. For your guidance, the approximate mark for each part of a
question is indicated in brackets.
You are reminded of the necessity for good English and orderly presentation in your answers.
In calculations, you are advised to show all the steps in your working, giving your answer at
each stage.
___________________________________________________________________________________
X Y sum carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 1 1
ii) Using Boolean identities, Proof that XNOR gate is the complement of a X’OR gate. (3 marks)
2)
a) Briefly explain the difference between the followings
i) Computer architecture and computer organization. (2 marks)
ii) Polling and interrupt. (2 marks)
b)
i) What do you understand by the term addressing mode as used in computer architecture? (2 marks)
ii) Suppose the notation #K denotes “take value of K” and R1 R2 R3 are registers. If ADD is an opcode and (R1
R2 #R3) and (R2,#10) are operands. State for each set of operands, the addressing mode used and how it
works with the ADD opcode. (4 marks)
c) A microprocessor has RAM chip with capacity of 128 x 8.
i) How many of these memory chips are needed to provide a memory capacity of 2KB. (2 marks)
ii) And how many address lines must be used to access the memory. (2 marks)
iii) How many of these lines will be common to all chips? (1 marks)
d) Briefly explain the concept of pipelining and how it affects machine performance. (2 marks)
3)
a) In the context of process management, define throughput, response time, critical section, context switch. (4
marks)
b) Two types of processes in the operating system (OS) are I/O bound and CPU bound processes. How do they
differ? (2 marks)
c) Consider the table given below about a set of processes to be executed by the processor
4)
a) The OSI model is a conceptual model that describes how devices communicate on a network
i) List the 7 layers of the OSI model in chronological order. (3 marks)
ii) Name one device and one network protocol applicable in layer 2. (2 marks)
b) Explain ONE method that can be used to detect errors during data transmission. (2 marks)
c) Then state 2 major considerations for selecting a topology for a school network. (2 marks)
d) Consider the internet protocol address 172.16.1.45
i) Every IP address has two parts, identify the parts with respect to the IP address given above. (2 marks)
ii) State the class of the IP address given above. (1 mark)
e) Distinguish between synchronous and asynchronous communication (2 marks)
f) Briefly describe any TWO guided and ONE unguided transmission media. (3 marks)
5)
a)
i) Briefly explain is the difference between Composite and simple data structure? (2 marks)
ii) Describe briefly, the concept of binary search algorithm (2 marks)
iii) Explain the term “complexity of algorithm”. (2 marks)
i) Draw the recursive tree diagram to trace this algorithm for n = 5 (3 marks)
ii) Write an equivalent algorithm in pseudo code format using iteration and draw the flowchart. (6 marks)
6)
a) C programming language supports imperative, procedural and structured programming paradigms. Briefly
explain these paradigms with respect to C language. (3 marks)
i) Explain the object oriented programming (OOP) concepts of encapsulation and abstraction giving ONE real
life example of each. (4 marks)
b) Three common programming errors are syntax, semantic and run time errors. Give an example of a situation
where each of these errors may occur in C programming. (3 marks)
c) Define the term portability in the context of programming (1 mark)
d) Below is a subroutine that computes the factorial of a positive integer. Design suitable test data that will
rigorously test the subroutine. Make sure you give reasons for your choice of test data item(s). (6 marks)
def factorial(number)
IF number < 0:
RETURN “Factorial is not defined for negative numbers”
ELSE IF number == 0:
RETURN 1
ELSE
RETURN number * factorial(number - 1)
END FUNCTION
0795/2/C/2 © MARCH 2024 HIHS
7)
a) Briefly define the following database related terms
i) Entity, attribute, data model, data integrity. (4 marks)
ii) State and explain the type of data dependencies addressed by the second (2NF), and the third normal forms
(3NF). (4 marks)
b) Consider the database schema illustrated below
Employee(empID, empName, dptmID*)
Department(dptmID, dpmtName, Location)
i) Explain the term referential integrity using the database schema above. (3 marks)
The database is to be modified such that an employee can work in more than one department, and a department
may have several employees.
ii) State the type of relationship that exists between the employees and the departments entities? (1 mark)
iii) Briefly explain how this type of relationship could be implemented in a database. (2 marks)
iv) Write an SQL DDL query to create an associative table for this database called empDepmt including its key
fields. (3 marks)
8)
a) SDLC comprise of the well-defined standard steps to develop an information system.
i) What is an information system? (2 marks)
ii) Describe one type of information system. (2 marks)
iii) Outline the major activities involved in the design and support phases of SDLC. (4 marks)
b) Briefly explain the purpose of documentation in SDLC. Give any TWO types, stating their contents. (4 marks)
c) Consider the expression 7+ ((8 x (3^2)) + 4.
i) Draw the binary expression tree of the expression. (3 marks)
ii) Produce the postfix and prefix forms of these expressions. (2 marks)
IN COLLABORATION WITH
En collaboration avec
INSTRUCTIONS TO CANDIDATES:
All questions carry 17 marks each. For your guidance, the approximate mark for each part of a question is
indicated in brackets.
You are reminded of the necessity for good English and orderly presentation in your answers.
In calculations, you are advised to show all the steps in your working, giving your answer at each stage.
©TRU/RPI/SWATICT/CSC 795/P2/MOCK 2024. This document is the property of the TRU and the Inspectorate of Pedagogy
and should not be reproduced without the permission of the authors Page 1 of 4
1. (i) (a) Add the decimal numbers 18 and -72 using 8-bit two’s complement. (4 marks)
(b) Apply a binary shift two places to the right on the bit pattern 10101000. Convert the binary number obtained
to decimal and state the arithmetic effect of applying a right binary shift of two to a binary number. (3 marks)
(ii) A combinational logic circuit has three inputs A, B and C, and two outputs X and Y. Output X is the sum bit when
the values of A, B and C are added and output Y is the carry bit when they are added.
(a) What is meant by a combinational logic circuit? (2 marks)
(b) Draw a truth table for this circuit with inputs A, B, C, and outputs X and Y. (4 marks)
(c) Draw a logic circuit diagram for the Boolean expression Q= A•B+ (4 marks)
2. (i) (a) RAM may be either SRAM or DRAM. Describe the difference between these. (2 marks)
(b) State two advantages of solid-state drives over hard disk drives. (2 marks)
(c) A computer’s memory is composed of 8K words of 32 bits each. Determine the number of bits that are required
to address each memory location if the smallest addressable memory unit is a word. (2 marks)
(d) Draw a diagram to represent the memory hierarchy you might expect to find in a typical high performance
personal computer. (4 marks)
(ii) An instruction format uses five bits to represent 32 basic machine operations, one bit for the addressing mode and
ten bits for the operand field, as shown in Figure 1 below.
Opcode
Basic machine Addressing Operand
operation mode
0 0 0 0 1 1 0 0 1 1 1 0 1 1 0 1
Figure 1
(a) How many different opcodes is the machine potentially capable of supporting? (2 marks)
(b) What is an addressing mode? How many addressing modes can this instruction format support? (2 marks)
(c) Explain what indirect addressing is and then determine the number of memory locations that can be addressed
using the instruction format above. (2 marks)
(d) State one application of indexed addressing in computing. (1 mark)
(ii) (a) What is cache memory? How is cache memory different from virtual memory in terms of purpose? (3 marks)
(b) Explain why excessive use of virtual memory can degrade the performance of a computer. (3 marks)
(c) Explain the difference between a placement policy and a replacement policy in memory management, stating
an example of each. (4 marks)
©TRU/RPI/SWATICT/CSC 795/P2/MOCK 2024. This document is the property of the TRU and the Inspectorate of Pedagogy
and should not be reproduced without the permission of the authors Page 2 of 4
4. (i) (a) Describe each of the following database keys: primary key, foreign key, composite key and candidate key.
(4 marks)
(b) Describe each of the following database integrity constraints: referential integrity and entity integrity(2 marks)
(ii) Rainbow Retail Group (RRG) has a number of shops which buy their goods from one or more suppliers. RRG
wants to create a database that will be used to keep information about their Shops and Suppliers. The structure
they plan to use is shown in the diagram below:
M N
Shop Supplier
(a) Describe the main components of an entity-relationship diagram and give an example of each from the
description above. (5 marks)
(b) State and describe the degree of the relationship between Shop and Supplier. (2 marks)
(c) Suggest one reason why this structure would not be suitable when implementing the database. Draw a new
version of the structure to solve this problem. (4 marks)
5. (i) (a) Describe the following terms as used in object-oriented programming (OOP): object, abstraction, inheritance
and coupling. (4 marks)
(b) With the use of diagrams only and three classes A, B and C, distinguish between multiple inheritance and
multi-level inheritance. (2 marks)
(c) What is code reuse? Identify two main concepts that allow for reuse of code in OOP. (3 marks)
(ii) (a) Explain the difference between source code and object code. (2 marks)
(b) Describe two types of errors that can occur in a computer program, giving a specific example of each
(6 marks)
(ii) Consider the array below where array indices have been included above the array.
0 1 2 3 5 8 13
(a) State the comparisons that would be made when the linear search algorithm is used to search for the value 5 in
the above array. (3 marks)
(b) State the comparisons that would be made when the binary search algorithm is used to search for the value 5
in the above array. (2 marks)
(c) State two factors that may affect the performance of a searching algorithm. (2 marks)
(d) State in Big-O, the worst case time complexity for each of the searching algorithms in (ii)(a) and (ii)(b) above.
(2 marks)
©TRU/RPI/SWATICT/CSC 795/P2/MOCK 2024. This document is the property of the TRU and the Inspectorate of Pedagogy
and should not be reproduced without the permission of the authors Page 3 of 4
7. (i) (a) What is a subroutine? (2 marks)
(b) State two advantages of subroutines in programming. (2 marks)
(c) State and describe two ways by which parameters can be passed to a subprogram. (6 marks)
(ii) Study the following pseudo code algorithms labeled (a) and (b) below and answer the questions that follow.
Sub routine(m,n)
Begin
r ← 1
n = 4
if(n > m - n)then
for i ← 0 to n-1 do
n = m - n
for j ← 0 to i do
endif
print(routine(i,j)," ")
for i ← 0 to n-1 do
next j
r ← r * (m - i)
println /*go to next line*/
r = r / (i + 1)
next i
next i
End
return r
(b)
EndSub
(a)
(a) Identify two actual and two formal parameters used in the above algorithms. (2 marks)
(b) Is the subprogram routine() a function or a procedure? Justify. (2 marks)
(c) Determine the output of algorithm (b) above. (3 marks)
(ii) (a) Many fast broadband connections use fiber optic cables instead of copper cables. State two reasons why fiber
optic cable is the preferred choice. (2 marks)
(b) Draw a diagram to show how a client-server network may be set up using the following devices: two (2)
workstations, a switch, a server and a printer. (2 marks)
(c) State three advantages of networking computers. (3 marks)
(iii) Explain the difference between the following pairs of networking terms:
(a) Half-duplex and full-duplex communication (2 marks)
(b) Synchronous and asynchronous transmission. (2 marks)
THE END
©TRU/RPI/SWATICT/CSC 795/P2/MOCK 2024. This document is the property of the TRU and the Inspectorate of Pedagogy
and should not be reproduced without the permission of the authors Page 4 of 4