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

MCQS On Java Fundamentals 11 - 02 - 2022

This document contains 50 multiple choice questions about Java programming concepts. The questions cover topics like Java syntax, object-oriented programming principles, data types, arrays, inheritance, interfaces, exceptions, JDBC, JNDI, JMS and more. The correct answers to each question are also provided.

Uploaded by

chandra sekhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views

MCQS On Java Fundamentals 11 - 02 - 2022

This document contains 50 multiple choice questions about Java programming concepts. The questions cover topics like Java syntax, object-oriented programming principles, data types, arrays, inheritance, interfaces, exceptions, JDBC, JNDI, JMS and more. The correct answers to each question are also provided.

Uploaded by

chandra sekhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1. Confirm the correct syntax for the while loop.

a)while(Boolean_expression) { //Statements }
b)while//loop//
c)loop//while//
d)<while>
ANS: a

2. Why do users use JAVA?


a)It permits the user to use online applications
b)To chat with people around the world
c)To calculate mortgage interest in Java
d)All of the above

ANS:a

3. The JAVA language is designed around the ideologies of which of the

following?
a)C language
b)Object-oriented programming
c)CSS
d)PHP

ANS:b

4. Select an operator required to assign memory to array variable in

Java.
a)allocate
b)alloc_mem
c)new
d)new malloc

ANS:c

5. Select a Data type which is NOT considered as an Object in a)

JavaScript.
b)array
c)date
d)null
e)NaN
ANS:e

6. Select the correct feature of Java.


a)Multithreaded
b)Editable
c)Portable
d)A and C

ANS:d

7. During initialization of an array which option has to be specified?


a)Row
b)Column
c)and B
d)dTable

ANS:c

8. Confirm the numerical range of a char in Java?


a)32767 to -32768
b)0 to 25668
c)0 to 32767
d)0 to 65535
ANS:c

9. What does JVM stand for?


a)Java variable meter
b)Java variable method
c)Java virtual machine
d)Java vertical machine
ANS:c

10. Name the values that comprises Boolean variable.


a)True and False
b)0 & 1
c)Any integer value
d)A and B
ANS:a
11. Select the valid Boolean statement.
a)boolean = 1;
b)boolean e2:'false';
c)boolean e3 = false;
d)boolean e4 = 'true'
ANS:c
12. Name the source file generated by the JVM after assembling the

Java source code?


a).class
b).java
c).cdr
d).doc
ANS:b
13. By using 'Just-In-Time' compilers to execute the code, Java

empowers high enactment.


a)TRUE
b)FALSE
ANS:a

14. In the given options, 'pow()' is related to which class?


a)Math class
b)Input stream class
c)Object class
d)None of the above

ANS:a

15. How are Session beans produced?


a)By the server
b)By the client while submitting the query to the database
c)Both of the above
d)None of the above

ANS:a

16. Java synchronized program will simply be performed by a single

thread at a period.
TRUE
FALSE
ANS:a

17. x=x+1 is comparable to which one of the given choices in Java?


a)++x
b)x++
c)x=x-1
ANS:a
18. Why is Synchronization required in Java?
a)Synchronization guarantees mutual access of collective resource and
also prevents data
b)Synchronization checks restructuring of code statement, which can
c)cause delicate concurrent issues
d)Synchronization removes memory discrepancy faults
All of the above
ANS:e

19. How does 'Runnable' statement work using multiple threads?


a)Shares same object instance
b)Loops
c)Multi and different objects
d)Operators
ANS:d

20. Select the Java code editor.


a)Notepad
b)Netbeans
c)Eclipse
d)All of the above

ANS:d

21. If method carries the same name as class name and method doesn't

have any return type, then it is known as.......?


a)Destructors
b)Object
c)Variable
d)Constructor
ANS:d

22. The applet engine is a program used for?


a)Executing applets
b)Simulated machine
c)JVM
d)None of above

ANS:a

23. Choose the methods that have identical names but diverse parameter
list ?
a)Overriding
b)Constructor
c)Overloading
d)None of these

ANS:d

24. Explain a program in a single word that describes the stages

necessary to instantiate one object of that program?


a)A destructor
b)An instantiator
c)A constructor
d)All of the above

ANS:d

25. How do users associate enum categories?


a)Equals() method
b)A and C
c)Arithmetic comparator '=='
d)None of the above

ANS:b

26. Confirm the variable statements that are prohibited in Java.


a)Double[] myVar = {1.0,2.0,2.5,2.7};
b)List<int> myVar;
c)float myVar = 5.7f;
d)List<HashMap<String,Integer>> myVar;

ANS:b
27. Using which technique can users sort a group by normal order of

its elements in Java?


a)Sort.sort
b)CollectionsUtils.sortCollection
c)Collection.sort
d)Collections.sort

ANS:d

28. Is it possible to produce zero dimension arrays in Java?


a)Yes, with arrays of object reference
b)Yes, user can produce arrays of any type with dimension zero
c)No, zero length array cannot be generated.
d)No, arrays of length zero do not exist

ANS:b
29. Why do Java programs need a method called main()?
a)To execute the program
b)A and C
c)To compile the program
d)None of these

ANS:d

30. What is the difference between Vector and ArrayList?


a)Vector is synchronized, whereas ArrayList works on multithreaded
environment
b)ArrayList grows by 50% of its actual size whereas Vector by default
doubles the size everytime it grows
c)ArrayList produces better results whereas Vector gives a poor
performance due to its single threaded environment.
d)All of the above

ANS:d
31. Java permits the users to include two types of variables, name
them.
a)Primitive
b)Reference
c)A and B
d)Strings

ANS:d

32. Select the statement that defines that Java is a Robust language.
a)Java styles remove error prone conditions by highlighting it while
compiling
b)Java styles remove error prone conditions by highlighting it while
runtime checking.
c)A and B
d)Data retrieval is easy

ANS:d

33. Select a method that references the source of an object.


a)toString()
b)toSource()
c)to code()
d)All of the above
ANS:d

34. What is the function called, when a subclass implements a


technique that is previously provided by a superclass.
a)Method overdriving
b)Object orientation overdriven
c)Method overloading
d)Method overriding
ANS:d

35. Select the features of Java.


a)Object Oriented
b)Platform independent
c)Portable
ANS:a

36. Select the correct statement that defines Java.


a)Java is assured to be Write Once, Run Anywhere.
b)Methods can be used with classes
c)Inherited classes are editable
d)All of the above

ANS:d

37. An interface in Java may contain ....... only.


a)fields
b)constructors
c)additional pylons
d)abstract methods
ANS:d
38. Can a Java interface have member variables?
a)Yes, till the time they are public, static and final.
b)No
c)Yes, with methods only
d)Yes, using strings

ANS:d
39. What is the function described below known as: public class Foo{

private static Foo instance; private Foo(){ } private static

getInstance(){ if (instance == null){ instance = new Foo(); } return

instance; }
a)The Factory pattern
b)The Observer pattern
c)The Flyweight pattern
d)The Singleton pattern

ANS:d

40. Which of the subsequent JNDI properties delivers safety data?


a)java.naming.security.authentication
b)java.naming.security.credential
c)java.naming.security.principal
d)All of these

ANS:d

41. Confirm the syntax for making a class derived from the class named

MyClass.
a)class MyDerived extends MyClass
b)class MyDerived implements MyClass
c)public class MyDerived : MyClass
d)None of the above

ANS:d

42. What would be an output of a program if the main() is not

stagnant?
a)Program would not be functioning
b)Program would throw the js errors
c)Program would be compiled
d)Program would present the final string

ANS:d

43. Confirm the correct statement from the given options.


a)a class can get multiple abstract superclass
b)a class can get numerous superclass
c)a class can implement multiple interfaces
d)a class can get numerous strings

ANS:b

44. Using which keyword can a user describe packages in Java?


a)package
b)Pkg
c)pkg
d)pack
ANS:c

45. What are the fundamental JMS-related entities required for each

JMS-enabled request?
a)Within a session, the suitable publisher, receiver or subscriber
substances
b)Within a session, delivering a contest for message transfer
c)A&D
d)A connection object delivered by the JMS servers

ANS:c

46. What does inheritance stand for in Java?


a)Sub class extends super class
b)Sub class extends base class
c)Sub class creates object of super class
d)All of the above

ANS:d

47. Name the method which performs only once.


a)start() method
b)init() method
c)stop() method
d)destroy() method

ANS:c

48. What type of exception can occur in Java?


a)Database not connected
b)Information is not in proper format
c)Null object
d)All the above
ANS:d
49. The class java.sql.Timestamp is associated with which class?
a)java.util.Timer
b)java.sql.Time
c)java.util.Date
d)None of above
ANS:b

50. What object in Java can accumulate group of other objects?


a)Collection object
b)Java object
c)Package
d)Wrapper

ANS:d

You might also like