Professional Documents
Culture Documents
JF S1-S5 MT (Questions and Answers) Highlighted
JF S1-S5 MT (Questions and Answers) Highlighted
JF S1-S5 MT (Questions and Answers) Highlighted
NAME :
CLASS :
JF S1-S5 MT
135 Questions DATE :
A True B False
A C++ B Java
C C D Java C
3. You design a Circle class with various fields and methods. Which of the following could be
fields in this class? Distinguish which of these are between the properties and behavior.
A calculateDiameter() B color
C calculateArea() D radius
E calculateCircumference()
A True B False
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 1/23
5/24/22, 1:07 AM JF S1-S5 MT
7. When the program runs normally (when not in debug mode), which statement is true about
breakpoints?
Breakpoints will not have any effect on Breakpoints will stop program execution
A program execution. B at the first breakpoint.
Breakpoints will stop program execution Any Breakpoint will stop program
C at the last breakpoint. D execution.
They insert break statements. They can be used to check the current
C D
state of the program
10. Which of the following two features are supported by the NetBeans IDE.
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 2/23
5/24/22, 1:07 AM JF S1-S5 MT
12. A software feature may allow the user to perform a specific task.
A True B False
13. If the requirement step of the Spiral Model of development is forgotten, which of the
following could occur?
The Program gives inaccurate results. Required software features are missing
C D
from the program.
A True B False
15. You’d like to see a movie with a few friends. You write an email to confirm plans.
Hi Friends,
There’s a new movie “Attack of the Duke!” premiering this Friday at Oracle Cinema at 4:30
PM. The cinema is at the corner of South Street and Walnut Ave. Subway would be the best
way to get there.
Watch “Attack of the Duke!” on Friday at Reach the cinema by 4:00 PM.
A B
Oracle Cinema at 4:30 PM.
16. What is the correct order of steps in the Spiral Model of Development?
17. During the Design phase of software development, the programmer implements features
gathered during the Requirement phase.
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 3/23
5/24/22, 1:07 AM JF S1-S5 MT
18. You have a beautiful garden at home. On Sunday, you start budding your rose plant to
make few more samples of rose plants to plant in the garden.
Can you categorize how this scenario could be represented by classes and instances?
Samples of the rose plant are called Samples are the class and the rose plant is
A B
classes and not the actual rose plant. the instances of samples.
Rose plant is the object and samples are Rose plant is the class and the samples
C not instances of the plant because they D generated from the rose plant are
have not grown yet. instances of that class.
19. There are several fields and methods in a Shirt class. Which of the following could be a
method in the Shirt class?
A size B getShirtSize()
C color D price
A True B False
21. Which two are the correct syntax for adding comments?
Start with a slash- star (/*). End with slash- Start with two slashes and a star (//*). End
A B
star (/*). with a star-slash (*/).
Start with a slash-star (/*). End with a star- Start with two slashes (//). End with two
C D
slash (*/). slashes (//).
A True B False
Provide an explanation about the code to To provide better security to the program.
A B
the programmer.
It increases the execution time of the Provide good look and feel of the code.
C D
code.
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 4/23
5/24/22, 1:07 AM JF S1-S5 MT
25. Java is a strongly typed language; therefore you must declare a data type for all variables.
A True B False
27. Which two data types are appropriate for their variable?
A True B False
A a B Welcome
C 2 D int
A 2 B 4
C 6 D 7
E 8
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 5/23
5/24/22, 1:07 AM JF S1-S5 MT
A + B -
C # D @
A const B final
C static D break
35. Which two are recommended practices for naming final variables?
A True B False
int x = 25 - 5 * 4 / 2 - 10 + 4;
A 8 B 9
C 34 D 7
A byte B short
C int D long
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 6/23
5/24/22, 1:07 AM JF S1-S5 MT
40. Which of the following two statements are true about variables?
They allow code to be edited more They make code becomes flexible.
C efficiently. D
42. Identify the names of two variables used in the given code.
A strVal B Hello
C int D String
E intVal
A World B Hello
44. Which data type is most commonly used to represent numeric data?
A int B float
C String D short
45. Assuming x is an int, which of the following are ways to increment the value of x by 1?
A x = x +1; B x = +1;
C x+; D x++;
E x += 1;
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 7/23
5/24/22, 1:07 AM JF S1-S5 MT
46.
Type casting retains the size of the value Type casting cannot be performed on
A B
or the original data type. equations.
Type casting lowers the range of possible Type casting changes the type of the value
C D
values. stored.
50. A double with the value of 20.5 is cast to an int. What is the value of the int?
A 21 B 25
C 20 D 20.5
51. A short data type can be promoted to which of the following types?
(Choose all correct answers)
A boolean B byte
C long D double
E int
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 8/23
5/24/22, 1:07 AM JF S1-S5 MT
52. When the result of an expression is assigned to a temporary memory location, what is the
size of memory allocated?
The size of the smallest data type used in A default size is allocated.
A B
the expression.
The size of the any data type used in the The size of the largest data type used in
C D
expression. the expression.
A True B False
A True B False
56. The print() method prints to the console and automatically creates a line.
A True B False
String concatenation cannot be done with Strings can be combined using the ‘+’
A numbers. B operator
String concatenation can be done with String concatenation cannot be done with
C String variables and String Literals. D more than two String Literals.
A True B False
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 9/23
5/24/22, 1:07 AM JF S1-S5 MT
A True B False
A True B False
62. The Java compiler automatically promotes byte, short, and chars data type values to int data
type.
A True B False
64. Automatic promotion from smaller data type to a larger data type is not allowed in Java.
A True B False
A True B False
68. In Java, char is a primitive data type, while String is an object data type.
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 10/23
5/24/22, 1:07 AM JF S1-S5 MT
69. Which two statements are true about the Scanner class?
A Scanner object doesn’t have fields and A Scanner object opens a stream for
A B
methods. collecting input.
70. You write a statement that assigns a value to a String variable as shown below.
A True B False
java.awt.font java.awt
A B
java awt.font
C D
72. The classes of the Java class library are organized into packages.
A True B False
73. The JFrame and JOptionPane classes are in the javax.swing package. Which two will import
those classes?
Packages of the Java class library do not A package doesn’t contain a group of
C D
contain related classes. related classes.
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 11/23
5/24/22, 1:07 AM JF S1-S5 MT
75. Which of the following wild card character is used to import all the classes in a particular
package?
A ; B !
C ~ D *
A True B False
A java.lang B java.math
C java.awt D java.io
78. Which of the following are the arguments in the following method?
A 1 B 3
C 2 D 0
A void B instance
C System D new
Methods can be written with any number Methods can never be written with more
C D
of parameters. than four parameters.
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 12/23
5/24/22, 1:07 AM JF S1-S5 MT
A True B False
83. You’re designing banking software and need to store 10000 customer accounts with
information on the accountholder’s name, balance, and interest rate. The best approach is
store 30000 separate variables in the main method.
A True B False
A True B False
85. Which of the following scenarios would be ideal for writing a method?
When you don’t find similar lines of code For every five to six lines of code.
A B
to describe an object’s behavior.
When you don’t want to repeat similar To group similar data types together
C lines of code to describe an object’s D
behavior.
86. Which two are valid import statements of the Scanner class?
import package.className;
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 13/23
5/24/22, 1:07 AM JF S1-S5 MT
88. Which is a valid way of calling the testMethod in the TestClass? Assume a testInstance has
been created.
E testInstance.testMethod(3.5);
89. Once an object is instantiated, how might its fields and methods be accessed in Java?
A True B False
A True B False
92. You need to generate random integer values between 0 and 80 (inclusive). Which statement
should you use?
A nextInt(0-79); B nextInt(80);
C nextInt(); D nextInt(81);
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 14/23
5/24/22, 1:07 AM JF S1-S5 MT
A Number B Integer
C Double D Random
The Math methods can be invoked Common math functions like square root
A without creating an instance of a Math B are taken care of in the language.
object.
You don’t have to worry about the data Math methods can be invoked with Strings
C D
type returned from a Math method. as arguments.
A java.awt B java.lang
C java.net D java.io
C 3.141 D 0
Static methods must be of return void. Static methods can be invoked through an
A B
instance of a class
Static methods can be invoked through A class can have multiple static methods.
C D
the class name.
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 15/23
5/24/22, 1:07 AM JF S1-S5 MT
A orld! B rld!
C ld! D rld
C JavaWorld D Java
A True B False
A True B False
107. The indexOf() method returns the index value of a character in the string.
A True B False
108. The String concat() method concatenates only String data types.
A True B False
109. The replaceFirst() method replaces only the first occurrence of matching character pattern
in a string.
A True B False
A charAt() B findLength ()
C length() D compareTo()
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 16/23
5/24/22, 1:07 AM JF S1-S5 MT
111. The Math class methods can be called without creating an instance of a Math object.
A True B False
112. You need to generate random integer values in the range 2 through 10. This code fragment
will produce the desired result.
A True B False
113. A break statement causes control to transfer to the end of the switch statement.
A True B False
114. Which two of the following data types can be used in a switch statement?
A int B boolean
C float D String
C Consonants D Vowels
A Congratulations B A
117. A String comparison with == compares the Strings’ locations in memory and not the
content of the String.
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 17/23
5/24/22, 1:07 AM JF S1-S5 MT
C = D ~=
C False D True
C Bob is 43 D No output
121. An if/else statement is used when you need to choose between two alternatives.
A True B False
E if/else statement
A Variables B Errors
C Operators D Loops
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 18/23
5/24/22, 1:07 AM JF S1-S5 MT
125. In a boolean expression which uses the && operator, what would make this expression
evaluate to true?
If both the first condition and second If the first condition is true, but the second
A B
condition are false condition is false
If the first condition is false, but the If both the first condition and second
C D
second condition is true condition are true
When rewardPoints is more than 2000 or When purchase is 4000 and rewardPoints
A purchase greater than 1000 B is 2000
When purchase is 2000 regardless of the When rewardPoints is more than 1000
C value of rewardPoints D and purchase is 1000
A + B %
C && D !
E ||
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 19/23
5/24/22, 1:07 AM JF S1-S5 MT
int rating;
int experience;
if (rating > 1 && experience == 5) {
System.out.println (“Eligible for a bonus”);
}
130. What are the possible values of a boolean data type in Java?
A good/bad B yes/no
C 0/1 D true/false
131. Which operator is used to test if both sides of a boolean expression are equal?
A <= B ==
C >= D =
132. The equal sign (=) is used to make an assignment, whereas the == sign merely makes a
comparison and returns a boolean.
A True B False
133. The switch statement is a more efficient way to write code when dealing with a large range
of unknown values.
A True B False
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 20/23
5/24/22, 1:07 AM JF S1-S5 MT
135. Which two of the following data types can be used in a switch statement?
A float B String
C boolean D int
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 21/23
5/24/22, 1:07 AM JF S1-S5 MT
Answer Key
1. a 2. c 3. b, d 4. a
5. c, d 6. a 7. a 8. b, a, d
https://quizizz.com/print/quiz/5c6d8cc2de1fe5001a9d60ec 23/23