rephactor questions (weeks 1-2)

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

a printf formal specifier of ____ will print a floating-point value rounded to 3 decimal places

%.3f

if the variable num contains a positive integer what are the only two possible results of the following expression: num % 2

0 and 1

if both operands to the remainder operator ( % ) are positive, a divisor of n will produce a result in the range __ to __

0 to n-1

if the current value of the integer variable num1 is 2 and the current value of the double variable num2 is 3.0, what value will be stored in num2 after the following line of code is executed: num2 /= num1 * num2;

0.5

What is the result of the expression Math.floor(12.843)?

12.0

the Math.PI constant represents pi to __ decimal places

15

what is the result of the expression Math.max(6, 17)?

17

What is the result of the expression Math.pow(3, 3)?

27

what is the result of this Java expression? 43 % 5

3

what is the result of this Java expression? 7 / 2

3

the result of this code is: System.out.println(15 + 30);

45

if the current value of the integer variable num is 4, what value will be stored in num after the following line of code is executed: num += 2;

6

if the current value of the integer variable size is 2, what value will be stored in size after the following line of code is executed: size *= 3;

6

What is the result of Math.round(8.25)?

8

if the current value of the integer variable count is 2, what value will be stored in count after the following is executed: count += count * 3;

8

there are __ primitive data types in Java

8

what value is assigned to the integer variable num by the following statement if the current value of num is 4? num = num * 2;

8

What is the sequence of things that this line of code does?: System.out.println("Your age in 7 years: " + (19 + 7));

Adds 19 to 7, concatenates the result to the string, then prints it

a typical Java compiler produces this type of output

Java bytecode

the slogan "Write once, Run anywhere" is used to promote...

Java's cross platform benefits

A comment designed to be parsed to produce web-based documentation

JavaDoc comment

the expression ___ raises the value x to the power y

Math.pow(x, y)

the format method of the ___ class accepts the same parameters as the printf method

String

java was created by __ ___, and is now managed by the ___ ____

Sun Microsystems; Oracle Corporation

println is a call to a method in the ____ object

System.out

this produces: System.out.print("Total: " + 100 + 20);

Total: 10020

Characters in Java are represented using the ___ character set

Unicode

the Java API is...

a large library of classes

which of the following identifiers follows the convention for naming Java variables? a. totalValue b. total_value c. TotalValue d. TOTALVALUE

a. totalValue

java constants should be in __ ___ ___ letters with ___ between words

all upper case; underscores

This code produces: System.out.print("apple"); System.out.println("banana"); System.out.println("orange");

applebanana orange

java performs __ garbage collection

automatic

which of the following is NOT a Java primitive type: a. int b. number c. boolean d. double

b. number

formatting that determines where the opening brace appears in code

block style

the __ data type represents a true or false value

boolean

which of the following is NOT a constant declared in the Java API: a. Integer.MAX_VALUE b. Math.E c. Conversions.KILOMETERS_PER_MILE d. Math.PI

c. Conversions.KILOMETERS_PER_MILE

java can/cannot be run on a web page

can

the expression count++ can/cannot stand as a statement on its own

can

Java source code can/cannot be executed directly by a computer

cannot

when printing a long character string, you have to remember that a character string literal __ ___ __ __ __ __

cannot span across multiple lines

Syntax coloring is showing:

certain elements of a program code in different colors

an import statement specifies

classes that are to be used in a program

the Java Development Kit (JDK) is an example of a __-_ ___

command-line environment

human-readable text embedded in code to explain its purpose and processing

comment

This software tool is used to translate Java source code into Java bytecode

compiler

Guidelines that go beyond language syntax that programmers should follow is...

conventions

the body of a Java method id enclosed in ___ braces

curly { }

which of the following is NOT a valid variable declaration in Java: a. double total; b. float height = 20.0, length = 30.5; c. String greeting = "Hi there!"; d. int first = true;

d. int first = true;

the process of determining the root cause of a problem and fixing it

debugging

which line of code is equivalent to the following: depth += 50 * offset;

depth = depth + (50 * offset);

a Java identifier cannot begin with a ___

digit

a __ value cannot be assigned to an integer variable without a cast

double

a numeric literal is a/n __ number used in a program

explicit

the __ __ in a printf formal specifier determines the total number of characters to be used to print the value

field width

a constant is created using the __ modifier

final

if either or both operands to the division ( / ) are floating-point values, then the result will be a ___

floating-point value

the float data type represents a __-__ value; the long data type represents a __ integer

floating-point; long

the first parameter to the printf method is the __ __

formal string

the int and short data types both represent ___

integers

constants convey more meaning than __ and help prevent inadvertent errors

literals

a problem such as computing the wrong answer

logic error

the assignment operator has the __ precedence of all operators

lowest

a comment that begins with /* and continues until */

multi-line comment

used when humans communicate with each other

natural language

java is an ___-___ programming language

object-oriented

elements of the Java API are organized into ___, and grouped by ______

packages; functionality

the two categories of data types in Java are:

primitive data and object references

formatting decisions that dictate what a program looks like

program style

The main method of a java program must have this method header:

public static void main(String[] args)

a problem such as dividing by zero

runtime error

the meaning of a language element

semantics

numeric primitive values in Java have a ___

sign

the Java Virtual Machine is ___

software

java started out as a ___-___ language, but evolved into a ___-___ language

special-purpose; general-purpose

the methods of the Math class are static/abstract

static

determines how words and symbols are combined

syntax

a problem such as omitting a necessary semicolon

syntax error

the process of evaluating a program to discover errors

testing

java was created by a development team called ____ led by _____

the Green team; James Gosling

when " size = 12; " is executed, what happens to the current value of the integer variable size?

the current value is overwritten by the new value

the term case sensitive means:

the difference between upper case and lower case letters matters

program specification

the set of requirements that must be satisfied by a program

the Math class contains a constant that represents the value pi to several digits. true/false

true

a ___ ___ causes a value to be treated as another type only for the current expression

type cast

the printf method accepts a ___ number of parameters

variable

the spacing between symbols, words, and statements in a program

white space

a ____ ____ converts a primitive value to a larger primitive type

widening conversion


Kaugnay na mga set ng pag-aaral

Certified Hacking Forensic Investigator (CHFI) - Exam Prep

View Set

IGCSE: Atomic Structure: protons, neutrons, electrons and electronic structure

View Set

Physics Final: Sounds Waves and Music

View Set

HRTM 450 FINAL- SOMANG plus more

View Set

Advanced Networking, Chapter 4 - Quiz - Study Guide

View Set

BIOL 1408 - Photosynthesis lab review

View Set

Cultural geography: Canada chapter 8

View Set

Marketing Chapter 15 - Supply Chain and Channel Management

View Set

CH 14: Sales and Lease Contracts

View Set