Java Unit 1 Flashcards

(40 cards)

1
Q

These rules specify the basic vocabulary of the language and how programs can be constructed using things like loops, branches, and subroutines.

A

Syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A set of rules that determine the meaning of a program written in a language.

A

Semantics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Java programs are compiled into what?

A

Byte code!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a subroutine call statement?

A

A subroutine call statement is a predefined set of routines for a subroutine to complete.
Example: System.out.println is a subroutine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In order to define a program, a class must include a subroutine named?

A

main
public static void main(String[] args) {
statements
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why do you have to type “public” in the first line of main()?

A

Using “public” means that the routine can be called from outside of the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A subroutine can’t exist by itself. What does it HAVE to be a part of?

A

A class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a package?

A

A group of classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To execute a program, you only need the compiled “ “ file, not the source code.

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When defining a variable, capitalizing every word except the first is referred to as what?

A

Camel case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

These names consist of several simple names separated by periods.

A

Compound names, also called qualified names.
Example: System.out.println

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

An “ “ represents anything that refers to or computes a data value.

A

expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Name all of the primitive types. Hint: there are 8

A
  1. byte - 16 bits
  2. short
  3. int - 32 bits
  4. long - 64 bits
  5. float
  6. double
  7. char
  8. boolean
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What kind of numbers do float and double types hold?

A

real numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What range of values can a byte type hold?

A

Anywhere from -128 to 127 which equals up to 256 integers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What range of values can a short type hold?

A

From -32,768 to 32,767 (16 bits)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How many bytes of memory are float data types represented by?

A

Four bytes (chomp, chomp, chomp, chomp)

18
Q

How many bytes of memory does the char type occupy?

A

Two bytes (chomp, chomp)

19
Q

A char character is stored as a “” bit integer code number.

20
Q

A data value is stored in the computer as a sequence of what?

21
Q

In a program, you represent constant values as “”.

A

literals (I literally did not know that)

22
Q

What is the escape character for a carriage return?

23
Q

What is the escape character for a linefeed?

24
Q

How can you express a number in an exponential form?

A

By using ‘e’
Example: ‘y = 1.3e12’
This means that 1.3 will be raised to the power of 12.

25
Any numeric literal that contains a decimal point or exponential is a literal of type " ".
double
26
To make a literal of type float, you have to append what?
An 'f' or 'F' to the end of the float. Example: 'x = 1.2F;'
27
In Java, a numeric literal that begins with a "" is interpreted as an octal number.
0 - zero
28
Binary literals start with "" or "" and contain only the digits 0 and 1
0b or 0B
29
A "" literal consists of \u followed by four hexadecimal digits.
Unicode (not to be confused with a Unicorn)
30
A variable can be used in a program only if it has been?
declared
31
What is the difference between the subroutine call System.out.print and the subroutine call System.out.println?
System.out.println adds a linefeed at the end while System.out.print does not.
32
A "" provides a subroutine with information it needs to perform its task.
parameter
33
Literals, variables, and function calls are considered "" expressions
simple
34
How can you get Java to evaluate the expression you want over order or precedence?
By using parenthesis. "(A + B) * C"
35
Can you multiply a char character by a char character?
Yes! Char characters are Unicode which have a numerical value.
36
The == operator checks whether two objects are stored in the same " ", rather than whether they contain the same value.
memory location
37
What does the following boolean expression do? boolean test = true; test = ! test;
Assigns a false value to the variable test. This is the boolean operator "not"
38
The operators && and || are said to be " " versions of the boolean operators.
short-circuited
39
What is this assignment called? "B = (short)A"
type cast
40