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’?
Answer: Hey dear student finds the solution of your query if you have any doubt feel free to ask. Thanks!!
final value ans = 519
let's see: put value in place of variables
num1 = 31
num2 = 96
num3 = 22
temp = 96 (num2)
num3 = 96 + 31 = 127 (temp + num1)
num1 = 31 + 127 = 158 (num1 + num3)
num4 = 127 + 11 = 138 (num3 + 11)
num2 = 96 + 138 = 234 (num2 + num4)
ans = 158 + 234 +127 = 519 (num1 + num2 + num3)
Hence we got 519 in ans variable. If any confusion comment me in comment box.
Given the following code… var num1 = 31; var num2 = 96; var num3 = 22;...
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
You have three integers (num1, num2, num3). Write an if…else statement that given these 3 integers prints the largest on
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...
Given following method, public static double getQuotient (int num1, int num2){ return num1/(double) num2; } Write Java statement to invoke the method.
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’
Question 27 The following statement ________. cin >> *num3; stores the keyboard input in the variable num3 stores the keyboard input into the pointer num3 is illegal in C++ stores the keyboard input into the variable pointed to by num3 None of these Question 28 The following statement ________. int *ptr = new int; results in a compiler error assigns an integer less than 32767 to the variable ptr assigns an address to the variable ptr creates a new pointer...
Given the following: struct Val { int num1; float num2; } ; struct Person { int age; float income; }; Val t, s; Person p1, p2, p3; s.num1 = 0; s.num2 = 2.5; //initialize s p2.age = 25; p2.income = 9999.99; //initialize p2 t = s; //assignment one p1 = s; //assignment two p2 = p3; //assignment three p3.age = s.num1; //assignment four p3.income = s.num1; //assignment five p2.age = t.num2; //assignment six For each assignment statements above...
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 =...
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...
1. Given the following array, what is the value of pets[3]? var pets = new Array("giraffe", "pig", "beetle", "hamster", "spider", "goldfish", "cow"); A. pig B. beetle C. hamster D. spider 2. Given the following array, which statement will create a variable named product that multiplies 4 * 5, using array elements? var nums = new Array(2, 3, 4, 5, 6, 30, 40, 50, 60); A. var product = nums[1] * nums[2]; B. var product = nums[2] * nums[3]; C. var...