WorksheetsPRA PSPM SC025 ( F01 KML )
Total questions: 24
Worksheet time: 12mins
Based on the java coding, what is the method type used?
Type 1
Type 2
Type 3
Type 4
What is the output of the following code ?
5
0
4
Compilation Error
Which of the following is the definition of sequence?
A sequence of well-defined steps to solve a problem
Performs actions one after another
Performs actions based on a certain condition
Allows a sequence of instructions to be executed repeatedly until a certain condition reached
Which of these is an incorrect array declaration?
int arr[]=new int[5];
int []arr=new int[5];
int arr[]=new int[5];
int arr[]=int [5] new;
What is the output if the diameter of the circle is 12?
452.448
452
113.112
113
What is stored in this array backpack?
String backpack[] = {“Apple”, “Banana”};
Apple
Banana
Apple, Banana
Null
What is the meaning of this coding?
while (num!=-999)
Number cannot be -999
Number can be -999
Number cannot be -999 with condition
Number can be -999 with condition
When you want to make the start point in flowchart, what is the shape used?
Circle
Rectangle
Oval
Square
What will this display?
3, 9, 5
3, 9
3, 9, -5, 5
Which of the following is not a keyword in Java?
Read
Write
start
A Java program was built to verify if the person's age is able to get a golden age discount on a Dayan Market.
Which one is the correct if-else statement to verify if the age passed equal or more than 60?
if(age>=60)
if(age>60)
if(age<60)
if(age<=60)
Cindy was borrowing a book from Veytican Library. She was returning a book late. Calculate the total fine charged to Cindy by library for late book return. The charge is RM0.20 per day. Identify the input, process and output.
Input: RM0.20
Process: calculate total fine charged based on late day
Output: total fine charged
Input: late_day
Process: Calculate total fine charged based on late day
Output: total_fine_charged
Input: Late Day
Process: calculate total fine charged based on late day
Output: Total Fine Charged
Input: total fine charged
Process: calculate total fine charged based on late day
Output: late day
How is Sequence represented in pseudocode?
Each step of the algorithm is explained in a diagram
Each step of the algorithm is written on a line of its own, in sequence
All steps of the algorithm is written on the same line
public static void main (String[] args) {
Coding above refers to which type of basic components of a Java Program?
Class declaration
Body of method main()
Comments
Method main()
A diagram that were used to represent a set of instructions is called:
Shapes
Flowchart
Pseudocode
Three of the for loops below will provide identical values for i. Which for loop will provide values that do not match the others?
for i in range(0,5)
for i in range(5)
for i in range(5,0,1)
for i in range(0,5,1)
Process: To display message “I LOVE JAVA” 10 times
Output: “I LOVE JAVA”
I LOVE JAVA
null
message
10 message
Method is a collection of statements that are grouped together to perform an operation. There are two types of methods and one of them is the user-defined method. Select the correct statement about that method. (Your answer can be more than one)
i. User-defined methods are built-in methods in Java that are readily available to use for the programmer.
ii. General structure of the method which is the return type, method name and parameter must be defined first before you can call a method.
iii. It is a method that can return a primitive data type such as int and double.
iv. User-defined method is a method that is defined by a programmer.
ii, iii and iv
i, ii and iii
i and iv
ii only
Java class names should always begin with an Uppercase letter and with a number.
True
False
What is the output of the following code?
5
0
4
Compilation Error
Which is the correct rule to write an identifier in the Java language ?
A variable that start with a numeric or number
Use special characters
Use reserved word
First character begin with letter,underscore or a dollar sign
Based on the array above, what is the output ?
Ferrari
BMW
Mercedes
Lambhorgini
The Repetition structure is recommended to handle sentinel-controlled repetition of
While
Do/While
For
Continue
Choose the correct answer :
i. Parameter is variable declarations that is used in method
ii. If a method returns a value, then the method call should be assigned to a variable
iii. You can use method only once
i and ii
i only
ii and iii
i, ii and iii
