Week 3 Pre Reading Quiz

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Will the following statement sequence compile? If not which line causes the compile error? The line numbers are just for reference. 01 int i; 02 int j = 2; 03 i = j; 04 j = i; Select one: a. Yes b. No, line 01 c. No, line 02 d. No, line 03 e. No, line 04

a

Given the following syntax template for a declaration statement: dataType variableName [= dataValue][, variableName [= dataValue] ]...; What is the minimum and maximum number of variables that can be declared in a single declaration statement specified by this template? Select one: a. 0, infinite number b. 1, infinite number c. 0, 2 d. 1, 2 e. If you think none of the above are correct, select this option

b

Given the following syntax template: dataType variableName [, variableName [= dataValue] ]...; Would it be valid to declare a variable with an initial value and a variable without an initial value in the same declaration statement? Select one: a. No b. Yes without restrictions c. Yes with restrictions

c

What is the meaning of the symbol "=" in mathematics and in Java respectively? Select one: a. Assignment, Assignment b. Assignment, Equality c. Equality, Assignment d. Equality, Equality

c

Can a Java constant that has been declared and initialised be used to initialise a Java variable? Can a Java variable that has been declared and initialised be used to initialise a Java constant? Select one: a. No, No b. Yes, No c. No, Yes d. Yes, Yes

d

Which of the following data types can only store data approximately? Select one: a. int b. long c. boolean d. double e. String f. If you think all of the above store data exactly, select this option

d

Will the following statement sequence compile? If not which line causes the compile error? The line numbers are just for reference. 01 int i; 02 int j = 2; 03 j = i; Select one: a. yes b. no, line 01 c. no, line 02 d. no, line 03

d

Which of the following starts a multi-line Java comment? Select one: a. // b. //* c. */ d. /// e. If you think none of the above starts a multi-line Java comment, select this option

e

Which of the following will be an effect of the following statement sequence executing? The line numbers are just for reference. 01 int i = 1; 02 double d = 1.1; 03 d = i + d; Select one: a. d's type will change from double to int. b. i's type will change from int to double c. The type of d's value will change from double to int d. The type of i's value will change from int to double e. If you think none of the above will be an effect of the statement sequence executing, select this option

e

Which of the following is NOT true for both Java variables AND Java constants? Hint: If you are unsure try it in IntelliJ. This applies to all questions in this pre-reading quiz. Select one: a. Neither can be used without first being declared b. Both can be initialised at declaration c. Both must have a data type d. Both can be initialised after declaration e. Neither can have a name that begins with a number f. If you think all of the above are true for both Java variables and Java constants, select this option

f


Kaugnay na mga set ng pag-aaral

11.6.13 Redundancy and High Availability

View Set

Renewable Energy Systems Midterm 1

View Set

Chapter 4 - Explain the accrual basis of accounting and the reasons for adjusting entries.

View Set

EAQ Fluid and Electrolytes - Concept

View Set

AP Euro History Unit 1 Progress Check: MCQ

View Set