Three primary state of Matter are: Solids, Liquids, and Gases
Describe Solids: - Have high degree of internal order.
- Their atoms or molecules are limited to back and forth motion about a central position.
- Maintain their shape due to atoms are kept in place by strong mutual attractive forces,...
Lju4801 assignment 2
Which of the following is a value that is written into the code of a program?
A. an assignment statement
B. a variable
C. a literal
D. an operator a literal
Which of the following is a named storage location in the computer's memory?
A. a constant
B. a literal
C. an operator
D. a variable a variable
Which of the following is not a valid Java comment?
A. /** Comment one */
B. */ Comment two /*
C. /* Comment four */
D. // Comment three */ Comment two /*
A Java source file must be saved with the extension.
A. .javac
B. .class
C. .src
D. .java .java
Which of the following is not a rule that must be followed when naming identifiers?
A. Identifiers can contain spaces.
B. The first character must be one of the letters a-z, A-Z, an underscore, or a dollar sign.
C. After the first character, you may use the letters a-z, A-Z, an underscore, a dollar sign, or the
digits 0-9.
D. Uppercase and lowercase characters are distinct. Identifiers can contain spaces.
Character literals are enclosed in ________ and string literals are enclosed in ________.
A. double quotes, single quotes
B. single quotes, double quotes
C. double quotes, double quotes
D. single quotes, single quotes single quotes, double quotes.
Variables are classified according to their
A. names.
B. data types.
C. locations.
D. values. data types.
What is the result of the following expression?
17 % 3 * 2 - 12 + 15
A. 105
B. 7
C. 8
D. 12 7
, What is the result of the following expression?
10 + 5 * 3 - 20
A. 5
B. -5
C. 25
D. -50 5
In the following Java statement, what value is stored in the variable name?
String name = "John Doe";
A. "name"
B. John Doe
C. the memory address where "John Doe" is located
D. the memory address where name is located the memory address where "John Doe" is
located.
What is the value of z after the following statements have been executed?
int x = 4, y = 33;
double z;
z = (double) (y / x);
A. 8.0
B. 0
C. 4
D. 8.258.0
What output will be displayed as a result of executing the following code?
int x = 5, y = 20;
x += 32;
y /= 4;
System.out.println("x = " + x + ", y = " + y);
A. x = 37, y = 5
B. x = 9, y = 52
C. x = 160, y = 80
D. x = 32, y = 4 x = 37, y = 5
Which of the following statements will correctly convert the data type, if x is a float and y is a
double?
Select one:
A. x = float y;
B. x = (float)y;
C. x = <float>y;
D. x = y; x = (float)y;
Which of the following statements is invalid?
A. double r = 9.4632e15;
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller johnlynn297. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for £8.49. You're not tied to anything after your purchase.