Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 16 Of the following types, which one cannot store the value 2? A. Int B. Byte C. Float D. Char E. all of these

QUESTION 16

  1. Of the following types, which one cannot store the value 2?

    A.

    Int

    B.

    Byte

    C.

    Float

    D.

    Char

    E.

    all of these can store this value

2 points

QUESTION 17

  1. A typecast is required in which of the following situations?

    A.

    storing an int in a double

    B.

    storing an int in a float

    C.

    storing a float in a double

    D.

    storing a double in an int

    E.

    all of the above require casts

2 points

QUESTION 18

  1. If x is an int and y is a float, all of the following are legal except which assignment statement?

    A.

    y = x;

    B.

    x = y;

    C.

    y = (float) x;

    D.

    x = (int) y;

    E.

    all of the above are legal

2 points

QUESTION 19

  1. In order to create a constant, you would use which of the following Java reserved words?

    A.

    private

    B.

    static

    C.

    const

    D.

    final

    E.

    class

2 points

QUESTION 20

  1. The relationship between a class and an object is best described as:

    A.

    classes are instances of objects

    B.

    objects are instances of classes

    C.

    objects and classes are the same thing

    D.

    classes are programs while objects are variables

    E.

    objects are the instance data of classes

2 points

QUESTION 21

  1. The following statement will output ___ lines of text:

    System.out.print("1 big bad wolf"); System.out.println(" 8 the 3 little pigs"); System.out.println(" 4 dinner 2 night");

    A.

    1

    B.

    2

    C.

    3

    D.

    4

    E.

    5

2 points

QUESTION 22

  1. What will be the result of the following assignment statement? All variables are integers.

    Assume b = 5 and c = 10.

    a = b * (-c + 2) / 2;

    A.

    30

    B.

    30

    C.

    20

    D.

    20

    E.

    6

2 points

QUESTION 23

  1. System.out.println(x+y);

    What is output of the above statement if x and y are int values where x=10 and y=5?

    A.

    10 5

    B.

    105

    C.

    15

    D.

    x+y

    E.

    xy

2 points

QUESTION 24

  1. Assume the following code is correct and will execute. How many times will the following loop iterate?

    int x = 10; while (x > 0) { System.out.println(x); x - -; }

    A.

    0 times

    B.

    1 time

    C.

    9 times

    D.

    10 times

    E.

    11 times

2 points

QUESTION 25

  1. Consider the following class definition. Assume it is correct and will execute..

    public class NextThreeQuestions

    {

    public static void main(String[ ] args)

    {

    System.out.print("Here");

    System.out.println("There " + "Everywhere");

    System.out.println("But not" + "in Paris Texas");

    }

    }

    The program will print the word "Here" and then print:

    A.

    "There Everywhere" on the line after "Here"

    B.

    "There" on the line after "Here" and "Everywhere" on the line after "There"

    C.

    "There Everywhere" on the same line as "Here"

    D.

    "ThereEverywhere" on the same line as "Here"

    E.

    "ThereEverywhere" on the line after "Here"

2 points

QUESTION 26

  1. Consider the following class definition. Assume it is correct and will execute..

    public class NextThreeQuestions

    {

    public static void main(String[ ] args)

    {

    System.out.print("Here");

    System.out.println("There " + "Everywhere");

    System.out.println("But not" + "in Paris Texas");

    }

    }

    The final println command will output:

    A.

    "But not in Paris Texas"

    B.

    "But notin Paris Texas"

    C.

    "But not" on one line and "in Paris Texas" on the next line

    D.

    "But not+in Paris Texas"

    E.

    "But not + in Paris Texas"

2 points

QUESTION 27

  1. Consider the following class definition. Assume it is correct and will execute..

    public class NextThreeQuestions

    {

    public static void main(String[ ] args)

    {

    System.out.print("Here");

    System.out.println("There " + "Everywhere");

    System.out.println("But not" + "in Paris Texas");

    }

    }

    How many lines of output are provided by this program?

    A.

    1

    B.

    2

    C.

    3

    D.

    4

    E.

    5

2 points

QUESTION 28

  1. Java is an object-oriented programming language.

    True

    False

2 points

QUESTION 29

  1. System.out.print is used in a program to denote that a comment follows.

    True

    False

2 points

QUESTION 30

  1. The word public is a reserved word.

    True

    False

2 points

QUESTION 31

  1. Reserved words in Java can be redefined by the programmer to mean something other than their original intentions.

    True

    False

2 points

QUESTION 32

  1. A double has more precision than a float and a float has more precision than an int.

    True

    False

2 points

QUESTION 33

  1. In Java, a and A are considered to be different values.

    True

    False

2 points

QUESTION 34

  1. Only difficult programming problems require a pseudocode solution before the programmer creates the implementation (code) itself.

    True

    False

2 points

QUESTION 35

  1. In Java, the symbol = and the symbol == are used synonymously (interchangeably).

    True

    False

2 points

QUESTION 36

  1. The statement { } is a legal block.

    True

    False

2 points

QUESTION 37

  1. An IF statement may or may not have an ELSE clause, but an ELSE clause must be part of an IF statement.

    True

    False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions