Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the index variable for the element at the first row and first column in array a? a[0][1] a[1][0] a[1][1] a[0][0] Question 2 1

  1. What is the index variable for the element at the first row and first column in array a?

    1. a[0][1]

    2. a[1][0]

    3. a[1][1]

    4. a[0][0]

  2. Question 2

    1 Point

    When assigning a literal to a variable of the byte type, if the literal is too large to be stored as a byte value, it _____________.

    1. causes underflow

    2. causes compile error

    3. causes overflow

    4. no error

  3. Question 3

    1 Point

    To declare a constant MAX_LENGTH inside a method with value 99.98, you write

    1. final float MAX_LENGTH = 99.98;

    2. final MAX_LENGTH = 99.98;

    3. double MAX_LENGTH = 99.98;

    4. final double MAX_LENGTH = 99.98;

  4. Question 4

    1 Point

    -25 % 5 is ______?

    1. 5

    2. 0

    3. 4

    4. 1

  5. Question 5

    1 Point

    The __________ method returns a raised to the power of b.

    1. Math.pow(a, b)

    2. Math.pow(b, a)

    3. Math.exponent(a, b)

    4. Math.power(a, b)

  6. Question 6

    1 Point

    Suppose a Scanner object is created as follows:

    Scanner input = new Scanner(System.in);

    What method do you use to read a real number?

    1. input.double();

    2. input.nextdouble();

    3. input.Double();

    4. input.nextDouble();

  7. Question 7

    1 Point

    When you invoke a method with a parameter, the value of the argument is passed to the parameter. This is referred to as _________.

    1. method invocation

    2. pass by value

    3. pass by reference

    4. pass by name

  8. Question 8

    1 Point

    A Java character is stored in __________

    1. two bytes

    2. four bytes

    3. one byte

    4. three bytes

  9. Question 9

    1 Point

    How many elements are array matrix (int[][] matrix = new int[5][5])?

    1. 14

    2. 10

    3. 20

    4. 25

  10. Question 10

    1 Point

    What is y displayed in the following code?

    public class Test {

    public static void main(String[] args) {

    int x = 1;

    int y = x++ + x;

    System.out.println("y is " + y);

    }

    }

    1. y is 1

    2. y is 4

    3. y is 3

    4. y is 2

  11. Question 11

    1 Point

    The signature of a method consists of ____________.

    1. parameter list

    2. method name

    3. return type, method name, and parameter list

    4. method name and parameter list

  12. Question 12

    1 Point

    What will be displayed when the following code is executed?

    int number = 6;

    while (number > 0) {

    number -= 3;

    System.out.print(number + " ");

    }

    1. 3 0

    2. 3 0 -3

    3. 6 3

    4. 6 3 0

  13. Question 13

    1 Point

    How many times will the following code print "Welcome to Java"?

    int count = 0;

    while (count < 10) {

    System.out.println("Welcome to Java");

    count++;

    }

    1. 11

    2. 10

    3. 0

    4. 9

  14. Question 14

    1 Point

    Each time a method is invoked, the system stores parameters and local variables in an area of memory, known as _______, which stores elements in last-in first-out fashion.

    1. an array

    2. a heap

    3. a stack

    4. storage area

  15. Question 15

    1 Point

    "abc".compareTo("aba") returns ___________.

    1. 2

    2. -1

    3. 1

    4. -1

  16. Question 16

    1 Point

    Suppose x is 1. What is x after x += 2?

    1. 3

    2. 2

    3. 4

    4. 1

  17. Question 17

    1 Point

    Assume x = 4, which of the following is true?

    1. x != 5

    2. x == 5

    3. !(x == 4)

    4. x != 4

  18. Question 18

    1 Point

    Which of the following is the correct statement to return JAVA?

    1. "Java".toUpperCase("Java")

    2. String.toUpperCase("Java")

    3. toUpperCase("Java")

    4. "Java".toUpperCase()

  19. Question 19

    1 Point

    The expression "Java " + 1 + 2 + 3 evaluates to ________.

    1. Java6

    2. illegal expression

    3. Java123

    4. Java 123

  20. Question 20

    1 Point

    What is the exact output of the following code?

    double area = 3.5;

    System.out.print("area");

    System.out.print(area);

    1. 3.53.5

    2. area 3.5

    3. area3.5

    4. 3.5 3.5

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

Step: 3

blur-text-image

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions