Ap computer Science
Which term best describes the >= and <= Java operators? A. relational B. comparative C. logical D. boolean
A.relational
A method that does not return a value should be coded with the void keyword. True or false
True
An initialization error occurs when a loop is begun before its counter or some other variable within the loop has been set to some specified starting value. True or false
True
Which of the following is required in order to run a Java program on any computer?
B. a Java Virtual Machine
Which of the following shows the correct sequence for performing four of the phases in the SDLC? A. analysis, design, integration, implementation B. analysis, design, implementation, integration C. design, analysis, implementation, integration D. design, analysis, integration, implementation
B. analysis, design, implementation, integration
If a counter variable for a loop is declared outside the loop header, the variable is visible to all code within the method where the loop is declared, but not visible outside that method. True or false
True
It is possible to limit the capabilities of a Java program because it runs within a virtual machine. True or false
True
Java programs typically run slower than the same program developed using C++. True or false
True
Which of the following statements shows the correct for loop syntax to initialize a counter named count to a value of 0, and execute the loop until count EXCEEDS a value of 100? A. for (count = 1; count <= 100; count++) B. for (count = 0; count <= 100; count++) C. for (count = 0; count < 100; count++) D. for (count = 0; count++; count <= 100)
B. for (count = 0; count <= 100; count++)
The condition specified for an if or an if-else statement must be a(n) _________________ expression.
Boolean
The _____________ statement is used to get out of a loop before the condition becomes false.
Break
How are Java byte code files created?
By the Java compiler
Which of the following statements could be used to create a new object MyBall, of a class named Ball? A. Ball MyBall = new Ball; B. Ball MyBall = new MyBall(); C. Ball MyBall = new Ball(); D. Ball.MyBall = new Ball;
C. Ball MyBall = new Ball();
Which of the following best describes the term encapsulation? A. Providing access to services, but not to data resources B. The hierarchical class structure and sharing of instance variables and methods with subclasses C. Combining the description of resources and behaviors into a single software entity D. Different types of objects can understand the same message.
C. Combining the description of resources and behaviors into a single software entity
Java's syntax consists of the rules for combining words and symbols into a program statement. True or false
True
Object oriented programs send messages to objects to accomplish specific tasks. True or false
True
Omitting or coding extra brace symbols ({ } ) within a loop can cause unexpected results when the loop is executed. True or false
True
The CPU of a modern PC consists of a million transistors packed into an area not much larger than a stamp. true or false
True
The first phase of the SDLC using the waterfall methodology is begun with a request from a customer to solve a problem. True or false
True
The process of creating an object before you use it is called instantiating the object. True or false
True
Calling one class constructor from withing another class constructor is called _______________.
Chaining
There are 2 non-numeric primitive types.True or false
True
Two String variables can be combined into one String variable by concatenating them together. True or false
True
When defining a variable, in Java you must always declare the variable's type. True or false
True
An item in a program whose value can change during execution of the program is called a(n) _____________________ .
Variable
Which term below is used to describe the class definition statement keywords public and private?
Visibility modifiers
A class constructor that contains an empty parameter list is commonly called the _______________ constructor.
default
The JVM deletes unreferenced objects from memory during a process called _______________.
garbage collection
The _____________ statement can be used in a Java program to include an already written class, such as Scanner, in the new program.
import
In the statement, System.out.print("Hello"), the period between the word out and print is called the _____________ operator.
method selector/dot (.)
Messages that are used to change the state of an object are called _______________.
mutators
The ________________ method of the Scanner object can be used to retrieve a floating point number from the keyboard.
nextDouble()
When a message is sent to an object, the string of characters that appears within the parentheses following the message is called a(n) ___________.
parameter
If a method for a class needs to be visible to the clients of the class, the method should be coded using the _______________ modifier keyword.
public
A variable of one data type can be temporarily converted to a different data type to perform a calculation by using which of the following methods?
type-swapping
Java uses the ________________ standard for encoding character data instead of the commonly used ASCII standard.
unicode
The term _______________ describes the process of combining an object's data and behavior into a single package.
Encapsulation
An arithmetic _______________ in Java consists of operands and operators combined in a manner similar to algebra.
Expression
In the statement x += 3; the += operator is one of Java's _____________ assignment operators.
Extended
A computer's operating system is one example of an application program. True or false
False
An if-else statement will continue to execute until the condition becomes false.
False
Braces are required for while loops and if statements even if the body is 1 statement.
False
Instance variables for Java classes are nearly always declared to be public to enable clients to access them directly. True or false
False
Personal computers (PCs) first began to appear in the early 1970's. True or false
False
The internal memory (RAM) for data storage is part of the software category. True or false
False
The sender of a message to an object needs to know intimate details concerning the workings of the receiver of the message. True or false
False
There are 4 separate distinct steps involved in creating and running a Java program: Edit (enter the source code), Compile (convert to byte code), Interpret (convert to machine code), and Execute (run the machine code). True or false
False
Unlike other programming languages, Java does not allow the use of parenthesis to override the order of evaluation in an expression. True or false
False
Variables defined within a method for temporary working storage are called instance variables. True or false
False
When a Java program is executing, all class templates are in memory at all times, as are all individual objects used within the program. True or false
False
Which of the following key words is used to declare a variable as a constant in a Java program?
Final
A loop that continues without stopping is called a(n) _______________ loop.
Infinite
When sending a message to an object, what term below is used to define the list of methods that are supported by the server?
Interface
Java source code files are created and saved using what file extension?
Java
Which error type listed below cannot be automatically detected by a programming environment?
Logic
The abs() and round() methods are members of which Java class?
Math
Which of the following is not a normal component of a loop structure?
Minimum iteration value
Java arranges classes in a hierarchy, and at the base of the hierarchy is a class called _______________.
Object
A(n) __________________ error is caused when a loop is executed one too many, or one too few times.
Off-by-one
Using the same name for two methods in the same class, where each method has different parameter list is called __________________ .
Overloading
In the statement reader.nextDouble() what is the name of the object?
Reader
Java's modulus operator returns the value of the _________________ in a divide operation.
Remainder
Java statements are terminated by a(n) _________________________.
Semicolon ;
_______________ is the characteristic of an object that says that, at any particular moment, the object's instance variables have particular values.
State
What is the maximum value positive value that can be stored in a Java variable of type int? (you may use a calculator)
2,147,483,647
The Java programming language has a total of _______________ numeric data types.
6
A KB is exactly how many BITS? (you may give your answer using 2^n)
8192 (2^13)
What is the the Java assignment operator?
= (equals sign)
Which of the following is used to convert a program written in a high-level language such as C or Java into machine language form? A. compiler B. assembler C. linker D. an interpreter
A. compiler
Which of the following statements show the correct syntax for declaring a variable named alpha of data type double? A. alpha = double; B. alpha (double); C. double (alplha); D. double alpha;
D. double alpha;
Java is an example of which type of programming language? A. machine B. procedural C. assembly D. object-oriented
D. object-oriented
Which of the following is NOT included in the sequence of bits that represents a computer program's instruction as it is contained in the memory system? A. opcode B. address of operands C. address of the result D. the instruction's priority value
D. the instruction's priority value
The specific location of a byte of storage in the computer's memory is called the byte's ______________ .
address
Word processors and spreadsheet programs are both examples of software that belongs to the ___________ software category.
application
Every instruction in a(n) _____________ language instruction corresponds to exactly one machine language instruction.
assembly