Posts

Top 10 basic java quiz questions part 1 [with Explanation] | CY

1. What is the range of short data type in Java?





+
Explanation

Answer :- 3. -32768 to 32767 

short datatype ranges from -32768 to 32767. It occupies 16 bits in memory.

2.Which of these values can a boolean variable contain?





+
Explanation

Answer:- 2. True & False 

Boolean datatype contain both True and False value. 

A variable which is defined as Boolean, the value may be True or False.

3.Which one is a valid declaration of a boolean?





+
Explanation

Answer:- 3. boolean b3 = false; 

Boolean datatype can be declared as only true or false.

4.Which is a reserved word in the Java programming language?





+
Explanation

Answer:- 1. native 

 "native" is a reserved keyword in java programming language. 

It is used to modify a method declaration.

5.Which one of the following will declare an array and initialize it with five numbers?





+
Explanation

Answer:- 3. int [] a = {23,22,21,20,19};

 Here you may think option 2 is also correct answer, but let me tell you it is perfect declaration of Array but there is no initialisation.

6.What is the numerical range of a char datatype?





+
Explanation

Answer:- 4. 0 to 65535 

 char occupies 16-bits in the memory, so it ranges from 0 - 65535 ( 2 power 16)

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





+
Explanation

Answer:- 1. UNICODE 

 Unicode range is from 0 to 65536.

8.Which of the following is not OOPS concept in Java?





+
Explanation

Answer:- 3. Compilation                                In java there are 4 main java concepts, like Inheritance, Encapsulation, Polymorphism and Abstraction. 

No such word "Compilation" concepts is present in java.

9.Java is a Successor to which programming language?





+
Explanation

Answer:- 3. C++ 

Before java, C++ introduce OOPs concept. 

But java comes with more OOPs features that C++.

10.Who invented Java language?





+
Explanation

Answer:- 2. James Gosling 

James Gosling along with his team members Mike Sheridan and Patrick Naughton developed Java language. 

The name of their team was green team.

`

Post a Comment

Hey Please 👏, feel free to share your opinion 🌍
© codeYourslf. All rights reserved. Distributed by Pixabin