- •If you write a function that should use call-by-reference, but forget to include the ampersand,
- •It is necessary to declare the type of a function in the calling program if the function
- •C) form more complex conditions by combining simple conditions.
- •Is it local variable with function scope??a
- •Is a program that gives?
- •In classes, if we declare object without keywords like public, which type will it be of?
Is it local variable with function scope??a
a) x=1
b) x=2
c)x=7
d)x=16
e)x=5
What have variable?
a) attributes
b) type
c)name
d)size
e)value
write program random
a) Number = shiftingValue + rand() % scalingFactor
b) Number = number+ rand() % scalingFactor
c) if ( rand == 1 && age >= 65 )
d) Number = number+ rand() %
e) Number = number+ scalingFactor
What is shiftingValue??
a) returns a number ranging from 0 to num-1
b) first number in desired range
c) width of desired range
d) contains function prototype for rand
e) function
What is scalingFactor??
a) returns a number ranging from 0 to num-1
b) first number in desired range
c) width of desired range
d) contains function prototype for rand
e) function
Is a program that gives?
a) displays 20 random numbers from 0 to 99, ranked ascending
b) displays 20 random numbers from 0 to 100, ranked ascending
c) displays 19 random numbers from 0 to 99, ranked ascending
d) displays 19 random numbers from 0 to 100, ranked ascending
e) displays 20 random numbers from 0 , ranked ascending
write code Enumeration
a) Number = number+ rand() % scalingFactor
b) enum typeName {constant1, constant2…};
c) enum variavle{constant1, constant2…};
d) enum <base_type> name;
e) vector <base_type> name;
Code generates a number between 0 and 5
a) face = 1 + rand() % 6;
b)i = rand() % 6- 1;
c)i = rand() % 6+ 14;
d) i = rand() % 6-0;
e) i=rand()%15+1;
what is contains function prototype for srand?
a) <cstdlib> b) <iomanip> c) <ctime> d) <cmath> e)<iostream>
Сhoose the correct option
Сommand "\t" means:
a) Position the screen cursor to the beginning of the next line.
b)Move the screen cursor to the next tab stop.
c)Position the screen cursor to the beginning of the current line
d)Sound the system bell.
e)Used to print a backslash character.
Find the error:
a)there are no errors in the code
b)error in line //1
c)error in line //2
d)error in line //3
e)error in line //4
Which means “cerr” command:
a) Standard input stream
b) Standard error stream
c) Standard assignment stream
d) Standard output stream
e) Standartd comment stream
Which of the following data types is not a data type in C + +?
a)int
b)real
c)float
d)double
e)char
Programming Language C + + developed
a)Bjarne Stroustrup
b)Niklaus Wirth
c)Donald Knuth
d)Ken Thompson
e)Tom Kriving
Which service sign is placed after the operator “case”?
-
-
-
< >
b) ;
c) :
d) /
e) ~
What function should contain all the programs in C + +?
a) start( )
b)main( )
c)system( )
d)program( )
e) void( )
Which is equal to "a" per line //1 ?
-
This program will not happen endless cycle.
-
1
-
0
-
-1
-
This code does not compile it has a syntax error.
Found Error:
a) 77.11+5
b) 21%6
c) 3.14 % 3
d) 21- 6
e) 3.14 * 3
What is the value of the variable y, if
int y=0; іf(у) y=2; else if(++у>0) у=7; ?
a)8
b)1
c)2
d)0
e)7
What is the difference between Хх(); Xx;
-
Хх(); generates an error if the class does not have a default constructor, and Xx; gives.
-
no difference calls the default constructor.
-
Xx; there is no call to the constructor, Xx( )
-
Xx(); not declares instance of the class and announces prototype functions
-
there is no correct answer.
Determine the value of x after executing a series of commands:
int x=9;
int y=x+2,z=x;
x = x-2 - y;
сout << x;
a) -3
b) -4
c) 5
d) 0
e) error
Determine the value of x after executing a series of commands:
int x,y,z;
y = 8;
z = 2;
x = (y=2) + (z+=3);
a)5
b)2
c)4
d)7
e)9
Determine the value of x after executing a series of commands:
int x, y, z;
y = 10;
z = 11;
x = + + y + z + +;
a)11
b)44
c)25
d)30
e)22
What is the value of the variable y, if
int y=0; іf(у) y=2; else if(++у>0) у=7; ?
a)8
b)1
c)2
d)0
e)7
Which of the following is the proper declaration of a pointer? A. int x; B. int &x; C. ptr x; D. int *x;
E.int (x); Which of the following gives the memory address of integer variable a? A. *a; B. a; C. &a; D. address(a); E.—a; Which of the following gives the memory address of a pointer a? A. a; B. *a; C. &a; D. address(a); E.-aa Which of the following gives the value stored at the address pointed to by the pointer a? A. a; B. val(a); C. *a; D. &a; E.++a; Which of the following is the proper keyword to allocate memory? A. new B. malloc C. create D. value E.old; Which of the following is the proper keyword to deallocate memory? A. free B. delete C. clear D. Remove
E.new;
Which of the following is a static string? A. Static String B. "Static String" C. 'Static String' D. char string[100]; E.There is no true answere; What character ends all strings? A. '.' B. ' ' C. '\0' D. '\n' E.} Which of the following reads in a string named x with one hundred characters? A. cin.getline(x, 100, '\n'); B. cin.getline(100, x, '\n'); C. readline(x, 100, '\n'); D. read(x); E.read(-x); Which of the following functions compares two strings? A. compare(); B. stringcompare(); C. cmp(); D. strcmp(); Which of the following adds one string to the end of another? A. append(); B. stringadd(); C. strcat(); D. stradd();
E.Sranrandom();
Declare a pointer to an integer:
А. int *fun_int = NULL;
B. int fun_int = NULL;
С.char*fun_char=NULL;
D.char fun_char=NULL;
E.char_char=NULL;
Now let’s dereference the pointer:
A.*fun_int=12;
B. .fun_int=12;
C. &fun_int=12;
D. /fun_int=12;
E. fun_int=12;
What is the output?
int main() { int n = 310; funcOne(n); cout << “n = “ << n << endl; return 0; } void funcOne(int n) { n = 240; }
A.240;
B.310;
C.550;
D.70;
E.74400
What is the output?
int main() { int n = 310; funcOne(n); funcTwo(&n); cout << “n = “ << n << endl; return 0; } void funcOne(int n) { n = 240; } void funcTwo(int *n) { n = 120; }
A.120;
B.240;
C.310;
D.70;
E.550;
Now that the pointer is declared, let’s set it to point to something: int a = 5;
A.*fun_int=&a;
B.*fun_int=*a;
C.fun_int=*a;
D.fun_int=&a;
E.fun_int=**a;
int main() { int n = 10; funcOne(n); funcTwo(&n); cout << “n = “ << n << endl; return 0; } void funcOne(int n) { n = 40; } void funcTwo(int *n) { n = 20; }
A.10;
B.40;
C.20;
E.55;
int main() { int n = 31; funcOne(n); funcTwo(&n); cout << “n = “ << n << endl; return 0; } void funcOne(int n) { n = 24; } void funcTwo(int *n) { n = 12; }
A.31;
B.24;
C.12;
D.55;
E.36;
Now that the pointer is declared, let’s set it to point to something: int a = 9;
A.*fun_int=&a;
B.*fun_int=*a;
C.fun_int=*a;
D.fun_int=&a;
Now that the pointer is declared, let’s set it to point to something: int a = 55;
A.*fun_int=&a;
B.*fun_int=*a;
C.fun_int=*a;
D.fun_int=&a;
Structure definition?
-
struct Card {
char *face;
char *suit; };
b) structure Card {
char *face;
char *suit; };
c) struct Card {
char *face;
char *suit; }
d) structure Card {
char *face;
char *suit; }
Keyword of structure?
-
Struct
-
Structure
-
Str
-
Strctur
Show same expression to .favorite_movie.year?
-
->favorite_movie.year
-
:: favorite_movie.year
-
*/ favorite_movie.year
-
>> favorite_movie.year
Find wrong declaration.
-
CRectangle rectb;
-
CRectangle rectb(char);
-
CRectangle rectb(int,int);
-
CRectangle rectb();
Which keyword doesn’t exist?
-
Struct
-
Class
-
That
-
This
Which of this keyword isn’t access specifier?
-
Private
-
Public
-
Protected
-
Defended
What type of access have class members by default?
-
Private
-
Public
-
Protected
-
Defended
Which of this statements used to define a member of a class from outside the class definition itself?
-
::
-
>>
-
<<
-
/*
What will be output of this code?
-
area: 12
-
area:12
-
Area:12
-
area:34
What will be output of this code?
-
area: 1
-
area: -1
-
Area: -1
-
area:-1
What will be output of this code?
-
area: 0
-
area:1
-
Area:1
-
area:0
What will be output of this code?
-
area: 12
-
There will be an error.
-
Area:12
-
area:12
What will be output of this code?
-
area: 155
-
area: 25
-
area: 75
-
area: 225
What will be output of this code?
-
area: 12
-
area: 0
-
Area:12
-
area: 16
What will be output of this code?
-
area: 16
-
area:16
-
Area: 16
-
area: 0
Which is the difference between array and structure?
a. only in their declaration
b. they haven't any differences
c) structure can include members of different types of data
d. structures are more powerful
Which code outputs the member "name" of object student? (student is object of any structure)
a. cout<<struct.name
b. cout<<student[name]
c. cout<<student.name
d. cout<<struct.student.name
What is the difference between classes and structures?
a. We can have functions in classes
b. They are similar
c. Structures have only public access specifier
d. classes are more comfortable for using