NEW
Font size
WorksheetsSC025 Week 6
Total questions: 26
Worksheet time: 22mins
Which one of these is not a step in problem solving?
Problem analysis
Design a problem
Documentation
Implementation
In object-oriented programming, what is meant by inheritance?
wrapping code and data into a single unit.
a single action can be performed in different ways.
child object/class will acquire all states and behaviors of parent object/class
hide the implementation details, shows only functionality
Suggest the best control structure that can be used to solve the problem: Calculate the area of a school field
Sequence
Selection
Repetition
Suggest the best control structure that can be used to solve the problem: Calculate the total mark of 30 students
Sequence
Selection
Repetition
This is a valid assignment statement: 4.5 = weight;
True
False
Which problem solving step does writing the source code in Java refer to?
Design a solution
Testing
Problem analysis
Implementation
This is an invalid identifier: total$
True
False
What is the answer for the following expression: int k= 5/2+12%2
2
2.5
8
0
Identify the type of the following operator: <
arithmetic
relational
logical
What are the two tools used to describe algorithm?
pseudocode, flowchart
sequence, selection
IPO analysis, pseudocode
IPO analysis, flowchart
identify the type of the following operator: %
arithmetic
relational
logical
modulus
= is the operator used to assign value to a variable.
True
False
Identify the type of the following operator: &&
arithmetic
relational
logical
Which one of these is the output statement?
public static void main(String [] args)
class Area{
import java.util.Scanner;
System.out.print(area);
Identify the type of the following operator: !=
arithmetic
relational
logical
not equal
Determine the value of x when it is printed/outputted: double x = (5+9) % 3 / 2;
0
1.0
1
0.0
Assume a=35, b=79, evaluate the following Java statements: if (a==b)
True
False
Choose the most suitable data type of the following data item: 35
int
double
char
boolen
Assume a = 35, b=79. Evaluate the following java statements: while (a!=b)
True
False
Choose the suitable data type for the following data item: cabinet's member weight
int
double
char
boolean
Is the following identifier valid or invalid? 2names
valid
invalid
Choose the most suitable data type for the following data item: 'z'
int
double
char
boolean
Assume a=35, b=79. Evaluate the following Java statements: if (a<15)
True
False
Choose the most suitable data type for the following data item: area of triangle
int
double
char
boolean
Compute the value of the following Java expression: 5*6+3*2
66
36
80
What is the output of the following code segment:
int a=8;
a=a+1;
System.out.print(a);
8
9
error
