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

Explore more Topics under Java Programming

Q161.
Default value of variable having boolean data type is ___________.
Discuss
Answer: (b).FALSE
Q162.
What will be the output of the program?
class Main {  
   public static void main(String args[]) {    
         int t; 
         System.out.println(t);
    } 
}
Discuss
Answer: (c).compiler error
Q163.
What will be the output of the program?
class Test { 
    public static void main(String[] args) {
      for(int i = 0; 0; i++) 
      {
          System.out.println(""Hello"");
          break; 
      } 
    } 
}
Discuss
Answer: (c).Compiler error
Q164.
What will be the output of the program?
class mainclass {
    public static void main(String args[])
    {
      boolean var1 = true;
      boolean var2 = false;
      if (var1)
         System.out.println(var1);
      else
         System.out.println(var2);
    } 
}
Discuss
Answer: (c).TRUE
Q165.
Predict the output of the following program.
class CSE {
    public static void main(String[] args)
    {
        Double object = new Double("2.4");
        int a = object.intValue();
        byte b = object.byteValue();
        float d = object.floatValue();
        double c = object.doubleValue();
        System.out.println(a + b + c + d );
 
    }
}
Discuss
Answer: (c).8.800000095
Q166.
Which of the following are legal lines of Java code?

1. int w = (int)888.8;
2. byte x = (byte)100L;
3. long y = (byte)100;
4. byte z = (byte)100L;
Discuss
Answer: (d).All statements are correct
Q167.
What is the output of this program?
class average {
        public static void main(String args[])
        {
            double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
            double result;
            result = 0;
            for (int i = 0; i<6; ++i) 
                result = result + num[i];
      System.out.print(result/6);
 
        } 
}
Discuss
Answer: (c).16.46666667
Q168.
What is the output of this program?
class output {
        public static void main(String args[]) 
        {
            double a, b,c;
            a = 4.0/0;
            b = 0/3.0;
            c=0/0.0;
 
      System.out.println(a);
            System.out.println(b);
            System.out.println(c);
        } 
}
Discuss
Answer: (d).all of the mentioned
Q169.
What will be the output of the program?
class increment {
        public static void main(String args[]) 
        {      
             int g = 4;
             System.out.print(++g * 8);
        }
}
Discuss
Answer: (c).40
Q170.
What will be the output of the program?
class area {
        public static void main(String args[]) 
        {   
             double r, pi, a;
             r = 9.8;
             pi = 3.14;
             a = pi * r * r;
             System.out.println(a);
        } 
}
Discuss
Answer: (a).301.5656

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!