A byte is a collection of: - Correct Answer - Eight bits
The purpose of validating the results of the program is: - Correct Answer - To determine whether
the program solves the original problem
Encapsulation refers to the combining of data and code into a single object. - Correct Answer -
True
Variables are: - Correct Answer - Symbolic names made up by the programmer that represents
locations in the computer's RAM
____________ refers to the physical components that a computer is made of. - Correct Answer -
Hardware
Byte code instructions are: - Correct Answer - Read and interpreted by the JVM
Key words are: - Correct Answer - Words that have a special meaning in the programming
language
Which of the following is valid? - Correct Answer - float w;
w = 1.0f;
Which of the following does not describe a valid comment in Java? - Correct Answer - Multiline comments, start with */ and end with /*
Which of the following statements correctly creates a Scanner object for keyboard input? -
Correct Answer - Scanner keyboard = new Scanner(System.in);
Character literals are enclosed in _____; string literals are enclosed in _____. - Correct Answer -
single quotes; double quotes
Which Scanner class method reads a String? - Correct Answer - nextLine()
To compile a program named First, use the following command: - Correct Answer - javac
First.java
In an if/else statement, if the boolean expression is false, - Correct Answer - the statement or
block following the else is executed
This study source was downloaded by 100000887544919 from CourseHero.com on 07-12-2024 10:42:47 GMT -05:00
https://www.coursehero.com/file/223056531/CMPP-PRACTICE-EXAM-2024docx/
Which of the following will format .1278 to display as 12.8%? - Correct Answer - ##0.0%
If chr is a character variable, which of the following if statements is written correctly? - Correct
Answer - if (chr == 'a')
What will be the value of ans after the following code has been executed?
int ans = 10;
int x = 65;
int y = 55;
if (x >= y)
ans = x + y; - Correct Answer - 120
Enclosing a group of statements inside a set of braces creates a - Correct Answer - block of
statements
Which one of the following is the not equal operator? - Correct Answer - !=
What would be the value of bonus after the following statements are executed?
int bonus, sales = 1250;
if (sales > 1000)
bonus = 100;
if (sales > 750)
bonus = 50;
if (sales > 500)
bonus = 25;
else
bonus = 0; - Correct Answer - 25
What would be the value of discountRate after the following statements are executed?
double discountRate;
char custType = 'B';
switch (custType)
{
case 'A':
discountRate = .08;
break;
case 'B':
discountRate = .06;
case 'C':
discountRate = .04;
default:
discountRate = 0.0;
} - Correct Answer - 0.0
Category | exam bundles |
Comments | 0 |
Rating | |
Sales | 0 |