Professional Documents
Culture Documents
MODULE Informatics 1A
DURATION 3 hours
SA1
SECTION A [40 MARKS]
Answer ALL questions in this section.
A) “;” Semicolon
B) Double quote “ ”
C) Single quote ‘ ’
D) “//”
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
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
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
A) Compiling
B) Testing
C) Dry running
D) Structuring
A) modelling
B) coding
C) drawing
D) reading
A) Byte code
B) Java Virtual Machine (JVM)
C) Central Processing Unit (CPU)
D) Binary machine code
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
A) Comparison statement
B) Assignment statement
C) Repetition statement
D) Selection statement
A) Loops
B) Flowcharts
C) Algorithms
D) Selection structures
A) () * / % + -
B) * () % / + -
C) % * () / + -
D) / + - % * ()
A) <
B) !=
C) =
D) <=
A) void ();
B) main ();
C) static ();
D) public ();
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.
3.1 Provide TWO (2) reasons for using comments in a program. (4 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.
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!
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