Quiz for C
-
Upload
abdul-hasib-shikder -
Category
Documents
-
view
216 -
download
0
Transcript of Quiz for C
-
8/8/2019 Quiz for C
1/5
Quiz for C++ Tutorial
1. What function initalizes variables in a class:
Constructor
Destructor
Constitutor
A and B are correct.
2. To include code from the library in the program, such as iostream, a directive would
be called up using this command.
#include ; with iostream.h inside the brackets
include (iostreamh)
#include with iostream.h inside the brackets
include #iostream,h;
3. Single line comments explaining code would be preceded like in the following
example
/**
//
*//
/*
4. Which line has all reserved words ?
char, int, float, doubled, short, long, unsigned, signed
sizeof, const, typedef, static, voided, enum, struct, union
if, else, for, while do, switch, continue, break
defaulted, goto, return, extern, private, public, protected
5. What punctuation must each command line have at the end of the line ?
Generated by Foxit PDF Creator Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.
-
8/8/2019 Quiz for C
2/5
:
,
!
;
6. The C++ language is
case-sensitive.
Not case-sensitive.
It depends
None of these
7. The number 5.9875e17 must be stored in a(n):
int
long
double
float
8. Select the correct definition for a string variable.
string mystr;
string mystr[20];
string[20] mystr;
char mystr[20];
9. The sentence "Hello world!" uses _____ elements in a character array.
10
11
12
13
Generated by Foxit PDF Creator Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.
-
8/8/2019 Quiz for C
3/5
10. When you are creating a structure, you need to use the following keyword
structure
struct
object
record
11. Select the correct function definition (NOT prototype) from the list below.
void intro();
double sin(double rad);
int foo(int bar; double baz)
double pow(double num, int pow);
12. Cout can print multiple values or variables in a single command using the followingsyntax:
cout
-
8/8/2019 Quiz for C
4/5
It allows the programmer to use cout
-
8/8/2019 Quiz for C
5/5
12
error
23
20. For which values of the integer _value will the following code become an infiniteloop?
int number=1;while (true) {
cout