Professional Documents
Culture Documents
IT 105 Review Notes
IT 105 Review Notes
IT 105 Review Notes
1. A data type which declares a variable with the value either true or false.
a. char b. String c. expression d. boolean
1. An equality testing operator.
a. == b. = c.! = d. comparison operator
2. It is the counterpart of a multi-way if statement’s else clause in a switch statement.
a. break b. continue c. default d. switch
3. It immediately ends the switch statement.
a. break b. continue c. default d. switch
4. A type of selection statement that only executes if and only if the condition is true, and there is no
alternative action.
a. one-way if b. two-way if c. multi-way if d. nested-if
5. A type of selection statement which decides the execution path based on whether the condition is
true or false.
a. one-way if b. two-way if c. multi-way if d. nested-if
6. An if statement which is inside another if statement.
a. one-way if b. two-way if c. multi-way if d. nested-if
7. It is used to tell a program to execute statements repeatedly.
a. switch b. if-else c. loops d. selection
8. It is a function that is used to obtain a random value.
a. random.Math() b. Math.random() c. random.Function() d. Math.randomNum()
9. It is a storage that is used to represent values that may be changed in the program.
a. JOptionPane b. Scanner c. variable d. expression
10. To read a double value using a Scanner, you invoke:
a. nextDouble() b. nextInt() c. nextLine() d. next()
11. To read a String using a Scanner, you invoke:
a. nextDouble() b. nextInt() c. nextLine() d. nextString()
12. An operation that converts a value of one data type with bigger range into a value of another data
type with smaller range.
a. Casting b. Parsing c. Explicit d. Implicit
13. If x is 10 and y is 2, what is the value of x if this expression x*=y is executed?
a. 12 b. 10 c. 20 d. none is correct
14. If x is 10 and y is 2, what is the value of x if this expression x/=y is executed?
a. 5 b.10 c. 8 d. none is correct
15. If x is 9 and y is 4, what is the value of x if this expression x%=y is executed?
a.2.1 b. 2 c. 1 d. none is correct
16. If x is 100_000_000, what is the value of x if this expression x++ is executed?
a. 200_000_000 b. 200_100_00 c. 100_000_100 d. 100_000_001
17. A type of loop that executes a repeatedly while the condition is true
a. for loop b. while loop c. do-while loop d. none is correct
18. What is the correct import statement to import a JOptionPane?
a. import javax.swing.JOptionPane; b. import java.util.JOptionPane;
19. What is the correct import statement to import a Scanner?
a. import java.util.Scanner; b. import javax.swing.Scanner;
20. What is the correct definition of a Scanner variable?
a. Scanner input = new Scanner (System.out); b. Scanner entry = new Scanner (System.in);
1. Write a line of code that returns a random integer between 0 and 9.
2. Write a while loop that will implement the following and will ultimately print “Sum is 45.”:
3. Write a multi-way if-else that tests if the guess of the user is either equal to the number, or too high
or too low.
4. Write the appropriate if statement based on the following flowchart.
5. Finish the following program by writing a while loop to execute this output: