wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Pra-PSPM SC025(F04)

Total questions: 24

Worksheet time: 24mins

Name
Class
Date
1.

Calculate and display BMI when a user enters weight and height. From the value of BMI, display “Please reduce your weight” if BMI is greater and equal to 25.0. If not, print “You have an ideal weight”. Which of the answer below is the correct way in writing the output in IPO of this problem?

a)

"Please reduce your height" or "Please reduce your weight"

b)

value of BMI, "Please reduce your weight" or "You have an ideal weight"

c)

value of BMI or "Please reduce your weight" or "You have an ideal weight"

d)

value of BMI

2.

Sentinel-controlled repitition is often called as

a)

Definite Repetition

b)

Indefinite Repitition

c)

Definite Sentinel loop

d)

Indefinite Sentinel loop

3.

Which of the following is not the type of method calls

a)

obj.sayHello(name);

b)

obj.sayHi(name);

c)

void showWelcome(){

d)

obj.showWelcome();

4.

What links each instruction in a flowchart?

a)

A line

b)

A double line

c)

An arrow

d)

A double arrow

5.

start

input dog_age *// dog age in human years

dog_years= (a)  

print dog years

end

Based on the pseudocode given, which calculation are correct to calculate the dog real age(dog_years)

(1 dog years = 7 human years)

6.

Instructions carried out one after another in order is a

a)

series

b)

collection

c)

sequence

d)

list

7.

What is the importance of array?

a)

To store multiple value of the same type using variable

b)

store multiple value using multiple variable

c)

collect data

d)

Enable you to write a program that manipulate small amounts of data

8.

Advantages of defining methods in a program is /are

a)

dividing a bigger complex task into smaller, easily understood tasks.

b)

useful in hiding the implementation details.

c)

Can be used with most of the data types.

d)

the elements can be accessed randomly by using the index number.

9.

FOR loops are

a)

loops which run for a specific number of times

b)

not part of programming

c)

the same as if statements

d)

loops which run an unknown number of times

10.

Methods that contain the _______ keyword in the data type position do not return any data

a)

boolean

b)

public

c)

static

d)

void

11.

int i = 0;

while (i < 5){

System.out.println(i);

i++;

}

What is the output?

a)

0

1

2

3

4

b)

1

2

3

4

5

c)

0

1

2

3

4

5

d)

5

12.

What is the value of number after the following loops is executed?

num = 4;

for(i=7; i<12 && i>=7; i--){

++num;

}

a)

7

b)

5

c)

6

d)

8

13.

Output of the following Java program?

class Test{

public static void main(String[] args){

int arr1[]={1,2,3};

int arr2[]={1,2,3};

if(arr1==arr2){

System.out.println("Same");

}else{

System.out.println("Not same");

}}

a)

Same

b)

Not same

c)

Not Same

d)

Error

14.

Does a programmer always know how long an array will be when the program is being written?

a)

Yes, the program will not compile without the length being declared.

b)

No, the array object is created when the program is running and the length might change from run to run

c)

Yes, otherwise the program will not run correctly

d)

No, arrays can grow to whatever length is needed

15.

Which of the following is an example of a sequence program?

a)

Production line

b)

Computer game

c)

Spreadsheet

d)

Web browser

16.

What will be the output of the following Java program?

class selection_statements{

public static void main(String[] args);

int var1=5;

int var2=6;

if((var2=1) == var1){

System.out.println(var2);

} else {

System.out.println(++var2);

}}

a)

1

b)

2

c)

3

d)

4

17.

Which group of words denotes repetition in pseudocode?

a)

if, then, else, else-if, when

b)

for, repeat until, while, while not

c)

begin, end, input, output, print, read, write

d)

None of these

18.

Ordering burger

will be in which flowchart symbol?

a)

Start/End

b)

Action/Process

c)

Decision

d)

Storage

19.

What is wrong with the following loop?

for(int i=0; i>5; i++){

System.out.println("The square of " + i + " is: " + (i*i) + "/n");

}

a)

This is an infinite loop because I can never get to be greater than 5.

b)

This loop will never execute the loop body because the counter variable starts at 0 and immediately fails the test of >5.

c)

This statement is missing the incrementation statement.

d)

This loop is perfect.

20.

Which of the followings is Java code that starts from the main() method as a mandatory part of every program.

a)

public void static main(String args [])

b)

public void main static (args[] String)

c)

public static void main(String args[])

d)

public static void main[String[] Args]

21.

What is the output for the following statement:

System.out.println("1"+"1");

a)

11

b)

2

c)

Error Message

d)

1

22.

Determine the number of input(s) that is read based on the following input statement.

Scanner in=new Scanner(System.in);

int item[20];

item[10]=in.nextInt();

a)

1

b)

10

c)

9

d)

19

23.

State the sentinel value.

int sum;

sum=0;

int num= in.nextInt();

while(num!=-1)

{

sum = sum+num;

num=in.nextInt();

}

System.out.println(sum);

(a)  

24.

Identify the number of output(s) based on the statement below:

'Display the name of five salespersons in a company that received 3% bonus from their salary. Then the program should print their bonus amount and their gross salary.'

a)

5

b)

7

c)

3

d)

2