Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Multiple Choice Question 11 (1.5 points) What are the equivalent statements of the one line statement: count++; Question 11 options: count = count + 1;

Multiple Choice

Question 11 (1.5 points)

What are the equivalent statements of the one line statement:

count++;

Question 11 options:

count = count + 1;

count += 1;

count ++= 1;

count = 1 + count;

Question 12 (1.5 points)

Given a class named MyClass and its variable myObject1. Choose all correct way(s) to call the public non-static method named method1 of MyClass from another class?

Question 12 options:

MyClass.method1()

method1(myObject1)

myObject1.method1

myObject1.method1()

Question 13 (1.5 points)

Choose the correct statement about class constructor.

Question 13 options:

Constrictor is always private.

Constructor may be overloaded.

new keyword is used to call a class constructor to construct an object of the specified class type.

Constructor needs no return type to be specified in its definition.

Question 14 (1.5 points)

Assume that we have declared an array:

int[] arr = {10, 3, 4, 1, 6};

What is the value of arr[arr[4] - arr[2]]?

Question 14 options:

index out of bound error.

2

3

4

Question 15 (1.5 points)

Given the code:

public class Test1 { private int method1(int x, int y) { return x + y; }

private int method2(int x, int y) { if (x > y) return x; else return y; }

public static void main(String[] args) { Test1 test1 = new Test1(); System.out.println(test1.method1(test1.method2(3, 5), 10)); } }

What is the output?

Question 15 options:

13

10

15

8

Question 16 (1.5 points)

Assume that your main method called method A and B, method A called method C and method B called method D. What happens right after method D returns?

Question 16 options:

The control returns to method B

The control returns to main method

The program ends

The control returns to method A

Question 17 (1.5 points)

What is the value of the expression:

(int) (7.5 / 3) + 2.0

Question 17 options:

4.5

4

4.0

5.5

Question 18 (1.5 points)

The correct expression to check if an index i is an valid index for an array array1?

Question 18 options:

array1.length > i && i >= 0

i <= array1.length - 1 && i >= 0

array1.length > i || i >= 0

array1.length() > i && i >= 0

Question 19 (1.5 points)

The way to prevent the value of a local variable from being changed afterwards is to:

Question 19 options:

use the keyword 'final'

name the variable using ALL_CAPITAL_CASE

use the keyword 'private'

use the keyword 'static'

Question 20 (1.5 points)

Object variables store ____.

Question 20 options:

a)

numbers

b)

references

c)

classes

d) objects

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

More Books

Students also viewed these Databases questions