Java Questions
Java Questions
Java Questions
3. What is an algorithm?
A complex problem
A guide that provides the high level steps to complete a task
A programming language
A coffee flavor
package
method
variable
package
method
variable
package
method
variable
4. What’s the name of the method that is invoked first when
a Java class is executed?
main
first
default
priority
mypackage
mypackage1
my_package
myClass
MyClass
myclass
7. Which of the following variable names is invalid?
name1
nameOne
1name
name_one
scanner
hours
Curly braces - {}
Parentheses - ()
Semicolon - ;
..
//
##
11. Which statement will print HELLO to the console?
print.out(“HELLO”):
System.out.println(“HELLO”);
Scanner.in(“HELLO”).
Out(“HELLO”),
To end a statement
int
nextInt
nextDouble
14. Which of the following is a data type suitable for decimal
numbers?
double
int
nextInt
nextDouble
int
double
nextString
x
17. Which operator is used to append a variable’s data to a
String?
+
18. Given you have a variable named output with a data type
of String, which of the following is a valid assignment for
this variable?
“Hello World” = String output;
bug report
runtime error
warning alert
20. Java is case-sensitive.
True
False
3. What is an if statement?
A decision structure that executes statement(s) given some condition is met
A loop
A variable
A class