0% found this document useful (0 votes)
17 views

Java Test

Uploaded by

cssodho123
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Java Test

Uploaded by

cssodho123
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ONLY FOR JAVA LEARNERS

1. Which keyword is used to declare and initialize a constant variable .


a) Final b) constant c) const d)none.
2. What will be output of following code :

int x=2;

System.out.print(++x + x++);

a)6 b) 5 c)4 d) 7

3 . which keyword is used as a reference to current object.

a) this b) objName c) that

4. what statement is used to exit from a method that return void.

a)return b) exit c) void d) break

5. which access modifier specifies that a class is visible to all classes everywhere.

a) Public b) Private c)Default d) Protected

6. Do inner class have access to other members of the enclosing class if they are declared as private.

a)Yes b)No c) don’t konw

7. is this statement is correct : float pi=3_.1415F.

a)yes b) no

8. output ?

int x=5_2;

System.out.println(x);

a)5 b)2 c)52 d)None

9. which type of main method’s parameter are ?

a) array of String b) array of Integer c) arguments of array d) arraylist of String.

10.________ is a collection of similar types of elements which has contiguous memory location.

a)array b) linkedlist c) datatype


11. If we are creating odd number of arrays in 2D array , it is known as __________
a) 1D b) 2D c) Jagged Array
12. 123a=5; is a valid variable or not ?
a) Valid b) Invalid c)None
13. Which of the following is correct syntax of declaration:
a) int a=5.5; b) float b=5.5; c) float b=5.5f; d) b & c
14. which is correct :
a) char int = ‘A’; b) Char a= ‘A’; c) char a= ‘A’; d) b & c
15. which is correct about double:
a) double int=2.45; b) double d=3.45; c) Double b=3; d) a & b
16. The method print() and println() are methods that print some messages onto the screen. They are
defined in a standard Java class called :

a) Scanner b) System.in c) System d) none

17. They are used for storing values used in programs.

a) datatypes b) variables c) Stack d) none

18. how many numerical primitive data types are in java:

a)8 b) 4 c) 6 )2

19. An int occupies how many bytes of memory:

a) 32 b) 4 c)8 d)2

20. java keywords are written in uppercase as well as lowercase letters.

a) yes b) NO c) none

21. In String which operator for string concatenation:

a) + b) - c)&& d) ||

22. which math function use to return maximum value:

a) max() b)Max() c)min() d) a & b

23. which method is used to remove empty space between string such as” arjit singh “.

a) trim() b)space()

24. Strings are

a)mutable b)immutable c)none

25. which method is used to find length of string

a) length() b)size() c)length d) None

All the best

You might also like