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 5 of 32

Q41.
What is the output of this program?
    class conversion 
    {
        public static void main(String args[]) 
        {
            double a = 295.04;
            int  b = 300;
            byte c = (byte) a;
            byte d = (byte) b;
            System.out.println(c + " "  + d);
        } 
    }
Discuss
Answer: (b).39 44
Q42.
Which of these operators is used to allocate memory to array variable in Java?
Discuss
Answer: (c).new
Discuss
Answer: (d).int arr[] = int [5] new
Q44.
What will this code print?
    int arr[] = new int [5];
    System.out.print(arr);
Discuss
Answer: (d).Class name@ hashcode in hexadecimal form
Discuss
Answer: (a).It is necessary to use new operator to initialize an array
Q46.
Which of these is necessary to specify at time of array initialization?
Discuss
Answer: (a).Row
Q47.
What is the output of this program?
    class array_output 
    {
        public static void main(String args[]) 
        {
            int array_variable [] = new int[10];
     for (int i = 0; i < 10; ++i) 
            {
                array_variable[i] = i;
                System.out.print(array_variable[i] + " ");
                i++;
            }
        } 
    }
Discuss
Answer: (a).0 2 4 6 8
Q48.
What is the output of this program?
    class multidimention_array 
    {
        public static void main(String args[])
        {
            int arr[][] = new int[3][];
            arr[0] = new int[1];
            arr[1] = new int[2];
            arr[2] = new int[3];               
     int sum = 0;
     for (int i = 0; i < 3; ++i) 
         for (int j = 0; j < i + 1; ++j)
                    arr[i][j] = j + 1;
     for (int i = 0; i < 3; ++i) 
         for (int j = 0; j < i + 1; ++j)
                    sum + = arr[i][j];
     System.out.print(sum);  
        } 
    }
Discuss
Answer: (b).10
Discuss
Answer: (c).‘b’ is int variable; ‘d’ is int array
Q50.
What will this code print?
int arr[] = new int [5];
System.out.print(arr);
Discuss
Answer: (d).Garbage value
Page 5 of 32

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!