1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Harman [31]
4 years ago
10

When would the associated code block be executed for the statement: do {code block} while (condition)?

Computers and Technology
1 answer:
Dafna11 [192]4 years ago
8 0

Answer:

Once at the beginning of the loop, and then if the condition is true

Explanation:

  • This is a general do-while loop.
  • Minimum lifetime is 1 time and maximum lifetime is infinity.
  • Firstly the code in the do bracket runs without any condition.
  • The condition present in the while bracket tells the do bracket to run after the first time.
  • If the condition is false the module ends.
  • For while condition = true it sends the compiler back to do operation until the while condition becomes false.
You might be interested in
Consider a sequence of method invocations as follows: main calls m1, m1 calls m2, m2 calls m3 and then m2 calls m4, m3 calls m5.
Minchanka [31]

Answer:

M2 is the answer for the above question.

Explanation:

  • The above question states the scenario, where firstly main function calls the M1 function.
  • Then M1 function calls the function M2.
  • Then M2 function calls the function M3.
  • Then M3 function calls the function M5.
  • Then Again M2 function will resume and calls the function M4.
  • Then Again M2 function will resume because when the M4 will ends it return to the statement of the M2 function from which the M4 function has been called.
  • It is because when any function ends its execution it returns to that line of a statement from which it has been called. This is the property of programming language to call the function.
  • So when the M4 will terminate its execution then the M2 function will resume again.
4 0
3 years ago
I need help writing a recursion function to solve a boggle game for c++.
Mandarinka [93]

Answer:

#include <cstring>

#include <iostream>

using namespace std;

 

#define A 3

#define B 3

 

// LET US CREATE A DICTIONARY

string dict[] = { "KILLS", "GOT", "QUIZ", "GO" };

int n = sizeof(dict) / sizeof(dict[0]);

 

// Let us make a function to find whether a given word is present in dictionary.

bool isPresent(string& str)

{

   // linear search of words

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

       if (str.compare(dict[i]) == 0)

           return true;

   return false;

}

 

// A function for printing all words present on Boggle

void findWordin(char bogle[A][B], bool hasbeenvisited[A][B], int i,

                  int j, string& str)

{

   hasbeenvisited[i][j] = true;

   str = str + bogle[i][j];

 

   // If str is in the dictionary, then you need to print it

   if (isPresent(str))

       cout << str << endl;

 

   // Travering adjacent 8 cells of the boggle

   for (int r = i - 1; r <= i + 1 && r < A; r++)

       for (int c= j - 1; c <= j + 1 && c < B; c++)

           if (r >= 0 && c >= 0 && !hasbeenvisited[r][c])

               findWordin(bogle, hasbeenvisited, r, c, str);

 

   // for erasing current characters on the string, and mark them visited

   // of the current cells to false  

   str.erase(str.length() - 1);

   hasbeenvisited[i][j] = false;

}

 

// Prints all words which are in dictionary.

void findWords(char boggle[A][B])

{

   // for marking all the characters as not being visited

   bool hasbeenvisited[A][B] = { { false } };

 

   // Initializing the present string

   string str = "";

 

   // Reading all the characters for finding all the words that begins with the above character

   for (int i = 0; i < A; i++)

       for (int j = 0; j < B; j++)

           findWordin(boggle, hasbeenvisited, i, j, str);

}

 

// the code for testing of the function

int main()

{

   char bogle[A][B] = { { 'k', 'I', 'L' },

                         { 'L', 'S', 'M' },

                         { 'G', 'O', 'T' } };

 

   cout << "Below list of words are present in the dictionary\n";

   findWords(bogle);

   return 0;

}

Explanation:

The program is properly commented, and that explains each step of it.  However, I have kept dictionary as constant for similifying the code. And it can be set to variable easily, if required.

7 0
3 years ago
Which soil horizon has the most organic material?<br><br> O<br> A<br> B<br> C
denis23 [38]
THE CORRECT ANSWER IS a
3 0
4 years ago
Read 2 more answers
A disk rotates at a rate of 7200 revolutions per minute. Seek operations (i.e., moving the access head to a desired track) take
Leno4ka [110]

Answer:

24.167 micro seconds.

Explanation:

The given rotation rate = 7200 rpm = 7200 rounds per minute

Rotational latency is the average time taken for the head to reach starting of sector .

Rotational latency (in micro seconds) = (1 / (RPM / 60)) * 0.5 * 1000

(1/(7200/60))* 0.5 * 1000 = 4.167 ms

Thus, rotational latency = 4.167 ms.

Seek time = 20 ms

The average time taken for the access head to get to the beginning of randomly selected sector will be equal to the average time to first reach the random track plus the average time taken to reach random sector .

= 20 ms + 4.167  ms  = 24.167 micro seconds.

Thus, it would take 24.167 micro seconds to get the access head to the beginning of a randomly selected sector on a randomly selected track.

8 0
4 years ago
Name and describe methods of inplementing a new computer system. For each one describe the type of situation where each method m
Sunny_sXe [5.5K]

this is the answer hope it will help you

6 0
3 years ago
Other questions:
  • ___________ is the ability of a product to satisfy a customer.
    11·1 answer
  • In a database list, fields are displayed as _____. rows columns tables records
    10·1 answer
  • 17. Which of the following game development companies is credited with launching and perfecting the sports simulation genre?
    5·1 answer
  • 3.2 code practice question 2. Not in a rush.​
    15·1 answer
  • H. What is recycle bin?<br>-&gt;​
    10·1 answer
  • ~ I already know this ~ who was the bits victim in five nights at freddys 4 <br> ___10 points___
    12·2 answers
  • Ang Kabihasnang ito ay umusbong sa rehiyon ng Timog Mexico
    6·1 answer
  • The software that requests mail delivery from the mail server to an Internet device is known as mail ____ software.
    6·1 answer
  • Help me with this someone hurry due in 8 mins
    14·1 answer
  • what is a simulation? a) simulation is the process of creating dashboards in excel. b) simulation is the process of complex form
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!