Ultimate Quiz On Java Skills! Trivia

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Maverick_virgo
M
Maverick_virgo
Community Contributor
Quizzes Created: 1 | Total Attempts: 14,524
| Attempts: 14,524 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Which of the following group consists of only Object-Oriented languages?

Explanation

The group consisting of C++, JAVA, and C# consists of only Object-Oriented languages. C++ is a general-purpose programming language that supports both procedural and object-oriented programming paradigms. JAVA is a widely used object-oriented programming language known for its platform independence. C# is a modern, general-purpose, object-oriented programming language developed by Microsoft. All three languages have features and syntax that support object-oriented programming concepts such as encapsulation, inheritance, and polymorphism.

Submit
Please wait...
About This Quiz
Ultimate Quiz On Java Skills! Trivia - Quiz

Dive into the 'Ultimate Quiz on Java Skills! Trivia' to assess and enhance your understanding of Java as both a programming language and a platform. This quiz covers... see morefundamental concepts, syntax, and code analysis to ensure a robust grasp of Java essentials, making it ideal for learners and professionals. see less

2. The package __________ is automatically imported in every java program.

Explanation

In every Java program, the package "java.lang" is automatically imported. This package contains fundamental classes and interfaces that are essential for any Java program to run. The wildcard character "*" indicates that all classes and interfaces within the "java.lang" package are imported. Therefore, the correct answer is "java.lang, java.lang.*, java.lang.*".

Submit
3. How will you describe Java?

Explanation

Java acts both as a programming language as well as a platform for several applications.

Submit
4. Java Is Structured Programming Language.

Explanation

Java is Object Oriented Programming Language.

Submit
5. What will be the output of the following code segment?

String one="one";
String two="two";
String One=new String(one);
String Two=two;

if(one==One)
System.out.println("Java is fun!");
if(one.equals(One)==true)
System.out.println("Programming needs practice.");
if(one==Two)
System.out.println("OOP is the way!");
if(two.equals(Two)==true)
System.out.println("Explore the world of Java.");

Explanation

== operator compares the memory locations, which is never same for two different objects whereas equals() compares the contents.

Submit
6. What will be the output of the following code segment?

int a = 4, b = 8, c = -5;

System.out.println(a/b+"\n"+(++c*b--)+" "+a--*b/c--);

Explanation

The code segment first performs the division operation a/b, which results in 0. Then, it concatenates the result with the value of (++c*b--) and (a--*b/c--).

The expression (++c*b--) increments the value of c by 1 and multiplies it by b, which is 8. The post-decrement operator (b--) is then applied, reducing the value of b by 1. The result of this expression is -32.

The expression (a--*b/c--) multiplies the value of a (4) by b (7) and divides it by c (-6). The post-decrement operator (a--) is then applied, reducing the value of a by 1. The result of this expression is -7.

Therefore, the output of the code segment is 0 -32 -7.

Submit
7. What will be the output of the following code segment?

class Number{
int a;
public static void main(String ar[])
{
 a=10;
int b=20;

a=a+b;
b=a-b;
a=a-b;
System.out.println("a = "+a);
System.out.println("b = "+b);
}
}

Explanation

Non-static variable cannot be referenced from a static context. a is a non-static variable, it cannot be referenced from within main() which is static.

Submit
8. What will the function Math.ceil(-99.9) return?

Explanation

ceil() returns the smallest whole number less than or equal to the given argument. It returns a double type value.

Submit
9. What will the following code segment print?

int i;
for(i=1;i<=4;i=i+3);
System.out.println(i);

Explanation

The value will be printed only when the loop is terminated. Since it's a one-line loop so it won't repeat the printing statement. Loop terminated when i becomes 7. So 7 will be printed.

Submit
10. Which of the following are legal identifiers in Java?

Explanation

A is wrong as it starts with a digit. D is wrong as it is a keyword. Identifiers in Java must start with a letter, Dollar sign($) or an Underscore(_) and must not be a keyword.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 03, 2010
    Quiz Created by
    Maverick_virgo
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following group consists of only Object-Oriented...
The package __________ is automatically imported in every java...
How will you describe Java?
Java Is Structured Programming Language.
What will be the output of the following code segment?String...
What will be the output of the following code segment?int a = 4, b =...
What will be the output of the following code segment?class Number{int...
What will the function Math.ceil(-99.9) return?
What will the following code segment print?int i; ...
Which of the following are legal identifiers in Java?
Alert!

Advertisement