admin@kcseforecast.com

+2541026301456

Q&A-KCSE Computer Studies Paper 1

Briefly describe three types of database models

  • Hierarchical model  - Records in the database can be related to one parent only but can have more children records
  • Network database model - a child record can be linked to  multiple parent records
  • Relational database model - organizes data into tables that can be linked or related based on data common to each.

Explain the purpose of each of the following features of a spreadsheet chart (KCSE 2021 Computer Studies, Q19 (a))

Legend

  • Legends are a small visual representation of the chart's data series to understand each without confusion.

A data series

  • is a row or column of numbers that are entered in a worksheet and plotted in your chart, such as a list of quarterly business profits
  • A group of related data points or markers that are plotted in charts and graphs

Data Marker

 

 

Explain the purpose of each of the following features of a spreadsheet chart (KCSE 2021, Q19 (a))

Legend

  • Legends are a small visual representation of the chart's data series to understand each without confusion.

A data series

  • is a row or column of numbers that are entered in a worksheet and plotted in your chart, such as a list of quarterly business profits
  • A group of related data points or markers that are plotted in charts and graphs

Data Marker

  • A symbol on the chart that represents a single value in the worksheet.
  • A column, dot, pie slice, or another symbol in the chart representing a data value

https://www.lifewire.com/data-series-data-points-data-labels-3123411

Explain the term proofreading as used in word processing (2mks) [kcse 2017 Paper 1]

  • It is the use of proofing tools like spelling and grammar checkers and autocorrects to check whether a document has typographical or grammatical errors

Describe the purpose of the
(i) control unit
(ii) memory unit
(iii) arithmetic logic unit

in a computer.

i) To manage the execution of instructions
By running a clock
To decode instructions
(ii) To store OS
To store those parts of applications programs currently running
To store data currently in use
(iii) Part of the processor where data is processed/manipulated
All I/O must pass through here

Give a reason why HMTL is not regarded as a programming language

  •  It does not have declaration part
  • It does not  have control structures

Differentiate between object code and source code

  • Object code refers to a program in machine language while source code to a program in a high level language that must be translated to object code for it to be machine readable

Define programming

The process of developing computer programs to solve a particular problem

State and briefly describe three program control structures

Sequence:Sequential execution of a program one line after another

Selection: Involve the a decision between two or more options e.g  if...then...else

Loops/Repetitions:use for looping i.e a line of code can be made to execute a given number times before terminating.

A school has 3000 students sitting final examinations.

Each student sits eight examinations.

Write an algorithm, using pseudocode or a flowchart, which:

inputs the marks for all 8 examinations for each student

outputs for each student the average mark for their 8 examinations

outputs the highest mark overall

highest = -1
for student = 1 to 3000
total = 0
for exam = 1 to 8
input mark
total = total + mark
if mark > highest then highest = mark
next
average = total/8
output average
next
output highest

Python code:

highest = -1
for student in range(1, 3001):
    total = 0
    for exam in range(1, 9):
        mark = int(input("Enter mark: "))
        total += mark
        if mark > highest:
            highest = mark
    average = total / 8
    print("Average:", average)
print("Highest mark:", highest)

VBA Code

Option Explicit

Sub CalculateAverageAndHighest()
    Dim highest As Integer
    Dim total As Integer
    Dim mark As Integer
    Dim average As Double
    
    highest = -1
    
    For student = 1 To 3000
        total = 0
        For exam = 1 To 8
            mark = InputBox("Enter mark:")
            total = total + mark
            If mark > highest Then
                highest = mark
            End If
        Next exam
        average = total / 8
        MsgBox "Average: " & average
    Next student
    
    MsgBox "Highest mark: " & highest
End Sub

 

Explain why a developer, who is good at both low-level and high-level programming, would normally use high-level languages when writing programs                                                                                    [4 marks]

  • High-level languages have built-in functions;
  • High-level languages have built-in libraries;
  •  High-level languages have more support/help;
  • High-level languages have structures (such as selection and iteration);
  • High-level languages can be less machine-dependent/more portable;
  • It (usually) requires fewer lines of code to be written;
  • It is (usually) quicker to develop code in high-level languages;
  • It is easier to find mistakes in code;
  • The code is easier to maintain//understand;
  • • It is easier to structure code in high-level languages;

Compare the use of a compiler with the use of an interpreter to translate code

Both translate source code written in high level programming languages into machine code.
Compiler: Produces a single executable file that is portable between machines
Interpreter: Source code needs a special environment to run
Compiler: Needs to be compiled for a particular architecture
Interpreter: Can run on any architecture that has the translator/interpreter
Complier: Entire source code file is translated at once
Interpreter: Code is translated line by line
Compiler: Provides error report at the end of the compilation
Interpreter: Errors more obvious in the sequence
Compiler: The program source code is not available (so helps protect IP)
Interpreter: Source code is available
Compiler: Only has to be translated once (affecting the speed of execution)
Interpreter: Has to be translated each time, therefore (affecting the speed of execution)
Compiler: Requires two files to be maintained (one for execution and for editing purposes)
Interpreter: Requires only one file to be maintained
 

What is a source code as used in computer programming?

  • It is a program written in a high level langauage

Explain why a developer, who is good at both low-level and high-level programming, would normally use high-level languages when writing programs.

  • High-level languages have built-in functions;
  • High-level languages have built-in libraries;
  • High-level languages have more support/help;
  • High-level languages have structures (such as selection and iteration);
  • High-level languages can be less machine-dependent/more portable;
  • It (usually) requires fewer lines of code to be written;
  • It is (usually) quicker to develop code in high-level languages;
  • It is easier to find mistakes in code;
  • The code is easier to maintain//understand;
  • It is easier to structure code in high-level languages;

Describe each of the following types of program errors, using an example.

Syntax error

Logical error

Run-time error

Syntax error

  • An error in the source code of a program like pront("Hello, " + name) instead of print
  • These are errors that emanate from improper use of language rules such as spelling mistakes,improper use of variables and misuse of reserved words

Logical error

  • A mistake in a program's source code that results in incorrect or unexpected behaviour like if age == 65: print("Eligible for a discount.") instead of using if age >= 65: print("Eligible for a discount.")
  • These are errors that occur due to imperfect comparisons

Run-time error

  • An error which occurs when a program is asked to do something that it cannot, resulting in a ' crash'9. For example, asking a number to be divided by 0 such as 72/0.
  • An error that results in a sudden halt of an executing program

 

Describe and give an example of one syntax and one logical programming error.

Syntax
An error that occurs when a command does not follow the expected syntax of the language, e.g. when a keyword is incorrectly spelt
Incorrect: IF A ADN B Then
Correct: IF A AND B Then

Logical
An error that causes a program to output an incorrect answer (that does not necessarily crash the program)
An algorithm that calculates a person’s age from their date of birth, but ends up giving negative numbers