Advanced Java

Advanced Java concepts including I/O streams, multithreading, exception handling, AWT/Swing, and JavaBeans APIs

25 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following methods of Observable class returns the true value if the invoking object is modified and false if it is not?

  1. countObservers()
  2. deleteObserver()
  3. hasChanged()
  4. setChanged()
  5. addObserver()
Question 2 Multiple Choice (Single Answer)

Which of the following interfaces in java.beans package allows designers to change and display property value?

  1. DesignMode
  2. PropertyChangeListener
  3. PropertyEditor
  4. Visibility
  5. BeanInfo
Question 3 Multiple Choice (Single Answer)

Which of the following statements regarding the packages is correct in Java?

  1. Packages contain a single package statement.
  2. Packages can contain any number of import statements.
  3. Packages contain a single public class consisting of main() function declaration.
  4. Packages contain any number of classes private to the package.
  5. Packages can contain any number of package declarations.
Question 4 Multiple Choice (Single Answer)

Which of the following methods of Thread class waits for a thread to terminate?

  1. isAlive()
  2. join()
  3. run()
  4. sleep()
  5. start()
Question 5 Multiple Choice (Single Answer)

Which of the following Exception classes is used to deal with an exception of an attempt to violate the security?

  1. NullPointerException
  2. ClassNotFoundException
  3. IllegalAccessException
  4. InterruptedException
  5. SecurityException
Question 6 Multiple Choice (Single Answer)

Which of the following methods of Throwable class sends the stack trace to the specified stream?

  1. printStackTrace()
  2. fillInStackTrace()
  3. printStackTrace(PrintStream stream)
  4. toString()
  5. getLocalizedMessage()
Question 7 Multiple Choice (Single Answer)

Which of the following Exception classes is used when a requested operation is not compatible with the current thread state?

  1. ArithmeticException
  2. IllegalStateException
  3. IllegalThreadStateException
  4. ArrayStoreException
  5. NegativeArraySizeException
Question 8 Multiple Choice (Single Answer)

Which of the following exceptions is thrown when one thread has been interrupted by another thread?

  1. ClassNotFoundException
  2. IllegalAccessException
  3. InstantiationException
  4. InterruptedException
  5. NoSuchFieldException
Question 9 Multiple Choice (Single Answer)

Which of the following methods in Applet programming is used to extract the name part of an item from the class and return it?

  1. stop()
  2. getName()
  3. accept()
  4. chat()
  5. move()
Question 10 Multiple Choice (Single Answer)

Which of the following classes in Java contains swing version of an applet?

  1. JButton
  2. JCheckBox
  3. JApplet
  4. AbstractButton
  5. JLabel
Question 11 Multiple Choice (Single Answer)

Which of the following adjustment events of scroll bar is used to generate an absolute event?

  1. BLOCK_DECREMENT
  2. BLOCK_INCREMENT
  3. TRACK
  4. UNIT_DECREMENT
  5. UNIT_INCREMENT
Question 12 Multiple Choice (Single Answer)

Which of the following align arguments is not available in Java to be used in SwingConstants interface?

  1. Left
  2. Right
  3. Middle
  4. Leading
  5. Trailing
Question 13 Multiple Choice (Single Answer)

Which of the following methods of Process class in Java returns an input stream that reads input from the process out?

  1. destroy()
  2. getInputStream()
  3. getErrorStream()
  4. getOutputStream()
  5. exitValue()
Question 14 Multiple Choice (Single Answer)

Which of the following character methods in Java returns true value, when an argument provided with a function is in uppercase?

  1. isUpperCase()
  2. toUpperCase()
  3. toLowerCase()
  4. toTitleCase()
  5. isLetter()
Question 15 Multiple Choice (Single Answer)

Which of the following ByteStream classes contains methods for reading Java standard data types?

  1. DataInputStream
  2. DataOutputStream
  3. FileInputStream
  4. FileOutputStream
  5. BufferedInputStream
Question 16 Multiple Choice (Single Answer)

Which of the following methods in OutputStream class finalizes the output state so that the buffers are cleared?

  1. close()
  2. write()
  3. flush()
  4. reset()
  5. read()
Question 17 Multiple Choice (Single Answer)

Which of the following stream classes is an implementation of the output stream that uses a byte array as its destination?

  1. ByteArrayInputStream
  2. ByteArrayOutputStream
  3. FilteredByteStreams
  4. FileOutputStream
  5. None of these
Question 18 Multiple Choice (Single Answer)

Which of the following methods of Reader class returns true, if the next input request does not wait, otherwise returns false?

  1. mark()
  2. read()
  3. ready()
  4. reset()
  5. skip()
Question 19 Multiple Choice (Single Answer)

Which of the following instances of a class defined in java.beans package describes a method of a bean?

  1. MethodDescriptor
  2. ParameterDescriptor
  3. FeatureDescriptor
  4. BeanDescriptor
  5. PropertyDescriptor
Question 20 Multiple Choice (Single Answer)

Which of the following methods of File class removes the file associated with the invoking object, when the Java Virtual Machine terminates?

  1. isHidden()
  2. deleteOnExit()
  3. setReadOnly()
  4. accept()
  5. listFiles()
Question 21 Multiple Choice (Single Answer)

Which of the following methods is used in Java to suspend a thread for a period of time?

  1. isAlive()
  2. run()
  3. sleep()
  4. start()
  5. join()
Question 22 Multiple Choice (Single Answer)

Which of the following methods of DataInputStream class is used to read a unicode character?

  1. readByte()
  2. readChar()
  3. readInt()
  4. readBoolean()
  5. writeInt()
Question 23 Multiple Choice (Single Answer)

Which of the following methods of Vector class is used to return the index of the last occurrence of an element?

  1. isEmpty()
  2. lastElement()
  3. lastIndexOf()
  4. removeAllElements()
  5. size()
Question 24 Multiple Choice (Single Answer)

Which of the following methods is used in Java to wake up all the threads that called wait in the same object?

  1. wait()
  2. notify()
  3. notifyAll()
  4. start()
  5. sleep()
Question 25 Multiple Choice (Single Answer)

Which of the following stream classes in ByteStream is a combination of two or more input streams that will be read sequentially?

  1. PrintStream
  2. RandomAccessFile
  3. SequenceInputStream
  4. InputStreamReader
  5. OutputStream