Java Programming MCQ’s Questions and Answers

                                   

  1. Which of these operators is used in Java to allocate memory to array variable?
    1. Malloc
    2. New
    3. Alloc
    4. new malloc

Ans c.(new)

2.Which of these is incorrect array declaration?

  1. int arr[]     arr = new int[5]
  2. int [] arr = new int[5]
  3. int arr[] = int [5] new
  4. int arr[] = new int[5]

Ans c.(int arr[] = int [5] new)

  1. Which of these class is StringBuffer class and superclass of String?
    1. lang
    2. ArrayList
    3. util
    4. None of the mentioned

Ans a.(java.lang)

  1. Which of these method of a class String is used to extract  single character from a String object?
    1. charAt()
    2. charat()
    3. ChatAt()
    4. CHARAT()

Ans c.(CharAt)

  1. Which of these constructors is used to create empty String object?
    1. String(0)
    2. String()
    3. String(void)
    4. None of the mentioned

Ans b.(String())

  1. Which of the following can be operand of arithmetic operator?
    1. Boolean
    2. Characters
    3. Both Boolean & Characters
    4. Numeric

Ans c.( Both Boolean & Characters)

  1. Which of these can be applied to modulus operator, %?
    1. Floating – point numbers
    2. Integers
    3. Both Integers and floating – point numbers.
    4. None of the mentioned

Ans c. (Both Integers and floating – point numbers)

  1. Decrement operator, –, decreases value of variable by what number?
    1. 4
    2. 2
    3. 3
    4. 1

Ans d.(1)

  1. Which of these packages contain all the collection classes?
    1. net
    2. util
    3. awt
    4. lang

Ans b.( java.util)

  1. Which of these classes is not part of Java’s collection framework?
    1. Stack
    2. Queue
    3. Maps
    4. Array

Ans b.(Queue)

  1. Which of these interface is not a part of Java’s collection framework?
    1. SortedMap
    2. List
    3. SortedList
    4. Set

Ans c.(SortedList)

  1. Which of these method delete all the elements from invoking collection?
    1. reset()
    2. refresh()
    3. delete()
    4. clear()

Ans d.(clear())

  1. What is a Collection in Java?
    1. A group of classes
    2. A group of objects
    3. A group of interfaces
    4. None of the mentioned

Ans b.( A group of objects)

  1. Which of these keywords is used to define a interfaces in Java?
    1. Intf
    2. intf
    3. interface
    4. Interface

Ans c.( interface)

  1. Which of these can be used a class from its implementation to fully abstract?
    1. Packages
    2. Interfaces
    3. Objects
    4. None of the Mentioned

Ans b.(Interfaces)

  1. AWT stands for?
    1. All Writing Tools
    2. Abstract Writing Toolkit
    3. All Window Tool
    4. Abstract Window Toolkit

Ans d.( Abstract Window Toolkit)

  1. Which of these methods is a part of AWT (Abstract Window Toolkit)?
    1. transient()
    2. print()
    3. display()
    4. drawString()

And b. (print())

  1. Which of these is static variable defined in Collections?
    1. EMPTY_MAP
    2. EMPTY_SET
    3. EMPTY_LIST
    4. All of the mentioned

Ans d.(All of the mentioned)

  1. Which of these methods can randomize all elements in a list?
    1. randomize()
    2. rand()
    3. ambigous()
    4. shuffle()

Ans d.(shuffle())

  1. In this which keywords is not a part of exception handling?
    1. catch
    2. finally
    3. try
    4. thrown

Ans d.( thrown)

 

 

870 Total Views 2 Views Today
Previous Post
Next Post

Posted by- Team Alpha


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.