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
Q

These are names given to variables, methods, classes, etc.

A

Java Identifiers

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

[TRUE OR FALSE]
Is Java case-sensitive?

A

True

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

[TRUE OR FALSE]
Identifiers must not begin with a letter, $, or _ (not a number).

A

False. It MUST begin with a letter, $, or _

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

[TRUE OR FALSE]
Identifiers cannot be a Java keyword.

29
Q

What are reserved words that have special meanings in Java?

A

Java Keywords

30
Q

[TRUE OR FALSE]
Java Keywords can be used as identifiers.

A

False. It CANNOT be used as identifiers.

31
Q

What are constant values assigned to variables directly in a code?

A

Java Literals

32
Q

[TRUE OR FALSE]
Java literals remain unchanged during program execution.

33
Q

[TYPES OF JAVA LITERALS]
Whole number belonging to the int data type

A

Integral Literals

34
Q

[TYPES OF JAVA LITERALS]
Represents decimal numbers.

A

Floating-Point Literals

35
Q

[TYPES OF JAVA LITERALS]
Only True or False

A

Boolean Literals

36
Q

[TYPES OF JAVA LITERALS]
Represents a single character.

A

Character Literals

37
Q

[TYPES OF JAVA LITERALS]
Represent a sequence of characters.

A

String Literals

38
Q

[TYPES OF INTEGRAL LITERALS]
Uses digits 0-9, no prefix.

A

Decimal (Base-10)

39
Q

[TYPES OF INTEGRAL LITERALS]
Uses digits 0-7, prefixed with 0.

A

Octal (Base-8)

40
Q

[TYPES OF INTEGRAL LITERALS]
Uses digits 0-9 and A-F, prefixed with 0x.

A

Hexadecimal (Base-16)

41
Q

[TYPES OF INTEGRAL LITERALS]
Uses only 0 and 1, prefixed with 0b.

A

Binary (Base-2)

42
Q

[TYPES OF FLOATING-POINT LITERALS]
The default type for decimals. Offers about 15-16 digits of precision. High precision but uses more memory.

43
Q

[TYPES OF FLOATING-POINT LITERALS]
Less precision but uses less memory. Offers about 7 digits of precision. Requires f or F suffix.

44
Q

[TRUE OR FALSE]
Java does accept 0 or 1 as boolean values.

A

False. Java DOES NOT accept 0 or 1 as boolean values

45
Q

[TRUE OR FALSE]
Character literals are enclosed in double quotes (“ “).

A

False. It is enclosed in single quotes (‘ ‘) only.

46
Q

[TRUE OR FALSE]
Character literals supports escape sequences (e.g. \n, \t, \, etc.)

47
Q

[TRUE OR FALSE]
String literals are enclosed in single quotes (‘ ‘).

A

False. It is enclosed in double quotation (“ “)

48
Q

[TYPES OF DATA TYPES]
Fundamental types that cannot be broken down further.

A

Primitive Data Types

49
Q

[TYPES OF DATA TYPES]
Reference data types that store memory addresses.

A

Non-primitive data types

50
Q

These stores data that can be manipulated throughout a program.

51
Q

It defines the TYPE of data stored. (e.g. int, String, float, etc.)

52
Q

It identifies the variable. What the variable is called.

A

Variable name

53
Q

The assigned data in a variable

54
Q

[TYPES OF VARIABLES]
Declared inside a method; only accessible within that method

A

Local Variable

55
Q

[TYPES OF VARIABLES]
Declared within a class but outside methods; unique to each instance.

A

Instance Variable

56
Q

[TYPES OF VARIABLES]
Declared with the static keyword; shared among all instances.

A

Static Variable

57
Q

These are values that do not change during program execution.

58
Q

What keyword must be used to declare constants?

59
Q

Difference between Variables and Constants?

A

Variable: values CAN change

Constant: values CANNOT change after initializatio

60
Q

What are symbols used to perform operations on variables and values.

A

Java Operators

61
Q

[TYPES OF JAVA OPERATORS]
It performs mathematical calculations (addition, subtraction, etc.)

A

Arithmetic Operators

62
Q

[TYPES OF JAVA OPERATORS]
Used to compare values (Equal to, not equal to, etc.)

A

Relational Operators

62
Q

[TYPES OF JAVA OPERATORS]
Used for boolean logic (AND, OR, NOT)

A

Logical Operators
AND (&&)
OR (!!)
NOT (!)

63
Q

[TYPES OF JAVA OPERATORS]
Used to assign values to variables (assign, add and assign, subtract and assign, etc.)

A

Assignment Operators

64
Q

[TYPES OF JAVA OPERATORS]
Used to operate on a single operand (increment, decrement, invert)

A

Unary Operators

65
Q

[TYPES OF JAVA OPERATORS]
Used to shift bit positions (left shift, right shift, etc.)

A

Shift Operators

66
Q

[TYPES OF JAVA OPERATORS]
Shorthand for if-else statements.

A

Ternary Operator

67
Q

A combination of variables, operators, and method invocations that evaluate to a single value.

A

Java Expressions

68
Q

It determines the order in which operators are evaluated in an expression.

A

Operator Precedence