Quiz
pash_2
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (90)
1What is the output of the following code?

- A7
- Bvalue
- C1
- D6
2What is the return type of the function with prototype\: " float func(char x, float v, double t);"
- Achar
- Bint
- Cfloat
- Ddouble
3What is the return type of the function with prototype\: "int func(char x, float v, double t);"
- Achar
- Bint
- Cfloat
- Ddouble
4What is the value of x after the following code executes?

- A10
- B11
- C13
- D0
5What is the value of x after the following code executes?

- A10
- B11
- C23
- D13
6What is the value of x after the following statements?

- A10
- B33
- C3
- D0
7What is the value of x after the following statements?

- A15
- B3
- C4
- D0
8What is the value of x after the following statements?

- A15
- B10
- C5
- D25
9What is the value of x after the following statements?

- A25
- B4
- C5
- D1
10What is the value of x after the following statements?

- A11
- B10
- C0
- D12
11What is the value of x after the following statements?

- A70
- B30
- C3
- D33
12What punctuation ends most lines of C++ code?
- A. (dot)
- B; (semi-colon)
- C\: (colon)
- D' (single quote)
13What punctuation ends most lines of C++ code?
- A.
- B;
- C\:
- D'
14What punctuation ends most lines of C++ code?
- ADot
- BSemi-colon
- CColon
- DSingle quote
15What punctuation is used to signal the beginning and end of code blocks?
- A\{\}
- B-> and
- CBEGIN and END
- D( and )
16What will be printed in the part of the code?

- A1 4 7 10
- B0 3 6 9
- C3 6 9
- D9 6 3 0
17What will be used between the object name and the member name?
- ADot
- BSemicolon
- CColon
- DAnything
18What will be used when terminating a structure?
- ABrackets
- BColon
- CSemicolon
- DDot
19What will output from the following function printOnNewLine; if x \= 3?

- A3
- B0
- CNothing
- DCompile error, because x is int, function is char.
20What will output from the following program?

- AHello will print three times
- BHello will print once
- CHello will print not be printed three times
- DCompile error
21What would be printed from the following C++ program?

- A2 3 6 8 9
- B1 2 5 7 8
- C1 2 3 5 6 7 8
- D1 2 5 7 8 9
22When an equation uses more than one type of operator then the order of precedence has to be established with the different types of operators\:
- AComparison, logical, arithmetic
- BLogical, arithmetic, comparison
- CArithmetic, comparison, logical
- DArithmetic, logical, comparison
23When does the code block following while(x<100) execute?
- AWhile it wishes
- BWhen x is less than one hundred
- CWhen x is greater than one hundred
- DWhen x is equal to one hundred
24When following piece of code is executed, what happens, if b\=2; a \= b++; ?
- Aa contains 2 and b contains 3
- Ba contains 4 and b contains 4
- Ca contains 4 and b contains 3
- Da contains 3 and b contains 3
25When following piece of code is executed, what happens? b\=3; a\=b++;
- Aa contains 3 and b contains 4
- Ba contains 4 and b contains 4
- Ca contains 4 and b contains 3
- Da contains 3 and b contains 3
26Where does the execution of the program starts?
- Auser-defined function
- Bmain function
- Cvoid function
- Dnone of the mentioned
27Where is the mistake of the code?

- AVariable "a" do not have any values.
- BLibrary <xmp><cmath></xmp> didn't included.
- CLibrary <xmp><math.h></xmp> didn't included.
- DLibrary <xmp><fstream></xmp> didn't included.
28Where is the mistake of the code<img src\="@@PLUGINFILE@@/image037.jpg" alt\="">?

- AVariable "a" is not declared.
- BLibrary <xmp><cmath></xmp> didn't included.
- CLibrary <xmp><math.h></xmp> didn't included.
- DLibrary <xmp><fstream></xmp> didn't included.
29Which class should be included to work with files?
- Aiostream
- Bstring
- Ccmath
- Dfstream
30Which conversion is not possible?
- Aint to float
- Bfloat to int
- Cchar to float
- Dall are possible
31Which is not a loop structure in C++?
- Afor
- Bdo while
- Cwhile
- Drepeat until
32Which libraries should be included to get string in a file?
- A<xmp><string> and <fstream></xmp>
- B<xmp><string></xmp> is enough
- C<xmp><fstream></xmp> is enough
- D<xmp><string> or <fstream></xmp>
33Which looping process is best used when the number of iterations is known?
- Afor
- BWhile
- CDo-while
- DNothing
34Which of the following accesses a variable in structure b?
- A<xmp>b->var;</xmp>
- Bb.var;
- Cb-var;
- D<xmp>b>var;</xmp>
35Which of the following accesses a variable in structure mystruct?
- A~<xmp>mystruct ->var;</xmp>
- Bmystruct.var;
- Cmystruct -var;
- D<xmp>mystruct>var;</xmp>
36Which of the following accesses a variable in structure st1?
- A<xmp>st1->var;</xmp>
- Bst1.var;
- Cst1-var;
- D<xmp>st1>var;</xmp>
37Which of the following accesses the seventh element stored in array?
- Aarray[6];
- Barray[7];
- Carray(7);
- Darray;
38Which of the following are themselves a collection of different data types?
- Astring
- Bstructure
- Cchar
- Dinteger
39Which of the following are valid array declaration
- Aintnum(5)
- Bfloat avg[5]
- Cdouble[5] marks
- Dcounter int[5]
40Which of the following can not be used in identifiers?
- ALetters
- BDigits
- CUnderscores
- DSpaces
41Which of the following cannot be used to create a random numbers?
- Astructures
- Bfloat
- Cint
- Dnone of the mentioned
42Which of the following correctly accesses the seventh element stored in alua, an array with 100 elements?
- Aalua[6]
- Balua[7]
- Calua(7)
- Dalua;
43Which of the following correctly declares an array?
- Aint array[10];
- Bint array;
- Carray\{10\};
- Darray array[10];
44Which of the following correctly declares an array?
- Aint anarray[10];
- Bintanarray;
- Canarray\{10\};
- Darray anarray[10];
45Which of the following for headers is not valid for C++ code?
- A<xmp>for (int i \= 0; i<10; i++)</xmp>
- Bint i \=0;
- C<xmp>for (int i \=0; j<10; i++);</xmp>
- Dint j \= 6;
- Eall
46Which of the following gives the memory address of a pointer a?
- Aa;
- B*a;
- C&a;
- Daddress(a);
47Which of the following gives the memory address of a pointer pt1?
- A*pt1;
- Bpt1;
- C&pt1;
- Daddress(ptr1);
48Which of the following gives the memory address of integer variable a?
- A*a;
- Ba;
- C&a;
- Daddress(a);
49Which of the following gives the value stored at the address pointed to by the pointer gala?
- Agala;
- Bval(gala);
- C*gala;
- D&gala;
50Which of the following gives the value stored at the address pointed to by the pointer a?
- Aa;
- Bval(a);
- C*a;
- D&a;
51Which of the following gives the value stored at the address pointed to by the pointer ptr?
- Aptr;
- Bval(ptr);
- C*ptr;
- D&ptr;
52Which of the following identifiers (variable names) is invalid?
- Amy*number
- BMyNumber
- Cmynumber
- Dmy7number
53Which of the following is a complete function?
- Aintfunct();
- Bint funct(int x) \{return x\=x+1;\}
- C<xmp>void funct(int) \{cout&tl;<"Hello"\}</xmp>
- D<xmp>void funct(x) \{cout<<"Hello"\}</xmp>
54Which of the following is a correct comment?
- A*/comment*/
- B**comment**
- C/*comment*/
- D\{comment\}
55Which of the following is a valid function call (assuming the function exists)?
- AFunct@;
- Bfunct x, y;
- Cfunct();
- Dstructfunct();
56Which of the following is address of operator represented by?
- A$
- B\#
- C&
- D@
57Which of the following is illegal?
- Aint *ip;
- Bstring s, *sp \= 0;
- Cint i; double* dp \= &i;
- Dint *pi \= 0;
58Which of the following is input statement in C++?
- Acin
- Binput
- Cget
- Dnone of them
59Which of the following is not a correct variable type in C++?
- Afloat
- Breal
- Cint
- Ddouble
60Which of the following is not a correct variable type?
- Afloat
- BReal
- Cint
- Ddouble
61Which of the following is not a looping statement in C++?
- Awhile
- Buntil
- Cdo
- Dfor
62Which of the following is not a valid escape code?
- A\\t
- B\\v
- C\\f
- D\\wq
63Which of the following is not a valid relational operator?
- A\=\=
- B<xmp>\=></xmp>
- C<xmp>>\=</xmp>
- D<xmp><\=</xmp>
64Which of the following is output statement in C++?
- Aprint
- Bwrite
- Ccout
- Dcin
65Which of the following is required to avoid falling through from one case to the next?
- AEnd;
- BBreak;
- CStop;
- DA semicolon;
66Which of the following is selection statement in C++?
- Abreak
- Bgoto
- Cexit
- Dswitch
67Which of the following is the boolean operator for logical-and?
- A&
- B&&
- C|
- D|&
68Which of the following is the correct operator to compare two variables?
- A\:\=
- B\=
- CEqual
- D\=\=
69Which of the following is the final value of 'i' from the following C++code?

- A5
- B4
- C0 1 2 3 4
- D0 1 2 3 4 5
70Which of the following is the output from the following C++ ?

- A5
- B0
- C4
- D6
71Which of the following is the output from the following C++ code?

- A15 14 13 12 11 10
- B15 14 13 12 11 10 9
- C9
- D15
72Which of the following is the output from the following C++ code?

- A10
- B12
- C3
- D4
73Which of the following is the output from the following C++code?

- A34.4
- Bvalue
- C1
- D0
74Which of the following is the proper declaration of a pointer?
- Aint x;
- Bint&x;
- Cptr x;
- Dint *x;
75Which of the following is the valid array declaration
- Aintnum(5)
- Bint mycat[5]
- CArray. double[5] marks
- DMyarray.counterint[5]
76Which of the following is true for an integer variable?
- A1
- B66
- C-10
- D-1
- EAll of them
77Which of the following is used to terminate the function declaration?
- A\:
- B)
- C;
- Dnone of the mentioned
78Which of the following properly declares a variable of struct foo?
- AStruct foo;
- Bfoo var;
- Cfoo;
- DInt foo;
79Which of the following properly declares struct?
- Astruct \{int a;\}
- Bstructa_struct \{int a;\}
- Cstructa_structint a;
- Dstruct_structa \{int a;\};
80Which of the following shows the correct syntax for if statement?
- Aif expression
- Bif ( expression )
- Cif \{ expression \}
- Dexpression if
81Which operator is used for input stream?
- A~<xmp>></xmp>
- B<xmp>>></xmp>
- C\{\}
- D()
82Which statement of array is true?
- AInt foo[5]\=\{10,20,30\};
- Bint foo[]\{10,20,30\};
- Cint foo[3] \= \{10,20,30\};
- Dint foo[];
83Which stream class is only used to read files?
- Aifstream
- Bofstream
- Ciostream
- Dfstream
84Which stream class is used to both read and write on files?
- Aifstream
- Bofstream
- Ciostream
- Dfstream
85Why do we need library <xmp><fstream></xmp>?
- ATo work with strings
- BTo work with files.
- CTo work with mathematical functions.
- DTo work with our own libraries.
86Why do we need library <xmp><cmath></xmp>?
- ATo work with strings.
- BTo work with mathematical functions.
- CTo work with command line.
- DTo work with our own libraries.
87Write correct function prototype for the function 'intToDouble' that takes an integer argument 'number', and returns a double value.
- Adouble intToDouble( int number);
- Bfloat intToDouble( int number);
- Cdouble intToDouble( double number);
- DintintToDouble( number);
88write mpg() function prototype, that takes two type double arguments and returns a double
- Afloat mpg(int a)\{ float b \= 1; return b;\}
- Bvoid mpg()\{\}
- Cdouble mpg(double a, double b)
- Ddouble mpg(int a, double b)
89Write the correct function definition, where function 'alua' that takes three integers, x, y and z, and returns an integer?
- Adouble alua(int x, int y, int z)
- Bint alua (int x, int y, int z)
- Cintalua (int x, int y)
- Dintfunct (int x, int y, int z)
90You have assigned the address of Value to the pointer P, Which statement will display the value stored in Value?
- Acout<xmp><<</xmp>P;
- Bcout<xmp><<</xmp>*Value;
- Ccout<xmp><<</xmp>&P;
- D<xmp>cout<<* P; </xmp>
Information
- Description
- Quiz on pash_2, created by Максат Аскер on 16/03/2019.
- Author
- Максат Аскер
- Language
- English
- Views
- 29
- Rating
- No ratings yet Rate this quiz
More on C++ Programming Basics