adplus-dvertising

Welcome to the Data Types,Variables and Arrays MCQs Page

Dive deep into the fascinating world of Data Types,Variables and Arrays with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Data Types,Variables and Arrays, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Data Types,Variables and Arrays, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Data Types,Variables and Arrays. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Data Types,Variables and Arrays. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Data Types,Variables and Arrays MCQs | Page 14 of 32

Explore more Topics under Java Programming

Q131.
Which collection class allows you to associate its elements with key values, and allows you to retrieve objects in FIFO (first-in, first-out) sequence?
Discuss
Answer: (b).java.util.LinkedHashMap
Q132.
Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization?
Discuss
Answer: (d).java.util.Hashtable
Q133.
Which is valid declaration of a float?
Discuss
Answer: (a).float f = 1F;
Q134.
What line of code should replace the missing statement to make this program compile?
/* Missing Statement ? */
public class foo 
{
    public static void main(String[]args)throws Exception 
    {
        java.io.PrintWriter out = new java.io.PrintWriter(); 
        new java.io.OutputStreamWriter(System.out,true); 
        out.println("Hello"); 
    } 
}
Discuss
Answer: (a).No statement required.
Q135.
What will be the output of the program?

public class Test 
{ 
    private static float[] f = new float[2]; 
    public static void main (String[] args) 
    {
        System.out.println("f[0] = " + f[0]); 
    } 
}
Discuss
Answer: (b).f[0] = 0.0
Q136.
What will be the output of the program?

import java.util.*; 
class H 
{
    public static void main (String[] args) 
    { 
        Object x = new Vector().elements(); 
        System.out.print((x instanceof Enumeration)+","); 
        System.out.print((x instanceof Iterator)+","); 
        System.out.print(x instanceof ListIterator); 
    } 
}
Discuss
Answer: (d).Prints: true,false,false
Q137.
What will be the output of the program?

TreeSet map = new TreeSet();
map.add("one");
map.add("two");
map.add("three");
map.add("four");
map.add("one");
Iterator it = map.iterator();
while (it.hasNext() ) 
{
    System.out.print( it.next() + " " );
}
Discuss
Answer: (c).four one three two
Q138.
What will be the output of the program?

public static void main(String[] args) 
{
    Object obj = new Object() 
    {
        public int hashCode() 
        {
            return 42;
        }
    }; 
    System.out.println(obj.hashCode()); 
}
Discuss
Answer: (a).42
Q139.
What will be the output of the program?
Note: The command line invocation:

> java Test red green blue

public class Test 
{ 
    public static void main (String[] args) 
    {
        String foo = args[1]; 
        String bar = args[2]; 
        String baz = args[3]; 
        System.out.println("baz = " + baz); /* Line 8 */
    } 
}
Discuss
Answer: (d).Runtime Exception
Q140.
What will be the output of the program?

public class Test 
{ 
    public static void main (String args[]) 
    {
        String str = NULL; 
        System.out.println(str); 
    } 
}
Discuss
Answer: (b).Compile Error

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!