








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A mid-term test in computer programming, covering fundamental concepts such as operating systems, programming language generations, syntax, system software, and html. It includes questions on defining operating systems, explaining programming language generations, differentiating between syntax and syntax errors, and writing basic html structures. The test assesses understanding of computer programming principles and their practical application. Useful for students studying computer science or related fields, providing a comprehensive review of essential programming concepts. (415 characters)
Typology: Exercises
1 / 14
This page cannot be seen from the preview
Don't miss anything!









INSTRUCTIONS DATE: 02/06/ ANSWER ALL QUESTIONS IN SECTION A ANSWER ALL QUESTIONS IN SECTION B _____________________________________________________________________________________
SECTION A QUESTION ONE
Define the operating system and outline four functions of it. (8 marks)
QUESTION TWO
Briefly explain the four generation of programming languages. (8 marks)
QUESTION THREE
a) What is the difference between syntax and syntax error? (4 marks) b) What is the difference between system software and application? (4 marks)
QUESTION FOUR
What is HTML? Write a basic structure of it. (8 marks)
QUESTION FIVE
Write the HTML tags that will produce the above output. (8 marks)
SECTION B
QUESTION 1 a) What is computer programming? (5 marks)
b) Outline five reasons why C programming is used in the development of systems. (10 marks)
c) Mention five system types developed by C programming. (5 marks)
Question 2
a) Define the following terms:
I. Algorithm II. Pseudo code III. Source code IV. Flowcharts (12 marks)
b) What is the difference between the complier and a debugger? (8 marks)
Question 3
a) List Five software development languages and Five web development languages. (10 marks)
b) What is the difference between machine language and four generation languages? Support your answer with examples. (10 marks)
Question 4
a) What is the difference between low level and high level programming language? (5 marks)
b) Write and explain the simple basic structure of programming. (15 marks)
Question 5
a) Define the term data type in programming. (5 marks)
b) List the three classes of the data type. (3 marks)
c) Write the algorithm of the following problems:
I. Find the area of a circle of radius r. II. Write an algorithm to read two numbers and find their sum. III. Find the greater number between two numbers. (12 marks)
ALL THE BEST (NDHLOVU)
The first generation programming language is also called low-level programming language because they were used to program the computer system at a very low level of abstraction, that is at the machine level. The machine language also referred to as the native language of the computer system is the first generation programming language. In the machine language, a programmer only deals with a binary number.
The second generation programming language also belongs to the category of low- level-programming language. The second generation language comprises of assembly languages that use the concept of mnemonics for the writing program. In the assembly language, symbolic names are used to represent the opcode and the operand part of the instruction.
The third generation programming languages were designed to overcome the various limitations of the first and second generation programming languages. The languages of the third and later generation are considered as a high-level language because they enable the programmer to concentrate only on the logic of the programs without considering the internal architecture of the computer system. Examples: FORTRAN, ALGOL, COBOL, C++, C
The languages of this generation were considered as very high-level programming languages required a lot of time and effort that affected the productivity of a programmer. The fourth generation programming languages were designed and developed to reduce the time, cost and effort needed to develop different types of software applications. Examples: SOL, CSS, coldfusion
The programming languages of this generation mainly focus on constraint programming. The major fields in which the fifth generation programming language are employed are Artificial Intelligence and Artificial Neural Networks. Examples: Mercury, Prolog, OPS5.
QUESTION 3:
(a) What is the difference between syntax and syntax error? (4 marks)
Syntax is the grammar for a language or the rules to decide if a statement is in the language but not the meaning. Syntax Error is creating an illegal program in the language by making an error such as a typo, insertion, deletion, or misuse of an element of the language. An example would be leaving off a trailing semicolon in Processing or misspelling a keyword.
(b) What is the difference between system software and application? (4 marks)
A System Software is a set of information that includes at least one program and optionally many programs and data files. The set of information is generally related and used with a specific goal in mind such as image processing software. It controls and coordinates the operations of the computer and its devices. An Application on the other hand is a runnable program that provides some specific service or purpose. It is developed to make the user more effective and efficient in his or her everyday work.
QUESTION 4: What is HTML? Write a basic structure of it. (8 marks)
HTML is a language used to write Internet based documents that can refer to each other. It is a building block of web pages. HTML stands for Hypertext Markup Language, which is a widely used language to write Web Pages. Hypertext refers to the way in which Web pages (HTML documents) are linked together. Thus, the link available on a webpage is called Hypertext. HTML is a Markup Language which means you use HTML to simply "mark-up" a text document with tags that tell a Web browser such as Firefox, Chrome, Opera, Microsoft Edge etc. how to structure it to display.
The basic structure of an HTML consists of 5 elements:
<!DOCTYPE html> <html> (Opening tag) <head>
(Heading)
(Document content)(Closing tag)
c) Mention five system types developed by C programming. (5 marks)
1. Operating Systems
The first operating system to be developed using a high-level programming language was UNIX, which was designed in the C programming language. Later on, Microsoft Windows and various Android applications were scripted in C.
2. Embedded Systems
The C programming language is considered an optimum choice when it comes to scripting applications and drivers of embedded systems, as it is closely related to machine hardware.
3. GUI
GUI stands for Graphical User Interface. Adobe Photoshop, one of the most popularly used photo editors since olden times, was created with the help of C. Later on, Adobe Premiere and Illustrator were also created using C.
5. Google
Google file system and Google chromium browser were developed using C/C++. Not only this, the Google Open Source community has a large number of projects being handled using C/C++.
6. Mozilla Firefox and Thunderbird
Since Mozilla Firefox and Thunderbird were open-source email client projects, they were written in C/C++.
7. MySQL
MySQL, again being an open-source project, used in Database Management Systems was written in C/C++.
8. Compiler Design
One of the most popular uses of the C language was the creation of compilers. Compilers for several other programming languages were designed keeping in mind the association of C with low-level languages, making it easier to be comprehensible by the machine. Several popular compilers were designed using C such as Bloodshed Dev-C, Clang C, MINGW, and Apple C.
9. Gaming and Animation
Since the C programming language is relatively faster than Java or Python, as it is compiler-based, it finds several applications in the gaming sector. Some of the most simple games are coded in C such as Tic-Tac-Toe, The Dino game, The Snake game and many more. Increasing advanced versions of graphics and functions, Doom3 a first- person horror shooter game was designed by id Software for Microsoft Windows using C in 2004.
the algorithms. So a flowchart is simply a graphical representation of steps. It shows steps in sequential order and is widely used in presenting the flow of algorithms, workflow or processes. (12 marks)
b) What is the difference between the complier and a debugger? (8 marks)
The main difference between a compiler and a debugger is that a compiler converts the source code to equivalent machine code to execute the tasks defined in the program while a debugger helps to recognize the errors of a program and to fix them. Generally, a computer program is a set of instructions that instructs the CPU to perform a certain task. Compiler and debugger are two software programs that allow building and executing error-free computer programs.
a) List Five software development languages and Five web development languages. ( marks)
( Software development languages: C, Java, Lisp, MATLAB, Perl, Python, Ruby, SQL)
( Web development languages: C++, C#, Java, JavaScript, Perl, PHP, Python, Ruby)
b) What is the difference between machine language and four generation languages? Support your answer with examples. (10 marks)
Machine language, or machine code, is a low-level language comprised of binary digits (ones and zeros). High-level languages, such as Swift and C++ must be compiled into machine language before the code is run on a computer. In the days when computers were being developed there was just one language—machine language.
The concept of language generations, sometimes called levels, is closely connected to the advances in technology that brought about computer generations. The four generations of languages are machine language, assembly language, high-level language, and very high-level language. Four Generation Languages (4GLs) are still evolving, which makes it difficult to define or standardize them. A common perception of 4GLs is that they do not make efficient use of machine resources.
QUESTION 4
a) What is the difference between low level and high level programming language? ( marks)
Both High level language and low level language are the programming languages types. The main difference between high level language and low level language is that, programmers can easily understand or interpret or compile the high level language in comparison of machine. On the other hand, the machine can easily understand the low level language in comparison of human beings. Examples of high level languages are C, C++, Java, Python, etc.
Differences between high level and low level languages:
S.NO HIGH LEVEL LANGUAGE LOW LEVEL LANGUAGE
public static void main(String[] argv)
a) Define the term data type in programming. (5 marks)
A data type, in programming, is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error. A string, for example, is a data type that is used to classify text and an integer is a data type used to classify whole numbers.
b) List the three classes of the data types. (3 marks)
C and Java Data Types: Character, Number, Small Number, Long Number, Decimal Number.
Python Data Types: Numbers, String, List, Tuple, Dictionary.
c) Write the algorithm of the following problems: (12 marks)
I. Find the area of a circle of radius r.
Inputs to the algorithm: Radius r of the Circle. Expected output: Area of the Circle Algorithm: Step1: Start Step2: Read\input the Radius r of the Circle
Step3: Area PIrr // calculation of area Step4: Print Area Step5: End II. Write an algorithm to read two numbers and find their sum.
Inputs to the algorithm: First num1. Second num2. Expected output: Sum of the two numbers. Algorithm: Step1: Start Step2: Read\input the first num1. Step3: Read\input the second num2. Step4: Sum num1+num2 // calculation of sum Step5: Print Sum Step6: End
III. Find the greater number between two numbers.
Inputs to the algorithm: First A. Second B. Expected output: The greater number Algorithm: Step1: Start Step2: Read/Input A and B Step3: If A greater than B then C=A Step4: If B greater than A then C=B Step5: Print C Step6: End