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: Methods must include all of the following except -

    A
    a declaration

    B
    a call to another method

    C
    curly braces

    D
    a body

    Note: Not available
    1. Report
  9. Question: All method declaration must contain -

    A
    the keyword "static"

    B
    one or more aceess modifiers

    C
    arguments

    D
    parantheses

    Note: Not available
    1. Report
  10. Question: Which of the method declarations is correct for a method named displayFacts() if the method receives an int argument?

    A
    public void int displayFacts()

    B
    public void displayFacts(int)

    C
    public void displayFacts(int data)

    D
    public void displayFacts()

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd