Functions, classes

Question92

Write one or more statements that perform the following task for and array called “fractions”. Assign the value 3.333 to the seventh element of the array

fractions[ 6 ] = 3.333;

Question93

What is the output of the program?

#include <iostream>
using namespace std;
int main() {
int a = 10;
for (a=32; a>=1; a/=2)
cout << a << " ";
cout << endl;
return 0;
}

32 16 8 4 2 1

Question96

What is the output of the program?

#include<iostream>

usingnamespace std;

int main() {

int a = 1;

do {

cout << a;

a*=2;

} while (a<=5);

return 0;

}

Question97

For a local variable in a function to retain its value between calls to the function, it must be declared with the ________ storage-class specifier

Static

Question100

What is the only function all C++ programs must contain?

Main()

1) Fin the erros in the following code segment

X=1 while(x<=10); x++; }

X=1 while(x<=10); x++; }

2) The_____ operator reclaims memory previously allocated by new

Delete

3)The number used to refer to a particular element of an array is called its

________. subscript (or index)

4) __________ must be used to initialize constant members of a class.

Member initializers

5) Question: Write a declaration for the following: Double-precision, floating-point
variable lastVal that is to retain its value between calls to the function in which it is
defined. static double lastVal;

6) Write single C++ statements that input integer variable x with cin and >>

cin>>x;

7 ) By convention, function names begin with a capital letter and all subsequent words in the name begin with a capital letter False

8) An array that uses two subscripts is referred to as a(n) _________ array

Two-dimensional

9) Use a stream manipulator that causes the exponent in scientific notation and the letters in hexadecimal values to print in capital letters cout<<uppercase;

10) Each parameter in a function header should specify both a(n) _________ and a(n) _________. Type,name;

11) the error in the following program segment and correct the error:
Assume that int a[ 2 ][ 2 ] = { { 1, 2 }, { 3, 4 } }; a[ 1,1]=5;

12) The process of determining if an array contains a particular key value is called _________.

Searching

13) Read an integer from the user at the keyboard and store the value entered in integer variable age. std::cin >> age;

14) A function is invoked with a(n) ________.

Function call

15) All arguments to function calls in C++ are passed by value

False

16) C++ considers the variables number and NuMbEr to be identical

False

17) The arithmetic operators *, /, %, + and all have the same level of precedence

False

18 ) The four objects that correspond to the standard devices on the system include
_________, _________, __________ and ___________.


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: