Академический Документы
Профессиональный Документы
Культура Документы
Pertanyaan 2 30 detik
Q. Which of the following language is called a procedural language?
Pilihan jawaban
C++
Java
C (*)
Java C
Pertanyaan 3 30 detik
Q. 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.
Pilihan jawaban
calculateDiameter()
color (*)
calculateArea()
radius (*)
calculateCircumference()
Pertanyaan 4 30 detik
Q. In object oriented programming, an object comprises of properties and behaviors where properties
represented as fields of the object and behavior is represented as method.
Pilihan jawaban
True (*)
False
Pertanyaan 5 30 detik
Q. In object oriented programming, there is an emphasis on which of the following two:
Pilihan jawaban
Writing algorithms.
Creation of procedures.
Modeling objects. (*)
Object interaction without a prescribed order. (*)
Pertanyaan 6 30 detik
Q.
You can set any number of breakpoints for your program.
Pilihan jawaban
True (*)
False
Pertanyaan 7 30 detik
Q. When the program runs normally (when not in debug mode), which statement is true about
breakpoints?
Pilihan jawaban
Breakpoints will not have any effect on program execution. (*)
Breakpoints will stop program execution at the first breakpoint.
Breakpoints will stop program execution at the last breakpoint.
Any Breakpoint will stop program execution.
Pertanyaan 8 30 detik
Q. Which of the following three statements are true about breakpoint?
Pilihan jawaban
They help with debugging. (*)
They pause code execution. (*)
They insert break statements.
They can be used to check the current state of the program (*)
They abruptly ends the code execution.
Pertanyaan 9 30 detik
Q. Which of the following are considered Whitespace?
(Choose all correct answers)
Pilihan jawaban
Space in the print statements.
Space between the [ ] braces.
Indentation before the code. (*)
Blank lines in the code. (*)
Space between words. (*)
Pertanyaan 10 30 detik
Q. Which of the following two features are supported by the NetBeans IDE.
Pilihan jawaban
NetBeans highlights matching braces. (*)
NetBeans automatically runs the program once all the braces in the code are matched.
Once NetBeans spots a problem, it won’t allow you to continue coding until the problem is fixed.
NetBeans provides a shortcut to format whitespace. (*)
Pertanyaan 11 30 detik
Q. Which of the following 2 statements are true about whitespace?
Pilihan jawaban
Whitespace increases execution time of your program.
Whitespace eliminates typing mistakes while programming.
Whitespace reduces the performance of the program.
Whitespace makes your code more readable (*)
Whitespace helps to keep your code organized. (*)
Pertanyaan 12 30 detik
Q. A software feature may allow the user to perform a specific task.
Pilihan jawaban
True (*)
False
Pertanyaan 13 30 detik
Q. If the requirement step of the Spiral Model of development is forgotten, which of the following could
occur?
Pilihan jawaban
Code becomes messy.
Solutions seem elusive.
The Program gives inaccurate results.
Required software features are missing from the program. (*)
Pertanyaan 14 30 detik
Q. The Spiral Model reflects an iterative development process.
Pilihan jawaban
True (*)
False
Pertanyaan 15 30 detik
Q. 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.
Pilihan jawaban
Watch “Attack of the Duke!” on Friday at Oracle Cinema at 4:30 PM. (*)
Reach the cinema by 4:00 PM.
Travel via subway.
Double check the location by verifying you’re on South Street and Walnut Ave.
Pertanyaan 16 30 detik
Q. What is the correct order of steps in the Spiral Model of Development?
Pilihan jawaban
Design, Requirements, Develop, Test
Requirements, Design, Test, Develop
Design, Develop , Requirements, Test
Requirements, Design, Develop, Test (*)
Pertanyaan 17 30 detik
Q. During the Design phase of software development, the programmer implements features gathered
during the Requirement phase.
Pilihan jawaban
True
False (*)
Pertanyaan 18 30 detik
Q. 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?
Pilihan jawaban
Samples of the rose plant are called classes and not the actual rose plant.
Samples are the class and the rose plant is the instances of samples.
Rose plant is the object and samples are not instances of the plant because they have not grown yet.
Rose plant is the class and the samples generated from the rose plant are instances of that class. (*)
Pertanyaan 19 30 detik
Q. There are several fields and methods in a Shirt class. Which of the following could be a method in the
Shirt class?
Pilihan jawaban
size
getShirtSize()(*)
color
price
Pertanyaan 20 30 detik
Q. Java mostly reads code line-by-line.
Pilihan jawaban
True (*)
False
Pertanyaan 21 30 detik
Q. Which two are the correct syntax for adding comments?
Pilihan jawaban
Start with a slash- star (/*). End with slash-star (/*).
Start with two slashes and a star (//*). End with a star-slash (*/).
Start with two slashes (//). End with two slashes (//).(*)
Start with two slashes (//). End when the line ends.
Pertanyaan 22 30 detik
Q. A Java program can be written in the single line.
Pilihan jawaban
True (*)
False
Pertanyaan 23 30 detik
Q. What is the purpose of adding comments in the code?
Pilihan jawaban
Provide an explanation about the code to the programmer. (*)
Pertanyaan 24 30 detik
Q. Code within curly braces is called a “Block of code”.
Pilihan jawaban
True (*)
False
Pertanyaan 25 30 detik
Q. Java is a strongly typed language; therefore you must declare a data type for all variables.
Pilihan jawaban
True (*)
False
Pertanyaan 26 30 detik
Q. Which is valid syntax to declare and initialize a String variable?
Pilihan jawaban
String x= “Java”; (*)
String x = Java;
Pertanyaan 27 30 detik
Q. Which two data types are appropriate for their variable?
Pilihan jawaban
double checkingAmount = 1500; (*)
Pertanyaan 28 30 detik
Q. Which two statements will not compile?
Pilihan jawaban
double double=10; (*)
int age=20;
Pertanyaan 29 30 detik
Q. Which two are valid?
Pilihan jawaban
double doubleVar1; doubleVar2 = 3.1.
Pertanyaan 30 30 detik
Q. Assigning a value to the variable is called “initialization”.
Pilihan jawaban
True (*)
False
Pertanyaan 31 30 detik
Q. Identify the variable declared in the given code.
Pilihan jawaban
a (*)
Welcome
2
int
Pertanyaan 32 30 detik
Q.
How many bits are in a byte?
Pilihan jawaban
2
8 (*)
Pertanyaan 33 30 detik
Q. Which two are mathematical operators?
Pilihan jawaban
+ (*)
- (*)
Pertanyaan 34 30 detik
Q. Which keyword makes a variable’s value unchangeable?
Pilihan jawaban
const
final (*)
static
break
Pertanyaan 35 30 detik
Q. Which two are recommended practices for naming final variables?
Pilihan jawaban
Capitalize every letter (*)
Pertanyaan 36 30 detik
Q. This declaration represents a long data type.
long a = 123L;
Pilihan jawaban
True (*)
False
Pertanyaan 37 30 detik
Q. What value is assigned to x?
int x = 25 - 5 * 4 / 2 - 10 + 4;
Pilihan jawaban
8
9 (*)
34
Pertanyaan 38 30 detik
Q. Which of the following data types is the largest?
Pilihan jawaban
byte
short
int
long (*)
Pertanyaan 39 30 detik
Q. What is the output?
Pilihan jawaban
Value of age: 20 (*)
Value of age: 8
Value of age: 10
Value of age: 20
Value of age: 28
Value of age: 38
Value of age: 20
Value of age: 20
Value of age: 8
Value of age: 9
Pertanyaan 40 30 detik
Q. Which of the following two statements are true about variables?
Pilihan jawaban
Variables will be ignored by compiler.
Pertanyaan 41 30 detik
Q. Which two are valid assignments of a?
Pilihan jawaban
int a = 10
int a; a = 10; (*)
int a = “10”;
Pertanyaan 42 30 detik
Q. Identify the names of two variables used in the given code.
Pilihan jawaban
strVal (*)
Hello
int
String
intVal (*)
Pertanyaan 43 30 detik
Q. What is the output?
Pilihan jawaban
World (*)
Hello
Hello World
Hello
World
Pertanyaan 44 30 detik
Q. Which data type is most commonly used to represent numeric data?
Pilihan jawaban
Int (*)
float
String
short
Pertanyaan 45 30 detik
Q. Assuming x is an int, which of the following are ways to increment the value of x by 1?
Pilihan jawaban
x = x +1; (*)
x = +1;
x+;
x++; (*)
x += 1; (*)
Pertanyaan 46 30 detik
Q.
Pilihan jawaban
Value of x is 0
Value of y is 1
Value of x is 100
Value of y is 1
Value of x is 100
Value of y is 1
Pertanyaan 47 30 detik
Q. What is the correct way to cast a long to an int?
Pilihan jawaban
int longToInt = int 20L;
Pertanyaan 48 30 detik
Q. Which two statements are true about type casting?
Pilihan jawaban
Type casting retains the size of the value or the original data type.
Pertanyaan 49 30 detik
Q. Which is a valid way to parse a String as an int?
Pilihan jawaban
int intVar1 = (int)"100";
Pertanyaan 50 30 detik
Q. A double with the value of 20.5 is cast to an int. What is the value of the int?
Pilihan jawaban
21
25
20 (*)
20.5
Pertanyaan 51 30 detik
Q. A short data type can be promoted to which of the following types?
(Choose all correct answers)
Pilihan jawaban
boolean
byte
long (*)
double (*)
int (*)
Pertanyaan 52 30 detik
Q. When the result of an expression is assigned to a temporary memory location, what is the size of
memory allocated?
Pilihan jawaban
The size of the smallest data type used in the expression.
The size of the largest data type used in the expression. (*)
Pertanyaan 53 30 detik
Q. Double quotes may be used with char literal values.
Pilihan jawaban
True
False(*)
Pertanyaan 54 30 detik
Q. An Object cannot have String objects as properties.
Pilihan jawaban
True
False (*)
Pertanyaan 55 30 detik
Q. What is the output?
Pilihan jawaban
Hello World
Pertanyaan 56 30 detik
Q. The print() method prints to the console and automatically creates a line.
Pilihan jawaban
True
False(*)
Pertanyaan 57 30 detik
Q. Which two statements are true about String concatenation.
Pilihan jawaban
String concatenation cannot be done with numbers.
String concatenation can be done with String variables and String Literals. (*)
String concatenation cannot be done with more than two String Literals.
Pertanyaan 58 30 detik
Q. These two code fragments perform the same task.
Pilihan jawaban
True (*)
False
Pertanyaan 59 30 detik
Q. System.in readies Scanner to collect input from the console.
Pilihan jawaban
True (*)
False
Pertanyaan 60 30 detik
Q. It's best-practice to close the Scanner stream when finished
Pilihan jawaban
True (*)
False
Pertanyaan 61 30 detik
Q. A String can be created by combining multiple String Literals.
Pilihan jawaban
True (*)
False
Pertanyaan 62 30 detik
Q. The Java compiler automatically promotes byte, short, and chars data type values to int data type.
Pilihan jawaban
True (*)
False
Pertanyaan 63 30 detik
Q. What is parsing?
Pilihan jawaban
Converting numeric data to a specified numeric data type
Pertanyaan 64 30 detik
Q. Automatic promotion from smaller data type to a larger data type is not allowed in Java.
Pilihan jawaban
True
False (*)
Pertanyaan 65 30 detik
Q. Given the expression:
message
String message
Pertanyaan 66 30 detik
Q. Which is the correct declaration for a char data type?
Pilihan jawaban
char size = ’M’; (*)
Pertanyaan 67 30 detik
Q. char is the primitive textual data type in Java.
Pilihan jawaban
True (*)
False
Pertanyaan 68 30 detik
Q. In Java, char is a primitive data type, while String is an object data type.
Pilihan jawaban
True (*)
False
Pertanyaan 69 30 detik
Q. Which two statements are true about the Scanner class?
Pilihan jawaban
A Scanner object doesn’t have fields and methods.
Pertanyaan 70 30 detik
Q. You write a statement that assigns a value to a String variable as shown below.
Pilihan jawaban
True (*)
False
Pertanyaan 71 30 detik
Q. Given the import statement:
import java.awt.font.TextLayout;
Pilihan jawaban
java.awt.font (*)
java.awt
java
awt.font
Pertanyaan 72 30 detik
Q. The classes of the Java class library are organized into packages.
Pilihan jawaban
True (*)
False
Pertanyaan 73 30 detik
Q. The JFrame and JOptionPane classes are in the javax.swing package. Which two will import those
classes?
Pilihan jawaban
import javax.swing.*; (*)
import javax.swing.J*;
import javax.swing;
Pertanyaan 74 30 detik
Q. Which statement is true about packages?
Pilihan jawaban
A package makes it difficult to locate the related classes.
Pertanyaan 75 30 detik
Q. Which of the following wild card character is used to import all the classes in a particular package?
Pilihan jawaban
;
* (*)
Pertanyaan 76 30 detik
Q. Import statements are placed above the class definition.
Pilihan jawaban
True (*)
False
Pertanyaan 77 30 detik
Q. Which package is implicitly imported?
Pilihan jawaban
java.lang (*)
java.math
java.awt
java.io
Pertanyaan 78 30 detik
Q. Which of the following are the arguments in the following method?
Pilihan jawaban
emp.calculateSalary(100000, 3.2, 15);
emp
100000, 3.2, 15
Pertanyaan 79 30 detik
Q. How many arguments does the following method accept?
Pilihan jawaban
1
3 (*)
Pertanyaan 80 30 detik
Q. Object instantiation is done using what keyword?
Pilihan jawaban
void
instance
System
New (*)
Pertanyaan 81 30 detik
Q. Which of the following statements are true?
(Choose all correct answers)
Pilihan jawaban
Methods cannot be written with parameters.
Parameter values can never be used within the method code block.
Parameter values can be used within the method code block. (*)
Pertanyaan 82 30 detik
Q. void type methods don’t return any values
Pilihan jawaban
True (*)
False
Pertanyaan 83 30 detik
Q. 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.
Pilihan jawaban
True
False (*)
Pertanyaan 84 30 detik
Q. In Java, methods usually hold the properties of an object.
Pilihan jawaban
True
False (*)
Pertanyaan 85 30 detik
Q. Which of the following scenarios would be ideal for writing a method?
Pilihan jawaban
When you don’t find similar lines of code to describe an object’s behavior.
When you don’t want to repeat similar lines of code to describe an object’s behavior. (*)
Pertanyaan 86 30 detik
Q. Which two are valid import statements of the Scanner class?
Pilihan jawaban
import java.util.*; (*)
import java.util;
import java.*;
Pertanyaan 87 30 detik
Q. The import statement consists of two parts.
import package.className;
Pilihan jawaban
True (*)
False
Pertanyaan 88 30 detik
Q. Which is a valid way of calling the testMethod in the TestClass? Assume a testInstance has been
created.
System.out.println(x/y);
Pilihan jawaban
testInstance.testMethod(10);
testInstance.testMethod(3.5, 10);
testInstance.testMethod(3.5);
Pertanyaan 89 30 detik
Q. Once an object is instantiated, how might its fields and methods be accessed in Java?
Pilihan jawaban
Using the double-colon(::) operator
Pertanyaan 90 30 detik
Q. An argument is a value that's passed during a method call
Pilihan jawaban
True (*)
False
Pertanyaan 91 30 detik
Q. Methods allow all instance of a class to share same behaviors.
Pilihan jawaban
True (*)
False
Pertanyaan 92 30 detik
Q. You need to generate random integer values between 0 and 80 (inclusive). Which statement should
you use?
Pilihan jawaban
nextInt(0-79);
nextInt(80);
nextInt();
nextInt(81); (*)
Pertanyaan 93 30 detik
Q. Which values are returned by the method nextBoolean();
Pilihan jawaban
Returns the next value.
Nothing is returned.
An integer value.
Pertanyaan 94 30 detik
Q. Using the Random class requires an import statement.
Pilihan jawaban
True (*)
False
Pertanyaan 95 30 detik
Q. Which class is used to generate random numbers?
Pilihan jawaban
Number
Integer
Double
Random (*)
Pertanyaan 96 30 detik
Q. Which two are the features of the Math class?
Pilihan jawaban
The Math methods can be invoked without creating an instance of a Math object. (*)
Common math functions like square root are taken care of in the language. (*)
You don’t have to worry about the data type returned from a Math method.
Pertanyaan 97 30 detik
Q. What is the package name which contains Math class?
Pilihan jawaban
java.awt
java.lang (*)
java.net
java.io
Pertanyaan 98 30 detik
Q. What is the approximate value of PI?
Pilihan jawaban
2.718
3.141 (*)
Pertanyaan 99 30 detik
Q. Which is NOT true?
Pilihan jawaban
Static methods must be of return void. (*)
Java World!
JavA World!
False
rld! (*)
ld!
rld
Java World! 8
Java World! + 8
Java World!8 (*)
World
JavaWorld (*)
Java
False
False
False
False
Pertanyaan 109 30 detik
Q. The replaceFirst() method replaces only the first occurrence of matching character pattern in a string.
Pilihan jawaban
True (*)
False
findLength ()
length()(*)
compareTo()
False
r.nextInt(9) + 2;
Pilihan jawaban
True (*)
False
False
boolean
float
String (*)
Vowels
Consonants (*)
Vowels
Failed
~=
Java Programming
False
True (*)
Bob is 50
Bob is 43 (*)
No output
False
Pertanyaan 122 30 detik
Q. Which three are conditional statements?
Pilihan jawaban
for loop
do while loop
if statement (*)
Pilihan jawaban
Variables (*)
Errors
Operators (*)
Loops
False
If both the first condition and second condition are true (*)
Pilihan jawaban
When rewardPoints is more than 2000 or purchase greater than 1000
Compilation error
% (*)
&&
||
int rating;
int experience;
Pilihan jawaban
5 experience and 1 rating
0/1
true/false (*)
== (*)
>=
False
False (*)
if (grade == 'A') {
System.out.println("Excellent performer");
System.out.println("Good Performer");
System.out.println("Average Performer");
}else {
Pilihan jawaban
Not a Good Performer
Excellent performer
Below Performer
Pilihan jawaban
float
String (*)
boolean
int (*)