Professional Documents
Culture Documents
MODULE Informatics 1A
DURATION 3 hours
02
Answer ALL questions.
A) Eclipse
B) Excel
C) JGrasp
D) NetBeans
A) !
B) &&
C) ++
D) !=
A) classes
B) objects
C) methods
D) code blocks
A) i = i + i;
B) i = i + 1;
C) i = i - 1;
D) i - - ;
A) 1
B) 4
C) 5
D) 6
02 1
1.7 Java is defined as a(n) ______________.
A) assembly language
B) machine language
C) low-level language
D) high-level language
A) Comparison statement
B) Assignment statement
C) Repetition statement
D) Selection statement
A) integer Variable
B) main (String)
C) public class (String)
D) parseInt ()
A) Pascal
B) C++
C) Cobol
D) Scratch
A) Surname
B) $total
C) _abc_
D) 1surname
A) Repetition loops
B) Relational operators
C) Counter variables
D) Methods
02 2
1.14 _______ defines a list of items which are operated on by the algorithm.
A) Data
B) Process
C) Output
D) Variables
1.15 _______ are often used to document a program and improve its readability.
A) Objects
B) Classes
C) Methods
D) Comments
1.16 You can also show output in the command line window, using the methods:
A) JOptionPane.showInputDialog();
B) JOptionPane.showMessageDialog();
C) System.exit(0);
D) System.out.println();
1.17 A(n) __________ occurs when a program has a grammatical mistake like missing punctuation.
A) syntax error
B) run-time error
C) logic error
D) hidden error
A) null
B) Message
C) Hello world!
D) Hello
1.20 The _____ operator does addition when applied to two numbers, and strings concatenation when
applied to two Strings , or a String and a numeric value :
A) –
B) +
C) *
D) \
02 3
QUESTION 2 (20 Marks)
Determine if the following statements are True or False. Write down the question number and the correct answer next to
it. E.g. 2.21 True
Variables provide a convenient way to store information in the computer’s memory temporarily. When information is stored in a
variable, it can use that information whenever it is needed in the program by calling the name given to it. The value may be
changed at any stage. With this in mind, answer the questions that follow:
3.1 List and explain the THREE (3) parts of a variable. (6 marks)
3.4 Write a Java program to store three numbers into variables num1, num2 and num3 and then display those numbers in a
dialog box. (7 marks)
02 4
QUESTION 4 (20 Marks)
4.2 The following program below contains 10 errors. Write down the line numbers together with the corrected program
statement: (10 marks)
5.2 State whether the following are valid or invalid method names: (5 marks)
5.2.1 $myMethod()
5.2.2 ____addingNumbers()
5.2.3 2012AverageCalculator()
5.2.4 guess The Answer()
5.2.5 First_Name()
5.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)
END OF PAPER
02 5