Question 35
What is the output of the program?
#include <iostream>
using namespace std;
int main() {
int a = 10;
for (a=1; a<=81; a*=3)
cout << a << " ";
cout << endl;
return 0;
}
. 1 3 9 27 81
Question 36
What statement is used to make decisions:
if
Question 37
What value gets printed by the program?
#include <iostream>
int main(int argc, char** argv)
{
int x = 0;
int y = 0;
if (x++ && y++)
{
y += 2;
}
std::cout << x + y << std::endl;
return 0;
}
. 1
Question 38
Explain the purpose of a function parameter. What is the difference between a parameter and an argument?
. A parameter represents additional information that a function requires to perform its task. Each parameter required by a function is specified in the function header. An argument is the value supplied in the function call. When the function is called, the argument value is passed into the function parameter so that the function can perform its task
Question 39
What will be the result of: cout << (5 << 3);?
Question 41
The process of placing the elements of an array in order is called ________ the array
sorting
Question 42
Find the error(s) in the following code segment:
x = 1;
while (x <= 10);
x++;
}
. x = 1;
while (x <= 10)
x++;
}
Question 43
What is the output of the program?
#include <iostream>
using namespace std;
int main() {
int a = 11;
if (!(a<10)) {
cout << "A";
}
if (a%10==0) {
cout << "B";
} else {
cout << "C";
}
cout << endl;
return 0;
} AC
Question 44
Output the address of the variable myString of type char *
b. cout << static_cast< void * >(myString);
Question 45
|
|
Use a for statement to print the elements of array numbers using pointer/subscript notation with pointer nPtr
c. cout << fixed << showpoint << setprecision(1); for (int m = 0; m < SIZE; m++) cout << nPtr[ m ] << ' '; |
Question 46
Which properly declares a variable of struct foo?
c. foo var;
Question 50
What value gets printed by the program?
#include <iostream>
int foo(int x, int y = x)
{
return x+y+1;
}
int main(int argc, char** argv)
{
std::cout << foo(2) << std::endl;
return 0;
}. ill-formed Конец формы
Question 52
State the values of the variable after the calculation is performed. Assume that, when a statement begins executing, all variables have the integer value 5: product *= x++;
Result:
product =
x =
Question 53
The stream manipulators ___________, __________ and ___________ specify that integers should be displayed in octal, hexadecimal and decimal formats, respectively