Java Basics (UGC)

Tests fundamental Java concepts including multithreading, exception handling, collections, I/O streams, and syntax

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following methods is used in multithreaded programming to determine if a thread is still running?

  1. Join
  2. isAlive
  3. Run
  4. Sleep
  5. Start
Question 2 Multiple Choice (Single Answer)

Which of the following backslash character constants is used to represent an octal character in java?

  1. ' '
  2. ' '
  3. 'DDD'
  4. n
  5. b
Question 3 Multiple Choice (Single Answer)

Which of the following types of exception classes is used to deal with assignment to an array element of an incompatible type?

  1. ArithmeticException
  2. ArrayStoreException
  3. IllegalArgumentException
  4. IllegalStateException
  5. ClassCastException
Question 4 Multiple Choice (Single Answer)

Which of the following methods of Thread class is used to obtain the priority of a thread?

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

Which of the following stream classes is an input stream that contains methods for reading the java standard data types?

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

Which of the following methods of Float class is used to return a true value if the invoking object contains an infinite value?

  1. hashCode()
  2. isNaN()
  3. isInfinite()
  4. toString()
  5. byteValue()
Question 7 Multiple Choice (Single Answer)

Which of the following values in compareTo() method of String class is used to state that the invoking string is greater than the string passed as argument?

  1. Less than zero
  2. Zero
  3. Greater than zero
  4. Not equal to zero
  5. indexOf()
Question 8 Multiple Choice (Single Answer)

Which of the following methods of ThreadGroup class is used to return the number of groups for which the invoking thread is a parent?

  1. activeCount()
  2. destroy()
  3. activeGroupCount()
  4. checkAccess()
  5. getMaxPriority()
Question 9 Multiple Choice (Single Answer)

Which of the following classes in java is used to implement a dynamic array by extending AbstractList class?

  1. AbstractSet
  2. HashSet
  3. ArrayList
  4. TreeSet
  5. LinkedList
Question 10 Multiple Choice (Single Answer)

Which of the following methods of Package class is used to return a true value if the invoking package is sealed, or otherwise it returns false?

  1. getSpecificationVersion()
  2. isSealed()
  3. getName()
  4. getImplementationTitle()
  5. isSealed(URL url)
Question 11 Multiple Choice (Single Answer)

Which of the following interfaces in java enables a user to work with groups of objects and also, it is at the top of the collection hierarchy?

  1. List
  2. Set
  3. Collection
  4. SortedSet
  5. add()
Question 12 Multiple Choice (Single Answer)

Which of the following objects is used in java to plug around the network and have a standard way of delivering the payload?

  1. Proxy servers
  2. Client/Server
  3. Socket
  4. Internet addressing
  5. DNS
Question 13 Multiple Choice (Single Answer)

Which of the following tokens is a whitespace character in java?

  1. Newline
  2. Identifier
  3. Literal
  4. Comment
  5. Operator
Question 14 Multiple Choice (Single Answer)

Which of the following separators in java is used to separate consecutive identifiers in a variable declaration?

  1. ( )
  2. { }
  3. [ ]
  4. , (Comma)
  5. ; (Semicolon)
Question 15 Multiple Choice (Single Answer)

Which of the following keywords is used in multithreaded programming to ensure that no two threads access the same object simultaneously?

  1. wait
  2. notify
  3. notifyall
  4. synchronized
  5. break