CS Chapter 3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Today, in computer science, a data type that has only two values of true and false is a called a _______ data type.

Boolean

List Java's 4 integer types.

Byte, short, int, long 1 byte, 2 bytes, 4 bytes, 8 bytes

What does Java call constants?

Final variable

What are the 4 data types that will be tested on the AP Exam?

Int, double, boolean, string

Does Java follow the same Order of Operations that you learned in your Math class?

Yes

Print the Java statement that will declare x as an integer.

int x;

What does x %= 5; mean?

x = x %5;

Who invented a form of Algebra based on logical statements that are either true or false?

George Boole

Under what condition will the compiler create a bytecode file?

If the source code obeys all Java syntax rules

Should Java shortcuts be combined with other Java statements? Example: System.out.println(x++);

NOOOoooOoOOo. That statement displays x then increments it! ← confusing stuff

What is Java's formal language for the term simple data types?

Primitive data types

What is the difference between the / and the % division operators?

Using / gives you the integer quotient Using % gives you the integer remainder

What makes Math, Science and Computer Science possible?

Variables

Which data type is used to process individual characters?

char

What kind of quotes are used with strings?

double quotes

What 2 data types are used by Java use for real numbers?

float and double

Java has a large number of libraries that enhance the basic Java language. These libraries contain special program modules that perform a variety of tasks to simplify the life of a programmer. What are these modules called?

methods

When you are creating User-Defined Identifiers, you must make sure your identifier is not one of what two things?

neither a reserve word nor a predefined identifier

List 2 examples of Predefined Identifiers.

print and println

List 3 examples of Java Reserved Words.

public, void, static

What is "2" + "3" ?

23

What is a self-commenting variable?

A variable whose name describes what the variable is used for

What are the 5 integer operations?

Addition, subtraction, multiplication, division, and modulus (remainder)

What is the name for this type of short cut: c1 = c2 = c3 = 'Q'; ?

Chain assignment/ chaining

What is the first form of program documentation?

Comments

Why were computer programs in the 1960s and the 1970s often written with single-letter variables?

Computer memory was scarce and very expensive

What is the fancy name for using the plus ( + ) sign to join strings together?

Concatenation

What happens when you attempt to alter the value of a constant?

Error: cannot assign a value to final variable

A computer program is made up of words, which usually are called what?

Keywords

How is it possible for a computer to multiply 2 positive numbers, and get a negative product?

Memory overflow

Explain Memory Overflow.

Memory overflow is a situation where the assigned value of a variable exceeds the allocated storage space. The resulting value that is stored will be inaccurate and may change from positive to negative or vice versa.

What is the first Java syntax rule?

Only keywords known to the Java compiler can be used in a program

The plus ( + ) sign can be used to add integers and real numbers. It can also be used to join strings. What is it called when one operator can perform different functions.

Overloading

In binary, what indicates if a number is positive or negative?

The first bit is the sign bit (0 is positive. 1 is negative)

What are the rules for naming an identifier?

The name must start with a letter. It may contain alphanumeric characters and underscores

In program Java0313.java, what is accomplished by the statement: c1 = c2 = c3 = 'Q'; ?

Three different character variables are initialized

In a well-documented program, are single-line comments or multi-line comments necessary in a program that already uses good self-commenting variables?

You should still comment

Say you want to use the mathematical value of E (another non-repeating decimal similar to PI) in your program with value of 2.718281828. This value will never change in your program. Print the proper way to define and initialize this constant.

final double E = 2.718281828;

Print the Java statement that will declare x as an integer and assign the value of 7 to x in one single statement.

int x=7;

List the 3 categories of keywords.

reserved words pre-defined java identifiers user-defined identifies

What kind of quotes are used with individual character

single quotes

Which data type is used to process sets of one or more characters?

string

The age of single-letter variables is gone. Variables should now be _______ or _______.

words or compound words (compoundWords)

What does x++; or ++x; mean?

x = x +1;

What does x += 5; mean?

x = x +5;


Set pelajaran terkait

Network+ - Lesson 6: Supporting IPv4 and IPv6

View Set

Microeconomics chapter 1 study material part 4

View Set

ATI - pharmacology ATI assessment [A]

View Set

Chapter 38 Nursing Management: Patients with Allergic Disorders

View Set