Module 1 (Prelim) Flashcards

1.1 Overview 1.2 Comparing Procedural and Object Oriented Programming Concepts 1.3 Creating Java 1.4 Using Data 1.5 Arithmetic Operators 1.6 Understanding Type Conversion

1
Q

Sets of operations executed in sequence

A

Procedural programming

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

Named computer memory locations that hold values

A

Variables

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

Two popular approaches to writing computer programs are

A
  • procedural programming
  • object-oriented programming
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Individual operations grouped into logical units

A

Procedures

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

is an extension of procedural programming in which you take a slightly different approach to writing computer programs.

A

Object-Oriented Programming

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

Writing object-oriented programs involves: (3)

A
  • Creating classes, which are blueprints for objects
  • Creating objects, which are specific instances of those classes
  • Creating applications that manipulate or use those objects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Understanding object-oriented programming requires grasping three basic concepts:

A
  • Encapsulation as it applies to classes as objects
  • Inheritance
  • Polymorphism
  • Abstraction (just in case)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

a term that describes a group or collection of objects with common properties.

A

Class

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

describes what attributes its objects will have and what those objects will be able to do.

A

class definition

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

are the characteristics that define an object; they are PROPERTIES of the object.

A

Attributes

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

An ___________ is a specific, concrete INSTANCE of a class.

A

object

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

Creating an instance is called _______

A

instantiation

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

is a set of written instructions that tells the computer what to do

A

Computer Program

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

Machine language is a ___________ programming language

A

low-level

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

allows you to use a vocabulary of reasonable terms

A

high-level programming language

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

set of rules for the language

A

syntax

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

translates language statements into machine code

A

compiler/interpreter

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

misuse / misspelled programming language

A

syntax error

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

freeing program from errors

A

debugging

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

Understanding Classes, Objects, and Encapsulation:
Which stands for class, object, and properties for the example below?

Dog:
Breed:
Gender and age:

A

Dog: class
Breed: object
Gender and age: properties

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

The values of the properties of an object are referred to as the object’s ___________

A

state

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

Besides defining properties, classes define ___________ their objects can use.

A

methods

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

is a self-contained block of program code that carries out some action, similar to a procedure in a procedural program.

A

method

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

if objects are similar to nouns, then methods are similar to verbs. (True or False)

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
In object-oriented classes, attributes and methods are encapsulated into _________ A) class B) objects C) properties
B) objects
26
Encapsulation refers to two closely related object-oriented notions:
- Encapsulation is the enclosure of data and methods within an object. - Encapsulation also refers to the concealment of an object’s data and methods from outside sources.
27
is the enclosure of data and methods within an object.
Encapsulation
28
allows you to treat all of an object’s methods and data as a single entity. Just as an actual dog contains all of its attributes and abilities, so would a program’s Dog object.
Encapsulation
29
also refers to the concealment of an object’s data and methods from outside sources.
Encapsulation
30
lets you hide specific object attributes and methods from outside sources and provides the security that keeps data and methods safe from inadvertent changes.
Encapsulation
31
Concealing data is sometimes called _________, and concealing how methods work is _________
- information hiding - implementation hiding.
32
the ability to create classes that share the attributes and methods of existing classes, but with more specific features.
inheritance
33
means “many forms”—it describes the feature of languages that allows the same word or symbol to be interpreted correctly in different situations based on the context.
polymorphism
34
In a GUI application, it is convenient to remember one method name, such as _________or _________, and have it work correctly no matter what type of object you are modifying.
setColor setHeight
35
Define a Java class using any name or _________
identifier
36
Requirements for identifiers: (5)
- Must begin with one of the following: * Letter of the English alphabet * Non-English letter (such as α or π) * Underscore * Dollar sign - Cannot begin with a digit
37
Identifiers can only contain: (4)
Letters Digits Underscores Dollar signs
38
Single-line comments in Java ________ A) starts with // B) starts with /* and ends with */ C) starts with # D) starts with // and ends with //
A) starts with //
39
Multi-line comments in Java ________ A) starts with // B) starts with /* and ends with */ C) starts with # D) starts with // and ends with //
B) starts with /* and ends with */
40
Identifiers can be a Java reserved keyword (True or False)
F Cannot be a Java reserved keyword
41
The line "public class ClassName" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { Statement(s); } } A) class definition/ class header B) main method header C) body of the main method D) access specifier E) keyword that defines ClassName as class F) name of the class
A) class definition/ class header
42
The line " public static void main(String[] args) " is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { Statement(s); } } A) class definition/ class header B) main method header C) body of the main method D) access specifier E) keyword that defines ClassName as class F) name of the class
B) main method header
43
The line " Statement(s); " is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { Statement(s); } } A) class definition/ class header B) main method header C) body of the main method D) access specifier E) keyword that defines ClassName as class F) name of the class
C) body of the main method
44
defines the circumstances under which a class can be accessed and the other classes that have the right to use a class.
access specifier
45
is the most liberal type of access specifier.
Public access
46
The term "public" in "public class ClassName" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { Statement(s); } } A) class definition/ class header B) main method header C) body of the main method D) access specifier E) keyword that defines ClassName as class F) name of the class
D) access specifier
47
The term "class" in "public class ClassName" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { Statement(s); } } A) class definition/ class header B) main method header C) body of the main method D) access specifier E) keyword that defines ClassName as class F) name of the class
E) keyword that defines ClassName as class
48
The term "ClassName" in "public class ClassName" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { Statement(s); } } A) class definition/ class header B) main method header C) body of the main method D) access specifier E) keyword that defines ClassName as class F) name of the class
F) name of the class
49
static is a reserved keyword (True of False)
T
50
Means the method is accessible and usable even though no objects of the class exist
static
51
void is used in the class header (True of False)
F void is used in the main() main method header
52
Does not indicate the main() method is empty
void
53
Indicates the main() method does not return a value when called
void
54
Does not mean that main() doesn’t produce output
void
55
The "First Java Application" in "System.out.println("First Java Application");" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { System.out.println("First Java Application"); } } A) property of System class B) class C) literal string that is the argument to the method D) method
C) literal string that is the argument to the method
56
Method names are always followed by: A) () B) [] C) ""
A) ()
57
Every java statements ends with a ______
; semi-colon
58
The term "System" in "System.out.println("First Java Application");" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { System.out.println("First Java Application"); } } A) property of System class B) class C) literal string that is the argument to the method D) method
B) class
59
The term "out" in "System.out.println("First Java Application");" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { System.out.println("First Java Application"); } } A) property of System class B) class C) literal string that is the argument to the method D) method
A) property of System class
60
The term "println" in "System.out.println("First Java Application");" is the __________ in the program structure below: public class ClassName { public static void main(String[] args) { System.out.println("First Java Application"); } } A) property of System class B) class C) literal string that is the argument to the method D) method
D) method
61
Save the java class in a file with exactly the same name and __________ extension
.java
62
Compiling a Java Class: (3)
- Compile the source code into bytecode - Translate the bytecode into executable statements using a Java interpreter - Type javac First.java
63
To run a java application from the command line, type __________
java FileName
64
when its value cannot be changed while a program is running.
constant
65
How to declare named constant:
final datatype NAME = value;
66
- is a named memory location - Used to store a value - Can hold only one value at a time - Its value can change
Variable
67
How to declare a variable:
datatype varName = value;
68
What is the correct order of the java primitive data types: short char long float byte boolean int double
byte short int long float double char boolean
69
Boolean values:
True or False
70
Which among these java primitive data types belongs to the integer data types: byte short int long float double char boolean
byte short int long
71
What are the boolean data types: (6)
< > == <= >= !=
72
Is a data type that holds any single character
char
73
are written between double quotation marks
String constants
74
- A built-in class - Stores and manipulates character strings
String
75
Constant character values are placed within ________ quotation marks
single
76
Begins with a backslash followed by a character and represents a single nonprinting character
Escape sequence
77
Escape sequences: (7)
\b \t \n \r \" \' \\
78
also called semantic errors
logical errors
79
Scanner class makes System.in more flexible (True or False)
T
80
Import statement for the Scanner class:
import java.util.Scanner; or import java.util.*;
81
How to create a Scanner object:
Scanner inputDevice = new Scanner(System.in);
82
Scanner breaks input into units called _______; a set of characters that is separated from the next set by whitespace.
tokens
83
Scanner class methods: (8)
nextDouble() nextInt() nextLine() next() nextShort() nextByte() nextFloat() nextLong()
84
Arithmetic Operators: (5)
+ - * / %
85
Two types of division:
Integer division Floating-point division
86
Involves when either or both of the operands are floating-point values. The result is double. A) Integer division B) Division C) Floating-point division
C) Floating-point division
87
Involves integer constants or integer variables. The result is an integer and any fractional part of the result is lost. A) Integer division B) Division C) Floating-point division
A) Integer division
88
The _______ of an operator controls the order of evaluation of expressions involving the same operator, for example: 3 / 4 / 5
associativity
89
Associativity can be:
- left-to-right: the leftmost operator is applied first. - Right-to-left: the rightmost operator is applied first.
90
A high precedence means an operator is evaluated (applied) before any lower precedence operators. (True or False)
T
91
Which among the choices are of higher precedence in java? A) + - B) * / C) % D) * / %
D) * / %
92
Which among the choices are of lower precedence in java? A) + - B) * / C) % D) * / %
A) + -
93
The type to which all operands in an expression are converted for compatibility
Unifying type
94
Order for establishing unifying types between two variables (highest to lowest): long double int float
double float long int
95
Forces a value of one data type to be used as a value of another data type
Type casting
96
Using a cast operator is an _______
explicit conversion
97
Place desired result type in parentheses
Cast operator
98
allows programmers to write instructions in a language that is easier to understand than low-level languages.
High-level Programming Language
99
corresponds closely to a computer processor’s circuitry (0s and 1s) are used to write programs that relate to the specific architecture and hardware of a particular type of computer.
Low-level Programming Language
100
The program may run but provide inaccurate output
Logic errors