ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 08 May 2017 My Price 8.00

The loop body instructions

Question 1.1. (TCO 5) The loop body instructions are always executed at least once using which loop structure? (Points : 3)
       While
       Do… While
       For
       Both A and C 

 

Question 2.2. (TCO 5) What (if anything) is wrong with the following loop?
            int x=3 ;
            while (x <10)
            {
                Console.WriteLine(x);
                x = x + 3;
            } (Points : 3)
       The loop body will never execute.
       It is an infinite loop.
       The loop control variable is not initialized.
       Nothing. 

 

Question 3.3. (TCO 5) Your program asks the user to enter a number between 1 and 5. Which is the correct condition for the following validation loop?
            int num;
            Console.Write("Please enter a number between 1 and 5:");
            num = Convert.ToInt32(Console.ReadLine());
            while (_____________________________)
            {
                Console.WriteLine("invalid, please reenter a number between 1 and 5: ");
                num = Convert.ToInt32(Console.ReadLine());
            } (Points : 3)
       num < 1 || num > 5
       num < 1 && num > 5
       num >= 1 && num <= 5
       num >= 1 || num <= 5 

 

Question 4.4. (TCOs 5 and 8) Which of the following pseudocode loops will print all the integers starting at 10 and counting down to 1. (Points : 5)
       num = 10
          while num >= 1
                   print num
                   num = num - 1
          end while
       num = 1
          while num <= 10
                   print num
                   num = num - 1
          end while
       num = 10
          while num >= 1
                   print num
          end while
       num = 10
          while num >= 10
                   print num
                   num = num - 1
          end while
 

  

 

Question 5.

5. (TCOs 5 and 8) Write the pseudocode for the flowchart below, and list what the output will be if the input for num is 9.
  (Points : 6)

 

Attachments:

Answers

(11)
Status NEW Posted 08 May 2017 05:05 AM My Price 8.00

-----------

Not Rated(0)