Select the correct definition at right for each of the terms at left (matching):
A. Changes to these parameters inside a function will not cause
1. Local Variables ________ the corresponding argument values to change.
B. Their values are not allowed to be changed.
C. Declared in the body of a function. They are accessible
2. Array ______ only within a limited scope.
D. Denoted with an ampersand (&). Indicates that arguments
passed into a function will be modified if the formal
3. Call-by-Value
________
parameter’s value is changed in the function body.
(Pass-by-Value)
E. A group of variables that are of the same data type,
and are
stored sequentially in adjacent memory locations.
4. Which of the following pieces of code will output “true” if and only if x is between 5 and 10 (including)?__________
A. if(5 <= x <= 10) cout << "true";
B. if(x >= 5 || x <= 10) cout << "true";
C. if(x >= 5 && x <= 10) cout << "true";
bool inRange = (x >= 5 && x <= 10);
if(inRange) cout << "true";
Both B and D are right.
5. What will be output by the following code? _____________
int z = 15;
if (z < 10) cout << " under 10";
else if (z < 20) cout << " under 20";
else if (z < 30) cout << " under 30";
else cout << " over 30";
A. under 10 under 20 under 30 over 30 B. under 20 under 30 over 30
C. under 20 under 30 D. under 20 E. under 30
here are the answers..
===============================================================
Ans:1
1 C
2 E
3 A
==============================================================
Ans:4
C. if(x >= 5 && x <= 10) cout << "true";
==============================================================
Ans:5
D. under 20
===============================================================
Kindly Check and Verify Thanks..!!!
Select the correct definition at right for each of the terms at left (matching):  
Question 1 (8 points): Choose the Correct Answer (2 points for each question) 1. What are the values of the variables x and y after executing the following code? intx=0,y-2; if (x0) y-13 else y-2;) c, x = 1,y=1 d.x-1,y 2 of the following will output Yes only if the integer variable numis either 2.3, 4, or 5? a. if ((2--num) II (nurn<-5)) {cout << "Yes" << endl; } miT b. İfQ2(num) & (num >-5)) {cout << "Yes"くくendl; } c....
QUESTION 1 Which statement results in the value false? The value of count is 0; limit is 10. (count != 0)&&(limit < 20) (count == 0)&&(limit < 20) (count != 0)||(limit < 20) (count == 0)&&(limit < 20) 10 points QUESTION 2 If this code fragment were executed in an otherwise correct and complete program, what would the output be? int a = 3, b = 2, c = 5 if (a > b) a = 4; if (...
QUESTION 1 What is the output of the following code snippet? int main() { bool attendance = false; string str = "Unknown"; attendance = !(attendance); if (!attendance) { str = "False"; } if (attendance) { attendance = false; } if (attendance) { str = "True"; } else { str = "Maybe"; } cout << str << endl; return 0; } False True Unknown Maybe QUESTION 2 What is the output of the following code snippet? #include <iostream> #include <string> using...
31. The following code segment is syntactically correct: int number{20}; cout << number << setbase(16) << " " << number << setbase(10) << " " << number << showpos << " " << number << endl; T__ F__ 32. The following statement wants to determine if ‘count’ is outside the range of 0 through 100: if (count < 0 && count > 100) T__ F__ 33. There is...
Here is a function that takes, and returns pointers: 2 int* select(bool which, int* a, int* b) { if(which == true) return a; else return b; } Using this function, suppose we have variables x, y: int x = ..., y = ...; int* p = select(x < y, &x, &y); if(p == &x) cout << "Yes"; else cout << "No"; What will this print if x = 5, y = 7? What will this print if x = 23, ...
QUESTION 10 Which of the following is the correct definition of a function that calculates the area of a rectangle by multiplying its length by its width? The length and width parameters are double values and the function returns a double. double area (double length, double width) return lengthwidth double area( double length, double width) double area length width return double area(double length, width) return length width area(double length, double width) return length width; QUESTION 11 What is the output...
My C++ program is give me extra characters in my output. Below is an example of input.txt and the section of code that reads it. input.txt (x/y), x = 20, y = 5; ((y>x)&(x<z)),x=5,y=10,z=3; output I get: Value=4 20, y=5; Value=0z)), x=5, y=10, z=3; ifstream fin; fin.open("input.txt"); while (true) { symbolTable.init(); fin.getline(line, SIZE); if (!fin) break; stringstream in(line, ios_base::in); in >> paren; cout << line << " "; expression = SubExpression::parse(in); in >> comma; parseAssignments(in); double result = expression->evaluate(); cout...
midtermQ_cst2403Sp20-4 X 1434_Module 4(1) X 1434_Module X EMT2461. Lab#4 * quiz3 1434Module7 midterm_c124. 11. What will the following senest of code up if the value of art is 117 Overloaded function est have Different parameter lists Different types. The same suwer of parameters d. The member of deo argument cout << "Soccer Given the following function definition C + is fun dale dcfun 12. Which value of number would cause the following code segment display the message "That number is...
Can i get the answers for 1,2,3 and 4
1. What are the values of int x in the following C++ statement? 2 each a) x = 18 % 5; b)x= (4/5)==0.8; c)X =( 4 - 3 * 2 == 2) ?0:1; 2. What will x and y be when each part starts out with integers x = 6, y = -4 and z=5? 2 each a) x *= 12 - x; x becomes b) z= x++ + x; x...
QUESTION 7 Which of the following is a valid C++ assignment statement? (assume each letter is a different variable) A.y=b-c B.y +z = x C.x = a bi D.x = -(y*z): Ex = (x + (y z): QUESTION 8 Which of the following is a valid variable name according to C++ naming rules? A 2ndName B.%Last_Name C@Month D#55 Eyear03 QUESTION 9 Which library must be included to enable keyboard input? A kbdin B. cstdlib C input Diostream E lomanip QUESTION...