Question

15. Which one of the following two conditional statements is correct in determining if m falls outside a range of values, (m

0 0
Add a comment Improve this question Transcribed image text
Answer #1

15.

a) if(m < 0 || m > n) implies m is less than 0 or greater than n

b) if(m <= 0 && m > n) implies m is less than equals to 0 and m is greater than n i.e. m does not lie within a range[0,n)

c) if(0 <= m || m < n) implies m is greater than equals to 0 or m is less than n

d) if(0 <= m && m < n) implies m is greater than equals to 0 and m is less than n i.e. m lies within a range of [0,n)

We want m to fall outside a range therefore option d suits the best as not(m <= 0 || m > n) = not(m <= 0) and not(m > n) by de Morgan's Law.

d is the correct choice

16) The goto statement is used inside a loop to send control of the program to the last line of the code inside a loop.

17) If there is a section of a program that needs to be executed repeatedly, it is best handled by putting it into a loop

18) Control of the program can be transferred to the first line of the code outside a loop by using a break statement.

19) A loop that is executed repeatedly without ending is called an infinite loop.

20) In a typical for loop expression3 is used to increment the counting variable.

for(int i = 0; i < n; i++) // example

21) While loop evaluates the controlling expression before it executes the loop.

Hope this helps you. Thank you :)

Add a comment
Know the answer?
Add Answer to:
15. Which one of the following two conditional statements is correct in determining if m falls...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 1 Which statement results in the value false? The value of count is 0; limit...

    QUESTION 1 Which statement results in the value false? The value of count is 0; limit is 10. (count != 0)&&(limit < 20) (count == 0)&&(limit < 20) (count != 0)||(limit < 20) (count == 0)&&(limit < 20) 10 points    QUESTION 2 If this code fragment were executed in an otherwise correct and complete program, what would the output be? int a = 3, b = 2, c = 5 if (a > b) a = 4; if (...

  • java QUESTION 4 Which of the following statements about a do...while repetition statement is true? A....

    java QUESTION 4 Which of the following statements about a do...while repetition statement is true? A. The body of a do...while loop is executed only if the terminating condition is true. B. The body of a do...while loop is executed only once. C. The body of a do...while loop is always executed at least once. D. None of the above QUESTION 5 To exit out of a loop completely and change the flow of control to the first line after...

  • (Write or type in answers, except for problem #15, which should be entered as a small...

    (Write or type in answers, except for problem #15, which should be entered as a small program, tested, and submitted in Repl.it) 1. Write a Python statement to define a list named temps using the following elements, in order: 95, 100, 77, 54, 103, 82 2. a) What is the length of the list temps? b) What Python function can be used to obtain the length of the list? Use it in a statement to obtain the length of temps...

  • Form B 29. Which of the following statements about the continue statement is true a. The...

    Form B 29. Which of the following statements about the continue statement is true a. The continue statement is used to exit a repetition structure early and continue the execution of the statements following the loop. b. The continue statement is used to continue after a switch statement c. The continue statement does not alter the flow of control d. A continue statement proceeds with the next iteration of the immediately enclosing loop. e. None of the above 30. Inside...

  • Matlab ( True or False questions ) Statement while - end does not need a "conditional...

    Matlab ( True or False questions ) Statement while - end does not need a "conditional expression" Given a recursive problem, there is only one way to program a while - end loop A while - end loop will run forever unless one statement alters the "conditional expression" The loop while -9 == -9 end will not run forever Counting by one is always done by statement i = i + 1 Dividing 1 by 27 can be accomplished by...

  • 31. The following code segment is syntactically correct:              int number{20};          cout << number <<...

    31. The following code segment is syntactically correct:              int number{20};          cout << number << setbase(16) << " " << number                               << setbase(10) << " " << number                                 << showpos << " " << number << endl;                 T__   F__       32. The following statement wants to determine if ‘count’ is outside the     range of 0 through 100:             if (count < 0 && count > 100)                                             T__   F__ 33. There is...

  • Select the correct answer. (1)     Which of the following will open a file named MyFile.txt and...

    Select the correct answer. (1)     Which of the following will open a file named MyFile.txt and allow you to read data from it?                (a)      File file = new File("MyFile.txt");           (b)      FileWriter inputFile = new FileWriter();           (c)       File file = new File("MyFile.txt");                      FileReader inputFile = new FileReader(file);           (d)      FileWriter inputFile = new FileWriter("MyFile.txt"); (2)     How many times will the following do - while loop be executed?                      int x = 11;             do {             x...

  • C++ PROGRAM ONLY! For this lab you need to write a program that will read in...

    C++ PROGRAM ONLY! For this lab you need to write a program that will read in two values from a user and output the greatest common divisor (using a recursive implementation of the Euclidean algorithm) to a file. In Lab #3, you implemented this program using an iterative method. Greatest Common Divisor In mathematics, the greatest common divisor (GCD) of two or more integers (when at least one of of them is zero then the larger value is the GCD....

  • this is true and false for C++ (1 point each) Circle T for true or F...

    this is true and false for C++ (1 point each) Circle T for true or F for false for the following questions. 1. T/F The Boolean expression b1 || b2 evaluates to true if either Boolean value (b1, b2) is true. T/F The code we write in C++ (e.g. code in file project1.cpp) is referred to as source code. 2. 3. T/F The statement float scores[3][3] creates 3 arrays, each containing 3 floating-point variables. T/F For loops work best when...

  • Finish the following program which adds up all integers from 0 to the user's given number inclusively using a While Loop

    // Finish the following program which adds up all integers from 0 to// the user's given number inclusively using a While Loop. The total should be// assigned to the variable 'total'.#includeusing namespace std;int main() {int number;int total = 0;int counter = 0; //initialize the variable// user enters a numbercout << "Enter a positive integer to find the summation of ";cout << "all numbers from 0 to the given number up to 100." << endl;cin >> number;// check for invalid user...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT