ITEC-2140 Programming Fundamentals Final Review

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play

1/14

flashcard set

Earn XP

Description and Tags

Flashcards covering review questions for ITEC-2140 Programming Fundamentals, including class design, array methods, loops, sentinel-controlled loops, conditional logic, and Scanner input handling.

15 Terms

1
New cards

Where must students submit their completed code for the ITEC-2140 Final Review assignments?

To GradeScope (they should not be submitted in D2L).

2
New cards

What attributes, constructor, and methods are required to be defined for the Pr1Purchase class?

Three attributes (location, description, and amount), a constructor with three parameters, setters and getters for each attribute, and a toString method.

3
New cards

How do Pr1PurchaseAppV1 and Pr1PurchaseAppV2 differ in how they create Pr1Purchase objects?

Pr1PurchaseAppV1 creates three Pr1Purchase objects directly in the main method with hardcoded data, whereas Pr1PurchaseAppV2 prompts the user for inputs to create the three objects.

4
New cards

What is the specified behavior of the search method in Pr2ArraySearch when searching for a key?

It searches the array for a given key and returns the index of the first occurrence of the key in the array (or −1-1 if the key is not found).

5
New cards

What statistics does the Pr3ArrayMethods program calculate and display after reading the array values?

It calculates and displays the total, average, maximum (max), and minimum (min) of the array elements.

6
New cards

In Question 4 (ScoreStatistics.java), what sentinel value terminates score input, and how is it handled during calculations?

The input sequence terminates with −1-1, and the sentinel value −1-1 must not be counted in the calculation of the average, maximum, or minimum scores.

7
New cards

What two methods must be implemented in Question 5 to compute the sequence 2,4,6,8,…,n2, 4, 6, 8, \dots, n?

sumToN(int n) and productToN(int n).

8
New cards

In Question 5, what are the resulting sum and product when the user enters the even integer n=16n = 16?

The sum is 7272 (2+4+⋯+16=722+4+\dots+16 = 72) and the product is 1032192010321920 (2×4×⋯×16=103219202 \times 4 \times \dots \times 16 = 10321920).

9
New cards

What two methods must be implemented in Question 6 to calculate repeated operations of vv over nn times?

sumOfValues(int n, double v) and productOfValues(int n, double v).

10
New cards

In Question 7 (BMI and HBA1C), under what specific condition should the program print "You are overweight or obese."?

When the BMI is greater than or equal to 25.025.0 (BMI≥25.0\text{BMI} \ge 25.0).

11
New cards

In Question 7 (BMI and HBA1C), under what specific condition should the program print "You may have diabetes."?

When the HBA1C level is over 5.7%5.7\% (HBA1C>5.7%\text{HBA1C} > 5.7\%).

12
New cards

According to the weight category table in Question 8, what are the BMI ranges for "Underweight" and "Normal"?

"Underweight" is BMI<18.5\text{BMI} < 18.5, and "Normal" is 18.5≤BMI<25.018.5 \le \text{BMI} < 25.0.

13
New cards

According to the weight category table in Question 8, what are the BMI ranges for "Overweight" and "Obese"?

"Overweight" is 25.0≤BMI<30.025.0 \le \text{BMI} < 30.0, and "Obese" is 30.0≤BMI30.0 \le \text{BMI}.

14
New cards

In Question 9 (Overtime Or Not), what are the conditions under which an employee is considered to have worked overtime?

If it is the weekend, any hours worked greater than 00 (hours>0\text{hours} > 0) is overtime. If it is not the weekend, it is overtime only if the hours worked is over 4040 hours (hours>40\text{hours} > 40).

15
New cards

In Question 10, why must Scanner's nextLine() method be used instead of next() when prompting for names?

next() only reads a single word, whereas nextLine() reads an entire line, allowing user inputs that contain multiple words separated by spaces.