1. Question: To run a java file from command prompt we write-

    A
    java class_name

    B
    javac class_name

    C
    class_name

    D
    javac

    Note: Not available
    1. Report
  2. Question: Which of the following values can you assign to a variable of type int?

    A
    10.55

    B
    'S'

    C
    True

    D
    0

    Note: Not available
    1. Report
  3. Question: Which of the following data types can store a value in the least amount of memory?

    A
    short

    B
    long

    C
    int

    D
    byte

    Note: Not available
    1. Report
  4. Question: A Boolean value can hold the values true and false.

    A
    True

    B
    False

    Note: Not available
    1. Report
  5. Question: What will be the output of the following java program?

    class Adds{

       public static void main(String args[]){

         int x = 20;
         int y = 10;
         int z = x + y;

         System.out.println(" The addition of " + x + " and " + y + " is " + z);

      }
    }

    A
    20

    B
    10

    C
    30

    D
    40

    Note: Not available
    1. Report
  6. Question: Which one is the correct structure for declaring a method within a class?

    A
    class Hello{

     public static void amin(String args[]){

        System.out.println("Hello World !!");

     }
    }

    B
    class Hello{

         System.out.println("Hello World !!")
     
    }

    C
    class Hello{

     public static void amin{String args[]}(

        System.out.println("Hello World !!");

     )
    }

    D
    class Hello{



    }

    Note: Not available
    1. Report
  7. Question: A method must include the following -

    A
    A diclaration

    B
    An opening curly brace

    C
    A leg

    D
    A body

    E
    A closing curly brace

    Note: Not available
    1. Report
  8. Question: Which four options describe the correct default values for array elements of the types indicated? 1. int -> 0 2. String -> "null" 3. Dog -> null 4. char -> '\u0000' 5. float -> 0.0f 6. boolean -> true

    A
    1, 2, 3, 4

    B
    1, 3, 4, 5

    C
    2, 4, 5, 6

    D
    3, 4, 5, 6

    Note: (1), (3), (4), (5) are the correct statements. (2) is wrong because the default value for a String (and any other object reference) is null, with no quotes. (6) is wrong because the default value for boolean elements is false.
    1. Report
  9. Question: Which one of these lists contains only Java programming language keywords?

    A
    class, if, void, long, Int, continue

    B
    goto, instanceof, native, finally, default, throws

    C
    try, virtual, throw, final, volatile, transient

    D
    strictfp, constant, super, implements, do

    E
    byte, break, assert, switch, include

    Note: All the words in option B are among the 49 Java keywords. Although goto reserved as a keyword in Java, goto is not used and has no function. Option A is wrong because the keyword for the primitive int starts with a lowercase i. Option C is wrong because "virtual" is a keyword in C++, but not Java. Option D is wrong because "constant" is not a keyword. Constants in Java are marked static and final. Option E is wrong because "include" is a keyword in C, but not in Java.
    1. Report
  10. Question: Which will legally declare, construct, and initialize an array?

    A
    int [] myList = {"1", "2", "3"};

    B
    int [] myList = (5, 8, 2);

    C
    int myList [] [] = {4,9,7,0};

    D
    int myList [] = {4, 3, 7};

    Note: The only legal array declaration and assignment statement is Option D Option A is wrong because it initializes an int array with String literals. Option B is wrong because it use something other than curly braces for the initialization. Option C is wrong because it provides initial values for only one dimension, although the declared array is a two-dimensional array.
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd