Question

c++ 3- What is the output of the following pseudocode, where num1 , num2 , and...

c++

3- What is the output of the following pseudocode, where num1 , num2 , and num3 are integer variables?

num1 = 5

num2 = 1

num3 = 4

aQueue.enqueue(num2)

aQueue.enqueue(num3)

aQueue.dequeue()

aQueue.enqueue(num1 - num2)

num1 = aQueue.peek()

aQueue.dequeue()

num2 = aQueue.peek()

aQueue.dequeue()

cout << num2 << " " << num1 << " " << num3 << endl

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

Output is

4 4 4

> Please provide explanation

Nancy Rana Thu, Dec 16, 2021 11:24 PM

Add a comment
Know the answer?
Add Answer to:
c++ 3- What is the output of the following pseudocode, where num1 , num2 , and...
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
  • Please answer in plain text. Determine the C++ output for the following: Assume: int num1 =...

    Please answer in plain text. Determine the C++ output for the following: Assume: int num1 = 25,   num2 = 5,   num3 = 10;          a.    cout<< “ The product is “ << num1 * num3;                 ________________________________________________________ b.     cout<< “ The total of the three numbers is: “ <<(num1+num2+num3);          ________________________________________________________ c.     cout<< “ The total is: “ <<(num1+254.3373);                 _________________________________________________________ d.     cout << num1 << “ +  “    << num2 << “ = ” << num1 + num2;                _________________________________________________________ e.    cout << “ This is how the output...

  • Consider the mathematical expression (num1 + num2) × (num3 − num4). We have been asked to...

    Consider the mathematical expression (num1 + num2) × (num3 − num4). We have been asked to replace num1, num2, num3 and num4 by numbers between 1 and 35, i.e. numbers from the set {1, . . . , 35}, so that after substituting these numbers in place of num1, num2, num3 and num4, the evaluation of the expression using PEDMAS leads to an odd positive integer. Find the number of ways in which this can be done. For example, one...

  • So the assignment is to write a program that have the user entered 3 numbers and...

    So the assignment is to write a program that have the user entered 3 numbers and than it will sort it by ascending order. Here are the code I wrote, but it won't compiled and I kept on getting an error message "Using uninitiazed memory" for all the variables. Can someone please help take a look and see whats going on? #include <iostream> using namespace std; int main() { //variables int num1, num2, num3; int lowest, middle, highest; //user inputs...

  • I couldn't find where to comment. But it has to be written in C++!!!!! Task-1: Rational...

    I couldn't find where to comment. But it has to be written in C++!!!!! Task-1: Rational fractions are of the form a / b, in which a and b are integers and ! ≠ 0. In this exercise, by ‘‘fractions’’ we mean rational fractions. Suppose a / b and c / d are fractions. Arithmetic operations and relational operations on fractions are defined by the following rules: Arithmetic Operations: a/b + c/d = (ad + bc)/bd a/b – c/d =...

  • Given the following code… var num1 = 31; var num2 = 96; var num3 = 22;...

    Given the following code… var num1 = 31; var num2 = 96; var num3 = 22; var temp = num2; num3 = temp + num1; num1 = num1 + num3 var num4 = num3 + 11; num2 = num2 + num4; var ans = num1 + num2 + num3; What is the final value that is assigned to ‘ans’?

  • Use assembly language to write a complete program that will input values fornum1 ,num2 and num3...

    Use assembly language to write a complete program that will input values fornum1 ,num2 and num3 and display the value of the expression ( (num1 ^ 3) * num2 + 5 * ( num2 ^ 2) ) / num3. assume that the user enters only numbers that are greater than zero and the calculation never exceed 4 bytes size. Sample run: num1 = 1 num2 = 2 num3 = 3 ((num1 ^ 3) * num2 + 5 * ( num2...

  • C++ Write a program that prompts the user to enter two positive integers: num1 and num2....

    C++ Write a program that prompts the user to enter two positive integers: num1 and num2. - Validate that num1 is less than num2 and that both numbers are positive. If any of these conditions are not met, allow the user to re-enter num1 and num2 until the input is determined valid. - For all integers from num1 through num2, print the word keyboard if the current integer is divisible by 2 and print the word mouse if the current...

  • This is an external javascript file // Problem 1:   Declare the variables num1, num2, ans1, //  ...

    This is an external javascript file // Problem 1:   Declare the variables num1, num2, ans1, //               greet1, greet2. Then initialize them to //               hold the values 1, 2, 0, "Hello", and //               "World", respectively. var num1 = 1; var num2 = 2; var ans1 = 0; var greet1 = "Hello"; var greet2 = "World"; // Problem 1a:   Display the values stored in the previous //               variables in the...

  • You have three integers (num1, num2, num3). Write an if…else statement that given these 3 integers...

    You have three integers (num1, num2, num3). Write an if…else statement that given these 3 integers prints the largest on

  • C Programming Given the following variable declarations and initializations: double num1 = 31.0; double num2 =...

    C Programming Given the following variable declarations and initializations: double num1 = 31.0; double num2 = 15.5; char letter = ‘A’; Do the following expressions evaluate to true or false? num1 > num2 || num2 < 0 num1 >= num2 * 2 && letter == ‘A’ num1 < num2 || letter != ‘X’ && num2 < num1 !(letter == ‘A’ || letter == ‘a’) num2 + num1 <= 50 && letter == ‘a’

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