Java exam

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

Math.pow(4, 1 / 2) returns __________.

1.0

24 % 5 is _____

4

What is x after the following statements? int x = 2; int y = 1; x *= y + 1;

4

What is i printed? public class Test {public static void main(String[] args) { int j = 0; int i = ++j + j * 5; System.out.println("What is i? " + i);}}

6

One byte has ____ bits?

8 bits

is software that interprets Java bytecode

Java virtual machine

Which of the following are not permanent storage devices?

Main memory

____ is a program that runs on a computer to manage and control a computer's activities

Operating System

Analyze the following code.public class Test {public static void main(String[] args) {int month = 09;System.out.println("month is " + month);}

Syntax error 09

Suppose you define a Java class as follows, the source code should be stored in a file named_______. Public class Test { }

Test.java

Analyze the following code:public class Test {public static void main(String[] args) {int n = 10000 * 10000 * 10000;System.out.println("n is " + n);}}

The result of 10000 * 10000 * 10000 is too large to be stored in an int variable.

Which JDK command is correct to run a Java application in Bytecode.class

java Bytecode

The JDK command to compile a class in the file Test.java is

javac Test.java

If a program compiles fine, but it produces incorrect results, then the program suffers______.

logic error

Computer can execute the code in

machine language

Which of the following are the reserved words?

public static void class

The main method header is written as:

public static void main (String []args)

Which of the following is a valid identifier? radius, class, public, 9+10, 7, $5322, 10

radius and $5322

2.11 To assign a value 1 to variable x, you write D. 1 := x; C. x := 1; E. x == 1; B. x = 1; A. 1 = x;

x=1;

____ is not an object-oriented programming language

C#

____is the brain of a computer

CPU

To obtain the current minute, use _________. A. System.currentTimeMillis() % 3600 B. System.currentTimeMillis() % 60 C. System.currentTimeMillis() / 1000 % 60 D. System.currentTimeMillis() / 1000 / 60 % 60 E. System.currentTimeMillis() / 1000 / 60 / 60 % 24

D

To add number to sum, you write (Note: Java is case-sensitive) D. sum += number; B. number = sum + number; A. number += sum; C. sum = Number + sum; E. sum = sum + number;

D E

Which of the following assignment statements is incorrect? A. i = j = k = 1; B. i = 1; j = 1; k = 1; D. i == j == k == 1; C. i = 1 = j = 1 = k = 1;

D and C

Which of the following expressions will yield 0.5? C. (double) (1 / 2) A. 1 / 2 D. (double) 1 / 2 B. 1.0 / 2 E. 1 / 2.0

D,B,E

Which of the following assignment statements is illegal? B. int t = 23; D. int t = (int)false; C. short s = 10; A. float f = -34; E. int t = 4.5;

D,E

____ consists of a set of separate programs for developing and testing Java programs, each of which is invoked from command line

JAVA JDK

_____ is interpreted

Java

____ contains predefined classes and interfaces for developing Java programs

Java API

Are the following four statements equivalent? number += 1; number = number + 1; number++; ++number;

Yes

Why do computers use zeros and ones?

because digital devices have two stable states and it is natural to use one state for 0 and the other for 1.

If you forgot to put a closing quotation mark on string, what kind of error will be raised?

compile error

Which of the following is incorrect? A. int x = 9; B. long x = 9; D. double x = 1.0; C. float x = 1.0;

flox x = 1.0;

Which of the following are correct ways to declare variables? for int length and width

int length, width; int length; int width;


Kaugnay na mga set ng pag-aaral

COM 3332 Test 6 FSU Quizlet Seibert

View Set

Combo with "Chapter 7: Learning" and 5 others

View Set

Exercise 7- The Integumentary System

View Set

Nombre y fórmula de los compuestos químicos

View Set

English 2 A: Determine meaning: words and phrases

View Set

Chapter 29 Care of the Hospitalized Child

View Set