Unit 1 - Primitive Types Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are block comments?

A

All text between / and / that will be ignored by the compiler when in a program

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

What is a class declaration?

A
Identifies the name, start, and end of class
Encapsules all lines of code between { and }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the main Method?

A

Controls all of action in a program

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

What is System.out?

A

Object that generates output to the console

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

System.out.print vs System.out.println

A

System.out.print displays whatever is in the () on the screen but wait at the end of line for more information to display
System.out.println displays whatever is in the () on the screen, then move cursor to the next line

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

What is a string literal?

A

Exact sequence of characters (letters, numbers, or symbols) which are enclosed between two quotation marks

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

What is a syntax error?

A

An error that occurs when the syntax in the program was created incorrectly
Program will not compile while these errors are present

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

Identify the syntax error in each line
System.ot.print (“Hi”);
system.out.print(“Hello);

A

Line one- out spelled ot

Line two- Uncapitalized system and missing second quotation mark

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

What is an exception?

A

Program attempts to divide a number by zero
Occurs while the program is running
Will cause the program to terminate abnormally

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

What is a logical error?

A

Programmer accidently uses the wrong symbol for an operation such as using minus instead of plus to find sum of two numbers
Detected when actual output differs from anticipated output

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

What are primitive data types?

A

Automatically part of the Java program which does not need to be created by a programmer

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

What are non-primitive data types?

A

Methods created by programmer to perform actions that primitive types can’t

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

Is String a primitive or non-primitive type?

A

Primitive data type

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

What is boolean?

A

Outputs “true” or “false”

Smallest data type at one bit

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

What is int?

A

Refers to whole numbers

Medium data type at 32 bits

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

What is double?

A

Floating point numbers (w/decimals)

Largest data type at 64 bits

17
Q

Give an example of int, double boolean, and string.

A

int - any whole numbers
double - any numbers with a decimal
boolean - true or false
string- any sequence in “”

18
Q

Give a situation where each data type is most suitable to be used

A

int - any discrete data points
double - grades, GPA, height, any continuous data
boolean - Scenarios where an occurrence is true or false
string - Scenarios where a name or title, words are used

19
Q

What is a type?

A

Set of values (a domain) and a set of operations the set uses

20
Q

What is a variable?

A

Name given to a memory location that is holding a value

21
Q

What is an example of a variable?

A

firstName
numNotebooks
course