You are on page 1of 6

FINAL EXAMINATION

PROGRAMME Bachelor of Commerce in Information and Technology Management

MODULE Informatics 1A

YEAR One (1)

INTAKE July 2018

DATE 08 November 2018

TIME 09h00 – 12h00

DURATION 3 hours

TOTAL MARKS 100

INSTRUCTIONS TO THE CANDIDATE

1. Questions must be attempted in the answer book provided.


2. All queries should be directed to the invigilator; do not communicate or attempt to communicate with any
other candidate.
3. You have THREE HOURS to complete this paper. You are not allowed to leave the examination room within
the first hour and in the last 15 minutes of this examination.
4. This is a CLOSED BOOK examination.
5. Read ALL instructions carefully.

SA1
SECTION A [40 MARKS]
Answer ALL questions in this section.

QUESTION 1: Multiple Choice (20 Marks)


Write down the question number and the correct answer next to it, e.g. 1.21 B

1.1 Strings start and end with a _______ .

A) “;” Semicolon
B) Double quote “ ”
C) Single quote ‘ ’
D) “//”

1.2 ______ represent the relevant characteristics of the object.

A) Attributes
B) Objects
C) Classes
D) Methods

1.3 _____ is an integrated development environment in which you can easily edit programs and launch the JAVA
compiler and run-time interpreter.

A) MS word
B) TextPad
C) NotePad
D) WordPress

1.4 A combination of English words and control structures is called _____.

A) Algorithms
B) Sequence
C) Repetition
D) Pseudocode

1.5 The _______ symbols define the <newline> character which moves the output cursor to a new line.

A) \t
B) \s
C) \u
D) \n

1.6 The expression : 42 + 24 represents the following:

A) 66
B) 42 + 24
C) 4224
D) 0

1
SA1
1.7 The test is a _______

A) Selection Statement
B) Repetition Statement
C) Boolean Expression
D) Control Statement

1.8 The ______ of an identifier is the time during which it exists in memory.

A) Duration
B) Scope
C) Initialization
D) Value

1.9 The ________ makes counter-controlled repetition easier.

A) Do… while loop


B) For loop
C) While loop
D) If_ else statement

1.10 __________ is a useful technique for understanding/debugging programs containing loops.

A) Compiling
B) Testing
C) Dry running
D) Structuring

1.11 Object orientation is a system for:

A) modelling
B) coding
C) drawing
D) reading

1.12 A compiled program is executed by ______.

A) Byte code
B) Java Virtual Machine (JVM)
C) Central Processing Unit (CPU)
D) Binary machine code

1.13 The following mathematical operator is not used by Java:

A) ÷
B) +
C) –
D) *

2
SA1
1.14 Which one of the following is an incorrect variable name:

A) Surname
B) $total
C) _abc_
D) 1surname

1.15 The expression a == b is called a ____________.

A) Comparison statement
B) Assignment statement
C) Repetition statement
D) Selection statement

1.16 Complex problems can be analysed and simplified sing:

A) Loops
B) Flowcharts
C) Algorithms
D) Selection structures

1.17 JAVA evaluates operators in the following order:

A) () * / % + -
B) * () % / + -
C) % * () / + -
D) / + - % * ()

1.18 The following is not a relational operator:

A) <
B) !=
C) =
D) <=

1.19 A JAVA program begins execution at the method:

A) void ();
B) main ();
C) static ();
D) public ();

1.20 The name of a variable, class or method is called:

A) an identifier
B) boolean expression
C) selection statement
D) control structure

3
SA1
QUESTION 2 – True / False (20 Marks)
Write down the number and then the answer, e.g. 1.11 True

2.1 JAVA programs are described as portable because they will fit into a small, lightweight disk.
2.2 In the software development life cycle, roughly 70% of the life cycle is spent in maintenance of the software.
2.3 Comments are printed on the screen when the program is executed.
2.4 Methods are one of the major structuring mechanisms for Java programs.
2.5 The quotient “/” and the modulus “%” operators both do the same operation: divide a number.
2.6 JOptionPane is a class which allows us to display a message dialog box.
2.7 The value of the expression “3” + “5” is 35.
2.8 Control structures determine the order in which statements are executed.
2.9 A class is a category of programming language.
2.10 System.out is an example of a method.
2.11 An upper-case letter is considered to be the same character as a lower-case letter in Java.
2.12 The body of any while loop will be executed at least once.
2.13 A single variable declaration can include both initialized and uninitialized variables.
2.14 Any variable in Java can be used before it is declared.
2.15 The boolean type has only two values.
2.16 Compiling is the process of translating a program into binary machine code which the computer understands.
2.17 A program which never stops is said to be a loop.
2.18 Loops can be combined with decision structures.
2.19 Guess The Answer() is a legal method name.
2.20 A void method does not return a value.

SECTION B [60 MARKS]


Answer ALL questions in this section.

QUESTION 3 (20 Marks)

3.1 Provide TWO (2) reasons for using comments in a program. (4 marks)

3.2 List and explain THREE (3) control structures. (6 marks)

3.3 Define the following terms/concepts:

3.3.1 Structured programming (2 marks)

3.3.2 Counter-controlled loop (2 marks)

3.3.3 Sentinel-controlled loop (2 marks)

3.3.4 Do-while loop (2 marks)

3.3.5 Method (2 marks)

4
SA1
QUESTION 4 (20 Marks)

4.1 A method in Java is a block of statements that has a name and can be executed by calling (also called
invoking) it from some other place in your program.

Explain TWO (2) types of methods. (6 marks)

4.2 Methods have a unique name and follow the same naming rules as variables; explain the rules for naming
methods. (4 marks)

4.3 Write a complete Java program called Display that has a void method called ShowMessage() that
accepts a string parameter msg. The method call in the main program should produce the following output:
(10 marks)
It’s a nice day!

QUESTION 5 (20 Marks)

5.1 State the reasons for choosing Java as a learning platform. (5 marks)

5.2 Write a complete Java program that prompts the user to enter 3 marks. Store the 3 marks in integer
variables mark1, mark2 and mark3. Calculate the sum and average of the marks entered.

Using a System,out statement display the sum and average of the marks. (15 marks)

END OF PAPER

5
SA1

You might also like