Java Programming Fundamentals

Comprehensive quiz covering Java core concepts including OOP, multithreading, exceptions, JDBC, and GUI programming with AWT/Swing. Ideal for BCA, MCA, and BE students preparing for Java exams.

50 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Java is a _____ language.

  1. procedural
  2. object oriented
  3. web development
  4. event driven
Question 2 Multiple Choice (Single Answer)

Which of the following is NOT a part of JDK?

  1. Java Compiler
  2. JDBC Driver
  3. Applet Viewer
  4. Sample Codes
Question 3 Multiple Choice (Single Answer)

The _________ package is the default package included into every Java program.

  1. Java. lang
  2. Java. io
  3. Java. awt
  4. Java. applet
Question 4 Multiple Choice (Single Answer)

The Java compiler is called 'java c'.

  1. True
  2. False
Question 5 Multiple Choice (Single Answer)

Which of the following is NOT a part of Applet life cycle?

  1. paint
  2. stop
  3. start
  4. init
Question 6 Multiple Choice (Single Answer)

The _______ exception is thrown when a method is called with illegal arguments.

  1. illegal args
  2. illegal argument
  3. illegal arguments
  4. illegal arg
Question 7 Multiple Choice (Single Answer)

Rajiv wants to create a password box. He must use the _______ property so that the data is displayed in the form of symbols

  1. set Char (char)
  2. set Echo Char (char)
  3. set Char Echo (char)
  4. set Char At (char)
Question 8 Multiple Choice (Single Answer)

________ is a process which ensures that the resource will be used by only one thread at a time.

  1. Reload
  2. Synchronization
  3. Notify
  4. Refresh
Question 9 Multiple Choice (Single Answer)

The programmers of ' Softek' are in a fuss on how to create a non inheritable class, advice them to use ___ keyword

  1. Final
  2. Static
Question 10 Multiple Choice (Single Answer)

With reference to JDBC, arrange the following steps in ascending order:

  1. Create Statement 2. Execute Query 3. Get Connection 4. Register Driver
  1. 3, 4, 1, 2
  2. 4, 3, 1, 2
  3. 3, 4, 2, 1
  4. None of the above
Question 11 Multiple Choice (Single Answer)

The method '____' waits for a thread to die.

  1. join
  2. stop
  3. enumerate
  4. yield
Question 12 Multiple Choice (Single Answer)

Which of the following is NOT a member of the 'Window Listener' interface?

  1. Window Activated
  2. window Closed
  3. Window Opened
  4. Window Closing
Question 13 Multiple Choice (Single Answer)

The maximum priority of a thread is _____.

  1. 1
  2. 5
  3. 10
  4. none of the above
Question 14 Multiple Choice (Single Answer)

Exception occurs during _________.

  1. translation time
  2. compilation time
  3. run time
  4. none of the above
Question 15 Multiple Choice (Single Answer)

A J Menu Bar cannot be added directly to a ____.

  1. content pane
  2. form
  3. applet
  4. frame
Question 16 Multiple Choice (Single Answer)

If all the child threads are destroyed, the main thread will automatically be destroyed.

  1. True
  2. False
Question 17 Multiple Choice (Single Answer)

An event object implements which of the following methods?

  1. To String ()
  2. Get Source ()
  3. Get String ()
  4. None of the above
Question 18 Multiple Choice (Single Answer)

Abstract classes cannot be instantiated.

  1. True
  2. False
Question 19 Multiple Choice (Single Answer)

In Java, each integer variable occupies ________ byte(s) of memory.

  1. 2
  2. 4
  3. 6
  4. 1
Question 20 Multiple Choice (Single Answer)

The statement 'Color c = new Color (230, 260, 244)' is correct.

  1. True
  2. False
Question 21 Multiple Choice (Single Answer)

The ______ class is the super class of all the classes.

  1. base
  2. java. lang
  3. object
  4. system
Question 22 Multiple Choice (Single Answer)

________ class is used to store bit values.

  1. Byte Set
  2. Bit Sets
  3. Byte Sets
  4. Bit Set
Question 23 Multiple Choice (Single Answer)

The ____ layout stores the components in the form of a stack, one over the other.

  1. flow
  2. grid bag
  3. border
  4. card
Question 24 Multiple Choice (Single Answer)

The method 'skip ()' in java. io package takes ______ argument(s).

  1. two
  2. one
  3. four
  4. three
Question 25 Multiple Choice (Single Answer)

Assuming that 'MS-Windows' is created in Java, the 'Display' option of Control Panel must have been created using ________.

  1. Table
  2. Card Layout
  3. Tabbed Pane
  4. Scroll Pane
Question 26 Multiple Choice (Single Answer)

The method 'Read Line ()' returns ____ if no more data is available to read.

  1. 0
  2. 1
  3. -1
  4. null
Question 27 Multiple Choice (Single Answer)

The stream class 'File Input Stream' throws a/an ____ exception.

  1. IO
  2. File Not Found
  3. Class Not Found
  4. Interrupted
Question 28 Multiple Choice (Single Answer)

An applet must be a sub class of the 'Applet' class; the exception to this is J Applet.

  1. True
  2. False
Question 29 Multiple Choice (Single Answer)

The return value of the method 'execute Update (String s)' is _______.

  1. integer
  2. double
  3. record set
  4. no return value
Question 30 Multiple Choice (Single Answer)

The Mouse Listener contains ____ methods to trap mouse events.

  1. 2
  2. 4
  3. 6
  4. 5
Question 31 Multiple Choice (Single Answer)

To count the number of items in a List Box, the ____ method can be used.

  1. Get Count ()
  2. Get Items Count
  3. Items.Count ()
  4. Get Item Count ()
Question 32 Multiple Choice (Single Answer)

To partially implement an Interface, we can use an abstract keyword.

  1. True
  2. False
Question 33 Multiple Choice (Single Answer)

Observe the following statement (commas are used to separate the parts that are not a part of the standard code): <APPLET, class= no error , height= 200 , width= 300 ></applet>
Which part has an error?

  1. Part 1
  2. Part 2
  3. Part 3
  4. No Error
Question 34 Multiple Choice (Single Answer)

______ is the process of creating multiple methods with the same name.

  1. Overriding
  2. Multi threading
  3. Overloading
  4. Copying
Question 35 Multiple Choice (Single Answer)

The method 'region Matches' can take a maximum of ___ arguments.

  1. 2
  2. 5
  3. 4
  4. 7
Question 36 Multiple Choice (Single Answer)

The method ______ is used to determine whether a Text Field can accept modifications or not.

  1. allows Edit ()
  2. allows Write()
  3. is Writable ()
  4. is Editable ()
Question 37 Multiple Choice (Single Answer)

Which of the following is NOT a method of the 'Linked List' class?

  1. Add First ()
  2. Remove Last ()
  3. Remove At ()
  4. Add Last ()
Question 38 Multiple Choice (Single Answer)

All controls generate events except ____, which is a passive control.

  1. label
  2. check box group
  3. radio button
  4. scrollbar
Question 39 Multiple Choice (Single Answer)

Menu is a subclass of

  1. menu bar
  2. main menu
  3. menu list
  4. none of the above
Question 40 Multiple Choice (Single Answer)

To increase/decrease the space between a component and the container window, the ___ method can be called.

  1. Insets (int, int, int, int)
  2. Insets (int, int, int)
  3. Insets (int, int)
  4. Insets (int)
Question 41 Multiple Choice (Single Answer)

The keyword 'extends' is followed by a/an ____ name.

  1. interface
  2. child class
  3. base class
  4. listener
Question 42 Multiple Choice (Single Answer)

The _______ constructor displays the current date.

  1. Day ()
  2. Today ()
  3. Date ()
  4. Now ()
Question 43 Multiple Choice (Single Answer)

The method '_______' searches for the first occurrence of a character or substring.

  1. Index Of
  2. Search
  3. Find
  4. Locate
Question 44 Multiple Choice (Single Answer)

_____ is used to generate a series of elements one at a time.

  1. Vector
  2. Hash Table
  3. Stack
  4. Enumeration
Question 45 Multiple Choice (Single Answer)

To create a JT able, we must also create a ______.

  1. J Scroll Pane
  2. J Image Icon
  3. Content Pane
  4. None of the above
Question 46 Multiple Choice (Single Answer)

_____ is the simplest concrete subclass of 'container'.

  1. Scroll Pane
  2. Panel
  3. List
  4. Menu
Question 47 Multiple Choice (Single Answer)

Each Java program has one thread, which is the ______ thread.

  1. calling
  2. called
  3. main
  4. child
Question 48 Multiple Choice (Single Answer)

The first argument of the method 'drawstring ()' is of _____ type.

  1. character
  2. Boolean
  3. Integer
  4. String
Question 49 Multiple Choice (Single Answer)

In Java, to call the constructor of the base class from the child class, constructor use the ______ call.

  1. base ()
  2. parent ()
  3. super ()
  4. none of the above
Question 50 Multiple Choice (Single Answer)

Bill Gates wants your help in correcting the following error. Suggest the correct solution:
Statement -System. out. Print ln (s. sub Str (1,2));
Error - cannot resolve symbol method sub Str (int, int)

  1. Use sub string
  2. Use one argument
  3. Use sub str
  4. Use two arguments