You are on page 1of 9

SCHOOL: UCT-HIT

COURSE: PROGRAMMING LANGUAGES


TERM: FIRST SEMESTER EXAMS
INSTRUCTOR: Engineer LUCIEN WENGIE YEMAH
DURATION:
Instruction: ANSWER ALL QUESTIONS
SECTION 1
MCQs

1. Program which is written originally by programmer is classified as


a) object code.
b) machine code.
c) source program.
d) interactive programs.

2. Loop statement which is repeated to some given number of times is classified as


a) FOR loop.
b) GO loop.
c) REPEAT loop.
d) GO REPEAT loop.

3. Type of statement written in sequence and are repeated until conditions met is classified as
a) format.
b) loop.
c) case.
d) condition.

4. Size of an array is declared by


a) programmer.
b) program users.
c) software.
d) declared automatically.

5. An instruction which tells assembler how to deal with whole program is classified as
a) direction.
b) directive.
c) director.
d) compiler.

6. Programming language 'FORTRAN' stands for


a) formula translator.
b) formula translation.

1
c) free translator.
d) free translation.

7. Sequence of instructions that are carried out for a particular task is classified as
a) routine.
b) subroutine.
c) procedure.
d) function.

8. Name given by a programmer to some data is classified as


a) identifier.
b) identification.
c) exponent.
d) mantissa.

9. Functions used in programs that are defined by programmers are called


a) program layout.
b) program procedure.
c) built-in functions.
d) user-defined function.

10. A program which interprets each line of high level program at time of execution is called
a) instructor.
b) interpreter.
c) translator.
d) executor.

11. An assembler translates


a) machine code into assembly code.
b) assembly code into machine code.
c) processing time into manual time.
d) routine into subroutine.

12. When variable used in program is whole number, variable is stored as


a.) fixed string.
b.) integers.
c.) negative whole numbers.
d.) positive whole numbers.

13. Set of data whose items are organized together is classified as


a) data structure.
b) variable structure.
c) string structure.
d) positive structure.

2
14. Programming language 'COMAL' stand for
a) common algorithmic language.
b) common arithmetic language.
c) common arithmetic learning.
d) common algorithmic learning.

15. In programming, programmers used comments to


a) highlight program modules.
b) explain module functions.
c) explain used variables.
d) all of above.

16. To made program easier to understand, programmers can


a) add comments to it.
b) declare variable names.
c) use secure data.
d) both a and b.

17. Programming language which is used for scientific purposes and work is to be done in batches
is
a) PASCAL.
b) FORTRAN.
c) LOGO.
d) COMAL.

18. Statement used to made choice between different options and only option is to be performed is
written as
a) if then statement.
b) if else statement.
c) then else statement.
d) else one statement.

19. Variable which uses same name in whole program and in its all routines thus best classified as
a) middle variable.
b) default variable.
c) local variable.
d) global variable.

20. Third component in algorithms is classified as


a) data repetition.
b) statement repetition.
c) selection.
d) stating order of operations.

21. In high level programming language C, each program statement ends with the
a) comma.

3
b) semicolon.
c) double quotation marks.
d) single quotation marks.

22. Type of program which can be run on different types of computer by making little changes into
it is classified as
a) portable program.
b) fixed program.
c) standard program.
d) compiled program.

23. In unstructured programming language BASIC, program can be divided into the
a) different modules.
b) different arrays.
c) different dimensions.
d) different procedures.

24. When there is range of numbers involved in a program, it can be stored as


a) real numbers.
b) original numbers.
c) rational numbers.
d) irrational numbers.

25. Technique of using fixed words for machine code functions is classified as
a) mnemonics.
b) mechanics.
c) compiler.
d) translator.

26. Program functions that are readily available to users of specific language are called
a) standard function.
b) program layout.
c) program procedure.
d) program layout.

27. Program routine which is used by one or more computer programs is classified as
a) super-routine.
b) subroutine.
c) dimension routine.
d) array routine.

28. Variable with a restricted name in only one subroutine program is classified as
a) local variable.
b) global variable.
c) middle variable.
d) default variable.

4
29. In COMAL programming language, a WHILE loop must ends with
a) end while function.
b) stops function.
c) output function.
d) input function.

30. Programming language which is extension of programming language 'BASIC' is


a) PASCAL.
b) COBOL.
c) LOGO.
d) COMAL.

31. In Pascal and COMAL programming language, symbol ':=' is used for
a) base.
b) coefficient.
c) assignments.
d) reference.

32. Main type of functions does not include


a) built-in function.
b) top down procedures.
c) programmer defined function.
d) user-defined function.

33. 'object program' is also called


a) program code.
b) machine code.
c) assembler.
d) compiler.

34. When source program is translated it is classified as


a) translated program.
b) object program.
c) featured program.
d) detailed program.

35. Statement which is treated as choice for a possible action is classified as


a) case.
b) error statement.
c) variable recognition.
d) condition.

36. A program which translates high level program into machine code is classified as
a) compiler.
b) translator.
c) translating analyst.

5
d) instruction analyst.

37. All numbers including decimals are classified as


a) composite numbers.
b) real numbers.
c) integers.
d) prime numbers.

38. Group of all special characters such as digits and letters are classified as
a) strings.
b) negative numbers.
c) odd numbers.
d) even numbers.

39. In programming a single instruction is classified as


a) set of instructions.
b) statement.
c) set of codes.
d) set of formula.

40. Program style and must be written in


a) well-structured manner.
b) easy modification format.
c) easily understandable.
d) all of above.

41. Computer programming language which is based on problems solved is called


a) advanced level programming language.
b) ordinary programming language.
c) high level programming language.
d) low level programming language.

SECTION 2
Part 1
1.Define the following: Algorithm, Flow charts, polymorphism, inheritance, encapsulation, and
cognitive processing
2.List any three characteristics of an algorithm.
3.Write down algorithm to do the following
- Adding two numbers
- Comparing between two numbers which is smaller

6
4.How many programming errors exist, name them, define them and give atleast ONE reason how
it might occur
Part 2
1.Give a real world example to proof that you understand the concept of polymorphism,
encapsulation and inheritance, BE PRECISE.
2 In order to upload a software online,
Step 1: the uploader has to edit the software
Step 2: check the size of the software and if the size is within the acceptable range, the user can click
upload but if not, the uploader goes back to edit the software again.
Step 3: After clicking the upload button, the site the uploader if he an account. If YES
Step 4: the uploader logins
Step 5: Browse the file to be uploaded
Step 6: add description and tags
Step 7: click save and upload
But if NO
Step 8: the user signup for an account before going through step 4 to step 7
Using the above information, draw a concise flow chart to show diagrammatically how a user can
upload a software online. BE EXPLICIT
3 consider the code below
#include <stdio.h>
int main (){
printf(\n HELLO PROGRAMMING LANGUAGES);
return 0;
}
Give the lexical analysis output of the above code

7
8
9

You might also like