Java Programming Quiz


Play this Java quiz that will help you to excel in Java certification exams, placements etc. This Java programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This Java programming test enables you to assess your knowledge of Java programming.

Take the Free Practice Test



Java MCQs

Practice Java MCQ Questions, which will help you to understand Java programming related concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

Java Quiz

Try Free Java Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

Java Quiz

1. Methods used to obtain information about an object are known as?

string methods
class methods
object method
accessor methods

2. Which of these statements are incorrect?

Assignment operators can be used only with numeric and character data type
Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms
Assignment operators run faster than their equivalent long forms
None of the mentioned

3. Which statement is true?

public void test(int x)
{
	int odd = 1;
	if(odd) /* Line 4 */
	{
		System.out.println("odd");
	}
	else
	{
		System.out.println("even");
	}
}

Compilation fails.
"odd" will always be output.
"even" will always be output.
"odd" will be output for odd values of x, and "even" for even values.

4. Which of these statements is correct?

true and false are numeric values 1 and 0
true and false are numeric values 0 and 1
true is any non zero value and false is 0
true and false are non numeric values

5. jar stands for _____________.

Java Application Runner
Java Archive
Java Archive Runner
None of these

6. Which method returns the character at the specified index?

int compareTo(Object o)
int compareTo(String anotherString)
char charAt(int index)
int compareToIgnoreCase(String str)

7. What will be the output of the program?

class Main
{
public static void main(String args[])
	{
		int array_variable [] = new int[10];
		for (int i = 0; i < 10; ++i)
		{
			array_variable[i] = i;
			System.out.print(array_variable[i] + " ");
			i++;
		}
	}
}

0 2 4 6 8
1 3 5 7 9
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10

8. Which of the following will produce an answer that is closest in value to a double, d, while not being greater than d?

(int)Math.min(d);
(int)Math.abs(d);
(int)Math.max(d);
(int)Math.floor(d);

9. Which of these classes encapsulate runtime state of an object?

Class
Runtime
System
Cache

10. Which of these coding types is used for data type characters in Java?

ASCII
ISO-LATIN-1
UNICODE
None of the mentioned

Results