MIDTERM Flashcards

1
Q

Java is a ____-level, ______-oriented programming language

A

high-level and object-oriented

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

Java is designed to be
1. S
2. P
3. E

A

Simple, Portable, and Efficient

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

Java uses ___-built components to enhance efficiency

A

pre-built components

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

What is the meaning of WORA?

A

Write Once, Run Anywhere

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

What can Java do? It is a _______-purpose language.

A

General-purpose language used for
- Web applications
- Mobile applications
- Desktop software

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

Why use Java?
1. R
2. S
3. S

A

Robust, Secure, and Simple

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

Java is _____-based promoting code ___________.

A

Code-based promoting Code Reusability

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

Java runs in a secure environment. It converts bytecode into machine code.

A

Java Virtual Machine

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

Faster than other languages due to JIT compiler. Meaning of JIT?

A

Just-In-Time compiler

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

Where is Java code compiled into?

A

bytecode

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

What is a small Java program embedded in a web page?

A

Java Applet

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

What is a Java Application?

A

Full-fledge java program that runs on an operating system

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

Java Application requires this to execute. It provides libraries and JVM to run Java Programs

A

Java Runtime Environment

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

A software development kit used to develop Java applications

A

Java Development Kit

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

A rich set of built-in libraries supporting file handline, network, etc.

A

Java Class Libraries / APIs

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

it defines the rules for writing Java programs

A

Syntax

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

Every Java statement must be within a ____, which starts with an uppercase letter.

A

Class

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

Every statement in Java must conclude with a _________.

A

Semicolon (;)

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

It defines a class named Main

A

public class Main

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

The main method where execution starts

A

public static void main (String[] args)

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

Prints output to the console

A

System.out.println(“Hello, Java!”);

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

[TYPES OF COMMENTS]
Used for short explanations

A

Single-line comments (//)

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

[TYPES OF COMMENTS]
Use for longer descriptions

A

Multi-line comments (/* … */)

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

[TYPES OF COMMENTS]
Use for generating documentation

A

Javadoc comments (/** … */)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
These are names given to variables, methods, classes, etc.
Java Identifiers
26
[TRUE OR FALSE] Is Java case-sensitive?
True
27
[TRUE OR FALSE] Identifiers must not begin with a letter, $, or _ (not a number).
False. It MUST begin with a letter, $, or _
28
[TRUE OR FALSE] Identifiers cannot be a Java keyword.
True
29
What are reserved words that have special meanings in Java?
Java Keywords
30
[TRUE OR FALSE] Java Keywords can be used as identifiers.
False. It CANNOT be used as identifiers.
31
What are constant values assigned to variables directly in a code?
Java Literals
32
[TRUE OR FALSE] Java literals remain unchanged during program execution.
True
33
[TYPES OF JAVA LITERALS] Whole number belonging to the int data type
Integral Literals
34
[TYPES OF JAVA LITERALS] Represents decimal numbers.
Floating-Point Literals
35
[TYPES OF JAVA LITERALS] Only True or False
Boolean Literals
36
[TYPES OF JAVA LITERALS] Represents a single character.
Character Literals
37
[TYPES OF JAVA LITERALS] Represent a sequence of characters.
String Literals
38
[TYPES OF INTEGRAL LITERALS] Uses digits 0-9, no prefix.
Decimal (Base-10)
39
[TYPES OF INTEGRAL LITERALS] Uses digits 0-7, prefixed with 0.
Octal (Base-8)
40
[TYPES OF INTEGRAL LITERALS] Uses digits 0-9 and A-F, prefixed with 0x.
Hexadecimal (Base-16)
41
[TYPES OF INTEGRAL LITERALS] Uses only 0 and 1, prefixed with 0b.
Binary (Base-2)
42
[TYPES OF FLOATING-POINT LITERALS] The default type for decimals. Offers about 15-16 digits of precision. High precision but uses more memory.
Double
43
[TYPES OF FLOATING-POINT LITERALS] Less precision but uses less memory. Offers about 7 digits of precision. Requires f or F suffix.
Float
44
[TRUE OR FALSE] Java does accept 0 or 1 as boolean values.
False. Java DOES NOT accept 0 or 1 as boolean values
45
[TRUE OR FALSE] Character literals are enclosed in double quotes (" ").
False. It is enclosed in single quotes (' ') only.
46
[TRUE OR FALSE] Character literals supports escape sequences (e.g. \n, \t, \\, etc.)
True
47
[TRUE OR FALSE] String literals are enclosed in single quotes (' ').
False. It is enclosed in double quotation (" ")
48
[TYPES OF DATA TYPES] Fundamental types that cannot be broken down further.
Primitive Data Types
49
[TYPES OF DATA TYPES] Reference data types that store memory addresses.
Non-primitive data types
50
These stores data that can be manipulated throughout a program.
Variables
51
It defines the TYPE of data stored. (e.g. int, String, float, etc.)
Data Type
52
It identifies the variable. What the variable is called.
Variable name
53
The assigned data in a variable
Value
54
[TYPES OF VARIABLES] Declared inside a method; only accessible within that method
Local Variable
55
[TYPES OF VARIABLES] Declared within a class but outside methods; unique to each instance.
Instance Variable
56
[TYPES OF VARIABLES] Declared with the static keyword; shared among all instances.
Static Variable
57
These are values that do not change during program execution.
Constants
58
What keyword must be used to declare constants?
final
59
Difference between Variables and Constants?
Variable: values CAN change Constant: values CANNOT change after initializatio
60
What are symbols used to perform operations on variables and values.
Java Operators
61
[TYPES OF JAVA OPERATORS] It performs mathematical calculations (addition, subtraction, etc.)
Arithmetic Operators
62
[TYPES OF JAVA OPERATORS] Used to compare values (Equal to, not equal to, etc.)
Relational Operators
62
[TYPES OF JAVA OPERATORS] Used for boolean logic (AND, OR, NOT)
Logical Operators AND (&&) OR (!!) NOT (!)
63
[TYPES OF JAVA OPERATORS] Used to assign values to variables (assign, add and assign, subtract and assign, etc.)
Assignment Operators
64
[TYPES OF JAVA OPERATORS] Used to operate on a single operand (increment, decrement, invert)
Unary Operators
65
[TYPES OF JAVA OPERATORS] Used to shift bit positions (left shift, right shift, etc.)
Shift Operators
66
[TYPES OF JAVA OPERATORS] Shorthand for if-else statements.
Ternary Operator
67
A combination of variables, operators, and method invocations that evaluate to a single value.
Java Expressions
68
It determines the order in which operators are evaluated in an expression.
Operator Precedence