preFinals ComPro1 Flashcards

(52 cards)

1
Q

is a statement that is used to control the flow of a program.

A

Control structures

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

There are two (2) control structures:

A

Selection structures
Repetition structures

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

the program executes particular statements depending on the given condition. This alters
the flow of program execution by making a selection or choice.

A

Selection structures

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

the program repeats particular statements a certain number of times, depending on the given condition.

A

Repetition structures

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

Java provides three (3) selection structures:

A

if and if…else statements and switch statement.

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

statements are used to create one-way, two-way, and multiple selections.

A

if and if..else statements

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

is used to test a single
variable against a series of values.

A

Switch statement

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

is a reserved word, followed by the expression enclosed in parentheses.
The expression can be a relational or a logical expression that returns either true or false value.

A

if statement

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

are used to choose between two (2) alternatives.

A

Two way selection

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

are incorporated using the if statement.

A

One way selections

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

is used to implement twoway selections in Java.

A

if…else statements

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

– these are any kind of statements grouped together within curly braces.

A

Compound Statements or block of statements

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

When one (1) control statement, either selection or repetition, is located within another, it is said to be nested.

A

Multiple selections

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

When one (1) control statement, either selection or repetition, is located within another, it is said to be nested.

A

Multiple selections

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

is a process in which the computer evaluates a logical expression from left to right and stops as
soon as the value of the expression is determined.

A

Short-Circuit Evaluation

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

These logical are short-circuit operators: (2 items)

A

AND &&
OR ||

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

statement allows a single variable to be tested for equality against a list of values and, depending on its value,
executes a certain block of statements.

A

Switch statement

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

The variable used in a switch statement can only be type:

A

int, byte, short, char, and String

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

Java provides three (3) repetition (or looping) structures that are used to execute a block of statements repeatedly:

A

while,
for, and do…while loop. while, for, and do.. are all reserved words.

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

loop repeats a block of statements while a given condition evaluates to true. It evaluates the condition before executing the loop body.

A

While loop

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

loop that continues to execute endlessly is called

A

Infinite loop

22
Q

executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. It is used when a definite number of loop iterations is required.

23
Q

indicates the starting value for the loop control variable

A

Initialization

24
Q

the loop condition that controls
the loop entry

25
is the expression that alters the loop control variable
Update
26
The following is the flow of control in a for loop:
1. The initialization executes first and only once. 2. The condition is evaluated. If the loop condition evaluates to false, the loop terminates. If it evaluates to true: a. Execute the loop body of for. b. Update the loop control variable. 3. Repeat Step 2 until the loop condition evaluates to false.
27
is similar to a while loop, except that it executes the loop body first before evaluating the expression
Do while loop
28
terminates the loop or switch statement and transfers the flow of the program to the statements following the loop or switch.
Break
29
causes the loop to skip the remainder of its body and immediately reevaluate its condition, and proceeds with the next iteration of the loop.
Continue
30
the continue statement causes the control of the loop to immediately jump to the update statement, and then the loop condition is evaluated.
For loop
31
using the continue statement makes the control of the loop immediately jumps to the loop condition.
While Do while loop
32
are effective ways to avoid extra variables to control a loop and produce a clean program.
Break and continue statements
33
are control statements that are placed within another.
Nested control structures
34
is a sequence of characters
String
35
Every character in a string has a specific position in the string, and the position of the first character starts at index ____
index 0
36
is used to compare the content of two (2) strings.
equals()
37
The relational operator _______ is used to compare the references of two (2) objects
(==)
38
provides methods to perform operations on strings.
String class/methods
39
Returns the character of a string based on the specified index
charAt(index:)
40
Compares a string with another string. The method returns 0 if the string is equal to the other string. A value less than 0 is returned if the string is less than the other string (less characters) and a value greater than 0 if the string is greater than the other string (more characters).
compareTo()
41
Returns a new string concatenated with the value of the parameter
concat()
42
Returns true if this string and the specified string are equal; otherwise, returns false
equals()
43
Returns true if this string and the specified string are equal, considering the uppercase and lowercase versions of a letter to be the same; otherwise, returns false
equalsIgnoreCase()
44
Returns the index of the first occurrence of the specified string within this string. If not found, the method returns -1.
indexOf(string)
45
Returns the index of the last occurrence of the specified string within this string. If not found, the method returns -1.
lastIndexOf(String)
46
Returns the length of the string in int type
length()
47
Returns a new string having the same characters as this string, but with any uppercase letters converted to lowercase. The content of this String object is unchanged.
toLowerCase()
48
Returns a new string having the same characters as this string, but with any uppercase letters converted to uppercase. The content of this String object is unchanged.
toUpperCase()
49
Returns a new string having the same characters as this string, but with each occurrence of specified old_char replaced by new_char. The content of this String object is unchanged
replace(old_Char, new_Char)
50
Returns a new string having the same characters as the substring begins at specified start index through to the end of the string. The content of this String object is unchanged
substring(start_index)
51
Returns a new string having the same characters as the substring that begins at specified index start through to but not including the character at index end. The content of this String object is unchanged.
substring(start, end)
52
Returns a new string having the same characters as this string, but with leading and trailing whitespace removed.
trim()