0% found this document useful (0 votes)
10 views

ICT316 Intr - To - Programming - Some Tutorials Quest - Solution2

Introduction to Programming Tutorials

Uploaded by

Eugene Mbah Tebo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

ICT316 Intr - To - Programming - Some Tutorials Quest - Solution2

Introduction to Programming Tutorials

Uploaded by

Eugene Mbah Tebo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ICT316: Introduction to Programming Some Tutorials Questions and Solutions

Something like this will come in the exams so read the notes, understand them and relate them
to the questions below and pay special attention to the solutions

1. Define the following terms as used in Programming

i) Compiler: The software that reads a program written in high level language and
translates it into an equivalent program in machine language. is called as.

ii) Source Program


The program written by the programmer in high level language

iii) Interpreter:.
convert high level language into binary instructions,
the interpreter takes 1 statement, translates it, executes it & then again takes the next
statement.

iv) Assembler:
The software that reads a program written in assembly language and translates it into an
equivalent program in machine language

v) Linker:
a computer program that takes one or more object files generated by a compiler and
combines them into a single executable file, library file, or another object file.

2) List and explain the three categories of programming language

Machine Level language


is in the form of (1‘s and 0‘s) binary code and requires memorizing or looking up
numerical codes for every instruction that is used.

Assembly language
Assembly language is the mnemonic language written in some specific symbolic codes,
such as ADD, SUB etc. An assembly language program is first translated into machine
language instruction by system program called assembler, before it can be executed.

Procedural language (High Level Language)


A High-level language is a simple English like language. A High-level program also
needs to be transferred into machine language instructions before it can be executed
because computer understands only machine level language.

3) Discuss the 5 attribute of a good programming language

Clarity, Simplicity and Unity:


A Programming language provides both a conceptual framework for Algorithm
planning and means of expressing them.
It should provide a clear, simple and unified set of concepts that can be used as
primitives in developing algorithms. It should be simple and regular as well as have

CopyRight@Eugene Tebo February 2024 1


ICT316: Introduction to Programming Some Tutorials Questions and Solutions

minimum number of different concepts, and rules for their combination. This attribute is
called conceptual integrity.
Orthogonality:
Orthogonality is one of the most important features of PL. It is the property that says "
Changing A does not change B". In real world, radio is an example of an orthogonal
system. For instance, changing a station in a radio does not change the volume and
vice versa. When the features of a language are orthogonal, language is easier to learn
and programs are easier to write because only few exceptions and special cases to be
remembered.
Support for Abstraction:
There is always found that a substantial gap remaining between the abstract data
structure and operations that characterize the solution to a problem and their particular
data structure and operations built into a language.
Programming Environment:
An appropriate programming environment (reliable documentation and testing
packages) adds an extra utility and make language implementation easier.
Ease of program verification/Reusability:
The reusability of program written in a language is always a central concern. A program
is checked by various testing technique like Formal verification method Desk checking
Input output test checking. We verify the program by many more techniques.
A language that makes program verification difficult may be far more troublesome to
use. Simplicity of semantic and syntactic structure is a primary aspect that tends to
simplify program verification.
Portability of programs:
Programming language should be portable means it should be easy to transfer a
program from which they are developed to the other computer.

4). List 3 examples of High level languages

BASIC (Beginners All Purpose Symbolic Instruction Code


COBOL (Common Business Oriented language
FORTRAN (Formula Translation
C: Structured Programming
C++: Popular object oriented programming language

5. What are the 7 steps involved in the Program Development Life Cycle

CopyRight@Eugene Tebo February 2024 2


ICT316: Introduction to Programming Some Tutorials Questions and Solutions

1. Understand the problem.


2. Plan the logic.
3. Code the program.
4. Use software (a compiler or interpreter) to translate the program into machine
language.
5. Test the program.
6. Put the program into production.
7. Maintain the program.

6. Know the following Terms:


i) Computer Program
A Computer program is a list of logical instructions for the computer to follow in
performing a task.
A computer program is a step by step set of instructions that a computer has to work
through in a logical sequence in order to carry out a particular task

ii) Keyword
Keywords are reserved words with a special meaning for a particular programming
language

iii) Variables
A variable is a storage location in computer memory for data in a program

iv) Differentiate between a local and a global Variable: (4marks)


A local variable
is one available for only a section of the program
A global variable
is one that is available for the entire program.

7) What do you understand by Programming Language Paradigm

A programming paradigm is an approach to programming a computer based on a


coherent set of principles or mathematical theory.

8) List some 5 Categories of Programming Paradigm


Imperative paradigm
Functional paradigm,
Logic paradigm
Object-Oriented paradigm
Visual paradigm
Parallel/concurrent paradigms,
Constraint based paradigm
Dynamic paradigms.

CopyRight@Eugene Tebo February 2024 3


ICT316: Introduction to Programming Some Tutorials Questions and Solutions

9) Know how to write a


• simple pseudocode,
• write a simple Algorithms and
• draw a simple flowchart
a) What to you understand by the following
i) Pseudocode
is an English-like representation of the logical steps it takes to solve a problem.
ii) Flowchart
is a diagrammatic representation of sequence of logical steps of a program
iii) algorithm
A sequential solution of any program that written in human language

b) Write a pseudocode representation to Double a number


start
inputmyNumber
setmyAnswer = myNumber * 2
outputmyAnswer
stop

c) Write an algorithm to find out if a number is odd or even?


step 1 : start
step 2 : input number
step 3 : rem=number mod 2
step 4 : if rem=0 then
print "number even"
else
print "number odd"
endif
step 5 : stop

d) Draw a flowchart to calculate the average of two numbers

CopyRight@Eugene Tebo February 2024 4


ICT316: Introduction to Programming Some Tutorials Questions and Solutions

Question
i) What do you understand by Programming Language Paradigm
A programming paradigm is an approach to programming a computer based on a
coherent set of principles or mathematical theory.
ii) List some 5 Categories of Programming Paradigm
Imperative paradigm
Functional paradigm,
Logic paradigm
Object-Oriented paradigm
Visual paradigm
Parallel/concurrent paradigms,
Constraint based paradigm
Dynamic paradigms.

iii) What is an Array? Explain with an example.


An array is a list or table of data under one variable name/index. each item in the list is
an element.
Example of an array
person["Name "] = " Kizito Samuel"
person["Age "] = 30

iv) Differentiate between a local and a global Variable:


A local variable is one available for only a section of the program
A global variable is one that is available for the entire program.

CopyRight@Eugene Tebo February 2024 5

You might also like