Question

Read the following code and determine what is the decimal values of num1 and num2 after...

Read the following code and determine what is the decimal values of num1 and num2 after execution of the code.

short num1 = 25, num2 = 0x7A, temp ;

short *x; temp = num2; // num1 = ? num2 = ?

x = &num1; // num1 = ? num2 = ?

num2 = num1; // num1 = ? num2 = ?

*x = temp; // num1 = ? num2 = ?

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

short num1 = 25, num2 = 0x7A, temp;
short *x; temp = num2; // num1 = 25 num2 = 0x7A
x = &num1; // num1 = 25 num2 = 0x7A
num2 = num1; // num1 = 25 num2 = 25
*x = temp; // num1 = 0x7A num2 = 25
Add a comment
Know the answer?
Add Answer to:
Read the following code and determine what is the decimal values of num1 and num2 after...
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
  • 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’?

  • A.   Consider the following JavaScript code segment: message = ''; if (num1 > num2) { message...

    A.   Consider the following JavaScript code segment: message = ''; if (num1 > num2) { message = message + 'ONE-'; num1 = num1 - num2; } else { message = message + 'TWO-'; if (num1 * num2 <= 100) { message = message + 'THREE-'; num1 = num1 / 2; } } message = message + num1; •   Assuming num1 = 8 and num2 = 8, what is the value of message after executing the above code? •   Assuming num1...

  • 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

  • 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’

  • 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...

  • 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 code fragment (assumed to be in a program in which all variables are correctly...

    Consider the code fragment (assumed to be in a program in which all variables are correctly defined): int num1, num2; double answer; // program gets num1 and num2 from user, and values received // are always non-zero ints between -100 and +100 (code not shown) ... // compute precise quotient: answer = static_cast<double>( num1 / num2 ); After the assignment statement the variable answer, will hold the most precise quotient possible, accurate to several digits to the right of the...

  • C++ problem where should I do overflow part? in this code do not write a new...

    C++ problem where should I do overflow part? in this code do not write a new code for me please /////////////////// // this program read two number from the user // and display the sum of the number #include <iostream> #include <string> using namespace std; const int MAX_DIGITS = 10; //10 digits void input_number(char num[MAX_DIGITS]); void output_number(char num[MAX_DIGITS]); void add(char num1[MAX_DIGITS], char num2[MAX_DIGITS], char result[MAX_DIGITS], int &base); int main() { // declare the array = {'0'} char num1[MAX_DIGITS] ={'0'}; char...

  • 1. What would be the output of the following lines of code: int num = 2;...

    1. What would be the output of the following lines of code: int num = 2; switch(num){ case 1: cout << "1"; case 2: cout << "2"; case 3: cout << "3"; case 4: cout << "4"; } 2. What would be the output of the following code: char op = '*'; switch(op){ case '+': cout << "Addition"; break; case '-': cout << "Subtraction"; break; case '/': cout << "Division"; break; default: cout << "Invalid"; } 3. What would be...

  • Lab 6.6 – Using Value and Reference Parameters Below is a copy of the source code....

    Lab 6.6 – Using Value and Reference Parameters Below is a copy of the source code. 1 // Lab 6 swapNums.cpp -- Using Value and Reference Parameters 2 // This program uses a function to swap the values in two variables . 3 // PUT YOUR NAME HERE. 4 #include <iostream> 5 using namespace std; 6 7 // Function prototype 8 void swapNums(int, int); 9 10 /***** main *****/ 11 int main() 12 { 13 int num1 = 5, 14...

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