NEW
Font size
WorksheetsJava Programming Quiz #1
Total questions: 10
Worksheet time: 5mins
Which of the following is a comment in the Java language?
/ comment /
/* comment */
/ comment */
<-- comment -->
Which of the following is the correct main() method signature in Java?
public static void main (String [] args)
public static void Main (String [] args)
public static void main (string [] args)
public static void main (String args)
Which of the following is a valid variable declaration in Java?
int 1myInteger = 0;
int int = 0;
Int my Integer = 0;
int myInteger = 0;
Which Java data type is used to store 64-bit floating-point numbers?
int
long
float
double
The import statement used in Java to access the Scanner class is:
import java.Scanner;
import java.util.Scanner;
import java.package.Scanner
import.java.util.Scanner;
To output the square root of 25 in Java using the Math static class, the correct code would be:
Math(25 / 2)
Math(25 % 2)
Math.sqrt(25)
new Math.sqrt(25)
What is the problem with this code?
Line 1: String myName = "Mary Jacobson";
Line 2: System.out.println ("My name is " + myname);
Line 2: should be System.out.println ("My name is myName");
Line 2: should be System.out.println ("My name is " ) + myName;
Line 2: should be System.out.display("My name is " + myname);
There is no problem with the code
What is pseudocode?
A simple java-like programming language
Statements in plain English
A control structure used in Java
A java class
What is a class in object-oriented programming?
A class is a template with data and methods
A class is a package
A class is the declared object in memory
A class is a reference object in memory
Which of the following is a reserved word in Java?
export
import
input
output
