Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This activity has two phases: 1. Discussion Phase: a. Agree on a time to meet wi

ID: 3756349 • Letter: T

Question

This activity has two phases: 1. Discussion Phase: a. Agree on a time to meet with your group members online on Discord for discussion. b. Discuss with your group members in the appropriate Discord channel ex: (#group-a activity3-6) each of these questions. 2. Answering Phase: a. Navigate Canvas until you find Activity 3.6 submission located under Modules. Submit an answer to each of the questions mentioned below in the provided Text box individually. Use the following format for your answer submission on Canvas: Question 1: What is the value of this "if statement" condition: (a>b+? True or False? A program is given to you below. First, observe the program, but don't write anything just yet. This may look like the one from class, however it now has an else section added. This will change the way the

Explanation / Answer

Question 1

The value is false. 5>4 is true. Note : b++ is a post-increment operator. b>a++ is true. But on negating the expression becomes false.

Question 2

c% 2 is zero. This means that c is false.

Question 3

Yes, there is a compile error. By default, the if statement takes only one statement. If we want multiple statements inside the if statement, we need to enclose it in a curly brace. Here we need to enclose the three print statements after the if statement inside curly brace to fix the compile-time error.

Question 4

There is no runtime error.

Question 5

The program runs after fixing the compile-time error as mentioned in Question 3. Yes , on changing the values a, b and c, a logical error would occur, if the ifelse statement is executed. This is because it is divide by zero error. We need to remove this statement from inside the if else statement to fix the error.

Question 6

Yes, the program is error free now.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote