1.2.3 Test

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

A computer program is a set of instructions that enable the computer to solve a problem or perform a task. main memory. pseudocode. a flow chart.

a set of

Because Java byte code is the same on all computers, compiled Java programs are non-existent. must be re-compiled for each different machine it is run on. are highly portable. cannot run on computers with different operating systems.

are highly portable

The data contained in an object is known as methods. attributes. classes. fields.

attributes

If you do not provide initialization values for a class's numeric fields, they will cause a runtime error. contain an unknown value. be automatically initialized with 0. cause a compiler error.

be automatically

A class's responsibilities include the things a class is responsible for knowing. the things a class is responsible for doing. both the things a class is responsible for knowing and the things a class is responsible for doing neither the things a class is responsible for knowing nor the things a class is responsible for doing

both the things a class is responsible for knowing and the things a class is responsible for doing

A Java program must have at least one comment. System.out.println(); statement. class definition. variable declaration.

class

Variables are classified according to their names. values. location in memory. data type.

data type

What will be the displayed when the following code is executed? final int x=22,y=4; y += x; System.out.println("x= " + x = 22, y = 26 x = 22, y = 4 x = 22, y = 88 Nothing. There is an error in the code.

error

Variables of the boolean data type are useful for evaluating conditions that are either true or false. working with small integers. working with very large integers. evaluating scientific notation.

evalating conditions that are either ture or false

A message dialog is a quick and simple way to ask the user to enter data. True False

false

Colons are used to indicate the end of a Java statement. True False

false

The public access specifier for a field indicates that the field may not be accessed by statements outside the class. True False

false

When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable. True False

false

It is common practice in object-oriented programming to make all of a class's fields private. methods private. fields public. fields and methods public.

fields private

________ refers to the physical components that a computer is made of. Input Main memory Control unit Hardware

hardware

When an object is created, the attributes associated with the object are called instance fields. class instances. instance methods. fixed attributes.

instance field

Methods that operate on an object's fields are called instance methods. instance variables. private methods. public methods.

instance method

When saving a Java source file, save it with an extension of .java. .javac. .src. .class.

java

Suppose you are at an operating system command line, and you are going to use the following command to compile a program: javac MyClass.java Before entering the command, you must close all other Windows on your computer system. make sure you are in the same directory or folder where the MyClass.java file is located. execute the java.sun.com program. save the program with the .comp extension.

makes sure

Class objects normally have ________ that perform useful operations on their data, but primitive variables do not. fields relationships methods instances

methods

A(n) ________ is a software entity that contains data and procedures. object program class method

object

The key word new creates a new class. creates a new Java byte code file. creates an object in memory. creates a new variable in memory.

object

In the blueprint/house analogy, think of a class as a blueprint that describes a house and ________ as instances of the house built from the blueprint. methods fields objects attributes

objects

A group of related classes is called a(n) archive. package. collection. attachment.

package

This is a special language used to write computer programs. Pseudocode Operating system Application Programming language

programming

One of the design tools used by programmers when creating a model of the program is ALU. pseudocode. byte code. syntax.

pseudocode

________ are used to indicate the end of a Java statement. Periods Asterisks Semicolons Colons

semicolones

Character literals are enclosed in ________, and string literals are enclosed in ________. single quotes, double quotes double quotes, single quotes single quotes, single quotes double quotes, double quotes

single, double

Which of the following is not a rule that must be followed when naming identifiers? After the first character, you may use the letters a-z, A-Z, an underscore, a dollar sign, or digits 0-9. Identifiers can contain spaces. Uppercase and lowercase characters are distinct. The first character must be one of the letters a-z, A-Z, an underscore or a dollar sign.

spaces

You should not define a class field that is dependent upon the values of other class fields in order to keep it current. because it is redundant. in order to avoid having stale data. because it should be defined in another class.

stale data

Variables are symbolic names made up by the programmer whose values cannot be changed. operators that perform operations on one or more operands. symbolic names made up by the programmer that represents locations in the computer's RAM. reserved words.

symbolic

An object typically hides it data, but allows outside code to access the pseudocode. the methods that operate on the data. private data members. the data files.

the methods that

Application software refers to the programs that make the computer useful to the user. the operating system. key words. pseudocode.

the programs

A procedure is a set of programming language statements that, together, perform a specific task. True False

true

Programming style includes techniques for consistently putting spaces and indentation in a program so visual cues are created. True False

true

The System.out.printf method allows you to format output in a variety of ways. True False

true

The java.lang package is automatically imported into all Java programs. True False

true

Unlike a console program, a program that uses JOptionPane does not automatically stop executing when the end of the main method is reached. True False

true

When you call one of the Scanner class's methods to read a primitive value, such as nextInt or nextDouble, and then call the nextLine method to read a string, an annoying and hard-to-find problem can occur. True False

true

The boolean data type may contain the following range of values: -128 to +127. true or false. -2,147,483,648 to +2,147,483,647. -32,768 to +32,767.

true or false

Application software refers to programs that make the computer useful to the user. True False

ture

Which of the following is not involved in finding the classes when developing an object-oriented application? Describe the problem domain. Write the code. Refine the list of nouns to include only those that are relevant to the problem. Identify all the nouns.

write the code

What will be displayed after the following statements have been executed? int x=15, y=20, z=32; x += 12; y /=6; z -= 14; System.out.println("x= " + x + ", y = " + y + ", z= " + z); x = 27, y = 3.333, z = 18 x = 27, y = 2, z = 18 x = 37, y = -14, z = 4 x = 27, y = 3, z = 18

x=27, y=3, z=18

In UML diagrams, what symbol indicates that a member is public? - * # +

+

The simplest way you can use the System.out.printf method is with a format string, and one format specifier. with only a format string, and no additional arguments. with a format string, and one or more format specifiers. with only one format specifier, and no format string.

2

Which of the following statements correctly creates a Scanner object for keyboard input? Scanner kbd = new Scanner(System.keyboard); Scanner keyboard = new Scanner(System.in); Scanner keyboard(System.in); Keyboard scanner = new Keyboard(System.in);

2

Key words are 1. symbols or words that perform operations on one or more operands. 2. words or names defined by the programmer. 3. the data names in your program. 4. words that have a special meaning in the programming language.

4. words that have a special meaning in the programming language.

What will be the value of z as a result of executing the following code? int x= 5, y=28; float z; z=(float)(y/x); 5.6 3.0 5.0 5.60

5.0

What is the result of the following expression? 17 % 3 *2 -12 +15 105 12 7 8

7

How many bits are in a byte? 4 8 16 32

8


Kaugnay na mga set ng pag-aaral

Chapter 3 (Federalism) AP Gov. classroom

View Set

AP gov chapter 14 the bureaucracy

View Set

ch 7 pg 45 Final Check. A Phony Friend

View Set

Q4 Opening Questions & Exit Tickets

View Set

Chapter 7 Terms - Small Business Management

View Set

US History 1 - Chapter 10 - Sec 1

View Set