Question
Reina has created a simple DVR application to record her favorite television programs, but her code has some bugs. Shes a big sports fan and
Reina has created a simple DVR application to record her favorite television programs, but her code has some bugs. She’s a big sports fan and always wants to record the broadcasts of sporting events, even if they conflict with another of her favorite programs.
For non-sport favorites, she does not want to record reruns; however, if the scheduled time of a favorite program conflicts with another favorite and will be broadcast again later, she wants to wait and record it in the future.
Unfortunately, her program is not working correctly. Many television programs that she doesn’t want are being recorded; the programs she DOES want are only being recorded if they are broadcast later.
The C# code (with line numbers added) of Reina’s DVR program looks like this:
1: if (isSportsEvent) {
2: RecordShowNow();
3: }
4: else {
5: if (!isConflict || !isRerun) {
6: RecordShowNow();
7: }
8: if (isConflict && isOnLater); {
9: RecordShowLater();
10: }
11: }
Requirement:
1. Which line is causing shows to be recorded now even if there is a conflict?
a. line 4
b. line 5
c. line 8
2. How should line 8 be rewritten?
a. if (isOnLater); {
b. if (isConflict || isOnLater); {
c. if (isConflict && isOnLater) {
3. Reina has placed two control structures (lines 5–7 and lines 8–10) inside her first control
structure. This techniqueis known as:
a. parenting
b. encapsulating
c. nesting
Step by Step Solution
3.30 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
1 Shows are being recorded now even if there is a conflict because b Line 5 The conditionalOR return...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started