Deck 3: C++ Programming Concepts

Full screen (f)
exit full mode
Question
Empty parentheses following a function name in a function prototype indicate that the function does not require any parameters to perform its task.
Use Space or
up arrow
down arrow
to flip the card.
Question
C++ programmers concentrate on creating , which contain data members and the member functions that manipulate those data members and provide services to clients.

A)structures
B)classes
C)objects
D)function
Question
Which of the following is FALSE about references in C++

A)a reference must be initialized when declared
B)once a reference is created, it cannot be later made to reference another object; it cannot be reset
C)references cannot be null
D)references cannot refer to constant value
Question
What will be the output of following program?#include <iostream> using namespace std;class Test{public:Test() { cout <<"Hello from Test() "; }} a;int main(){cout <<"Main Started "; return 0;}

A)main started
B)main started hello from test()
C)hello from test() main started
D)compiler error: global objects are not allowed
Question
Which of the following is true about constructors.
1) They cannot be virtual.
2) They cannot be private.
3) They are automatically called by new operator

A)all 1, 2, and 3
B)only 1 and 3
C)only 1 and 2
D)only 2 and 3
Question
Which of the following operators are overloaded by default by the compiler?
1) Comparison Operator ( == )
2) Assignment Operator ( = )

A)both 1 and 2
B)only 1
C)only 2
D)none of the two
Question
Which of the following is true about inline functions and macros.

A)inline functions do type checking for parameters, macros don't
B)macros cannot have return statement, inline functions can
C)macros are processed by pre-processor and inline functions are processed in later stages of compilation.
D)all of the above
Question
In C++, const qualifier can be applied to?Member functions of a class?Function arguments?To a class data member which is declared as static?Reference variables

A)only 1, 2 and 3
B)only 1, 2 and 4
C)all of the above
D)only 1, 3 and 4
Question
Which type is best suited to represent the logical values?

A)integer
B)boolean
C)character
D)all of the mentioned
Question
The following is the C++ style comment

A)//
B)/*..*/
C)-
D)none of above
Question
Which of the following statements is false?

A)every c++ program must have a main().
B)in c++, white spaces and carriage returns are ignored by the compiler.
C)c++ statements terminate with semicolon.
D)main() terminates with semicolon.
Question
Functions can returns

A)arrays
B)references
C)objects
D)all of above
Question
Which of the following control expressions are valid for an if statement?

A)an integer expression
B)a boolean expression
C)either a or b
D)neither a nor b
Question
What will be the values of x, m and n after execution of the following statements? Int x, m, n;m=10; n=15;x= ++m + n++;

A)x=25, m=10, n=15
B)x=27, m=10, n=15
C)x=26, m=11, n=16
D)x=27, m=11, n=16
Question
Which of the following approach is adapted by C++?

A)top-down
B)bottom-up
C)right-left
D)left-right
Question
Which of the following is the correct class of the object cout?

A)iostream
B)istream
C)ostream
D)ifstream
Question
Which of the following functions are performed by a constructor?

A)construct a new class
B)construct a new object
C)construct a new function
D)initialize objects
Question
Which of the following ways are legal to access a class data member using this pointer?

A)this->x
B)this.x
C)*this.x
D)*this-x
Question
Which operator is having right to left associativity in the following?

A)array subscripting
B)function call
C)addition and subtraction
D)type cast
Question
Which operator is having the highest precedence?

A)postfix
B)unary
C)shift
D)equality
Question
#include <iostream> using namespace std; int main(){int a;a = 5 + 3 * 5;cout <<a; return 0;}

A)35
B)20
C)25
D)30
Question
In procedural programming the focus in on …...........

A)data
B)structure
C)function
D)pointers
Question
In object oriented programming the focus is on ….......

A)data
B)structure
C)function
D)pointers
Question
Which of the following feature of procedure oriented program is false?

A)makes use of bottom up approach
B)functions share global data
C)the most fundamental unit of program is function
D)all of these
Question
Which of the following feature of object oriented program is false?

A)data and functions can be added easily
B)data can be hidden from outside world
C)object can communicate with each other
D)the focus is on procedures
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/25
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: C++ Programming Concepts
1
Empty parentheses following a function name in a function prototype indicate that the function does not require any parameters to perform its task.
True
2
C++ programmers concentrate on creating , which contain data members and the member functions that manipulate those data members and provide services to clients.

A)structures
B)classes
C)objects
D)function
classes
3
Which of the following is FALSE about references in C++

A)a reference must be initialized when declared
B)once a reference is created, it cannot be later made to reference another object; it cannot be reset
C)references cannot be null
D)references cannot refer to constant value
references cannot refer to constant value
4
What will be the output of following program?#include <iostream> using namespace std;class Test{public:Test() { cout <<"Hello from Test() "; }} a;int main(){cout <<"Main Started "; return 0;}

A)main started
B)main started hello from test()
C)hello from test() main started
D)compiler error: global objects are not allowed
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following is true about constructors.
1) They cannot be virtual.
2) They cannot be private.
3) They are automatically called by new operator

A)all 1, 2, and 3
B)only 1 and 3
C)only 1 and 2
D)only 2 and 3
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following operators are overloaded by default by the compiler?
1) Comparison Operator ( == )
2) Assignment Operator ( = )

A)both 1 and 2
B)only 1
C)only 2
D)none of the two
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following is true about inline functions and macros.

A)inline functions do type checking for parameters, macros don't
B)macros cannot have return statement, inline functions can
C)macros are processed by pre-processor and inline functions are processed in later stages of compilation.
D)all of the above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
8
In C++, const qualifier can be applied to?Member functions of a class?Function arguments?To a class data member which is declared as static?Reference variables

A)only 1, 2 and 3
B)only 1, 2 and 4
C)all of the above
D)only 1, 3 and 4
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
9
Which type is best suited to represent the logical values?

A)integer
B)boolean
C)character
D)all of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
10
The following is the C++ style comment

A)//
B)/*..*/
C)-
D)none of above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following statements is false?

A)every c++ program must have a main().
B)in c++, white spaces and carriage returns are ignored by the compiler.
C)c++ statements terminate with semicolon.
D)main() terminates with semicolon.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
12
Functions can returns

A)arrays
B)references
C)objects
D)all of above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following control expressions are valid for an if statement?

A)an integer expression
B)a boolean expression
C)either a or b
D)neither a nor b
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
14
What will be the values of x, m and n after execution of the following statements? Int x, m, n;m=10; n=15;x= ++m + n++;

A)x=25, m=10, n=15
B)x=27, m=10, n=15
C)x=26, m=11, n=16
D)x=27, m=11, n=16
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following approach is adapted by C++?

A)top-down
B)bottom-up
C)right-left
D)left-right
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is the correct class of the object cout?

A)iostream
B)istream
C)ostream
D)ifstream
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following functions are performed by a constructor?

A)construct a new class
B)construct a new object
C)construct a new function
D)initialize objects
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
18
Which of the following ways are legal to access a class data member using this pointer?

A)this->x
B)this.x
C)*this.x
D)*this-x
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
19
Which operator is having right to left associativity in the following?

A)array subscripting
B)function call
C)addition and subtraction
D)type cast
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
20
Which operator is having the highest precedence?

A)postfix
B)unary
C)shift
D)equality
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
21
#include <iostream> using namespace std; int main(){int a;a = 5 + 3 * 5;cout <<a; return 0;}

A)35
B)20
C)25
D)30
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
22
In procedural programming the focus in on …...........

A)data
B)structure
C)function
D)pointers
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
23
In object oriented programming the focus is on ….......

A)data
B)structure
C)function
D)pointers
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following feature of procedure oriented program is false?

A)makes use of bottom up approach
B)functions share global data
C)the most fundamental unit of program is function
D)all of these
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
25
Which of the following feature of object oriented program is false?

A)data and functions can be added easily
B)data can be hidden from outside world
C)object can communicate with each other
D)the focus is on procedures
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 25 flashcards in this deck.