menu

Java Basics

Java Basics - Important Points


1.

What is Java?

A. A programming language

B. An operating system

C. A database management system

D. A web browser

Discuss Work Space

Answer: option a

Explanation:

Java is a programming language that is used to develop applications for a variety of platforms.


2. Which of the following is NOT a primitive data type in Java?

A. int

B. boolean

C. double

D. string

Discuss Work Space

Answer: option d

Explanation:

String is not a primitive data type in JavIt is a class that is used to represent a sequence of characters.

3. Which keyword is used to declare a variable in Java?

A. var

B. let

C. int

D. def

Discuss Work Space

Answer: option c

Explanation:

The keyword 'int' is used to declare a variable of type integer in Java.

4.

What is the output of the following code?

public class Test {
public static void main(String args[]) {
int x = 5;
System.out.println(x++);
 }
}

A. 4

B. 5

C. 6

D. 7

Discuss Work Space

Answer: option b

Explanation:

The value of x is 5, and the post-increment operator (++) increments it after the value is printed.


5.

What is the output of the following code?

public class Test {
public static void main(String args[]) {
System.out.println("Hello" + " World");
}

A. Hello

B. World

C. Hello World

D. HelloWorld

Discuss Work Space

Answer: option c

Explanation:

The + operator is used for concatenation in JavThe output is the concatenation of the two strings.



Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now