Saturday, October 6, 2012

Saturday, September 15, 2012

CS 201 Quize



CS201 – Introduction to Programming
First Quiz
suppose we have int y[10]; To access the 4th element of the array we write_______


y[4];
y[3];
y[2];
none of given

From the following; which one is the range of Random number generator function rand()?

0 – 32768
1 – 32768
0 – 32767
1 – 32767

From following; which one is the correct syntax of an array initialize: Array size is 10 and it is of double data type to value 0?

arr[10] = {0.0};
double arr[10]= 0.0;
double arr[10] = {0.0};
double arr[] = 0.0;

The string in the array is terminated by a _____

zero
nil
null
one

In C/C++; by default arguments are passed by _____ to a function.

Reference
Value
Type
Data

1
char name [] = “Hello World” ; In the above statement, a memory of _______ characters will be allocated


13
11
12
10
_______ Keyword is used to return some value from a function.


break
return
continue
goto

Which of the function call is call by value for the following function prototype? float add(int);

add(&x);
add(x);
add(int x);
add(*x);

The increment of a pointer depends on its_________.

variable
value
data type
None of the given


The ASCHI code of null character is_________


000
010
111
110
Pointers are a special type of __________in which a memory address is stored
Select correct option:
variables
Location
Characters
None of the given
just for copy paste

Transpose of a matrix means that when we interchange rows and columns_____________
Select correct option:
the first row becomes the Last column
the first row becomes the first column
the Last row becomes the first column
the first column becomes the first row
Pointers store the ____________________
Select correct option:
value of a variable
memory address
characters
None of the given
Which of the following function call is “call by reference” for the following function prototype? int add (int *);
Select correct option:
add(&x);
add(int x);
add(x);
add(*x);
The name of the array is a constant pointer which contains the memory address of the ____________of the array.
Select correct option:
first element
Last element
second element
None of the given
array name always contains the memory address of the ___________of the array
Select correct option:
entire elements
last element
first element
None of the given
At the___________, we try to break up the problem into functional units
Select correct option:
analysis phase
design phase
Implementation phase
None of the given


5.2 Q1: Which of the following does counter-controlled repetition require?

            A condition that tests for the final value.
            Counter-controlled repetition requires all of the above.
            An increment or decrement by which the control variable is modified each time through the loop.
            An initial value.

5.2 Q2: The statement
while ( --counter >= 1 )
counter % 2 ? cout << "A" : cout << "B";
cannot be rewritten as:

           
while ( --counter >= 1 )
             if ( counter % 2 )
                                    cout << "A";
             else
                                    cout << "B";.
           
while ( counter >= 1 )
             if ( counter % 2 )
                                    cout << "A";
             else
                                    cout << "B";.
             --counter;
           
while ( --counter >= 1 )
             counter % 2 == 0 ? cout << "B" : cout << "A";.
           
while ( counter > 1 )
{
             --counter;
             if ( counter % 2 )
                                    cout << "A";
             else
                                    cout << "B";
}.

5.2 Q3: Which of the following is a bad programming practice?

            Using floating-point values for counters in counter-controlled repetition.
            Indenting the statements in the body of each control structure.
            Nesting multiple repetition structures one within another.
            Placing vertical spacing above and below control structures.

Section 5.3 for Repetition Statement
5.3 Q1: If a variable is declared in the initialization expression of a for structure, then:

            It can not be used in any structures that are nested in that for structure.
            It retains its final value after the loop is finished.
            The scope of the variable is restricted to that particular for loop.
            It is automatically reinitialized to zero once the loop is finished.

5.3 Q2: Which of the following is not true?

            The initialization and increment expressions can be comma-separated lists.
            You must declare the control variable outside of the for loop.
            The three expressions in the for structure are optional.
            A for loop can always be used to replace a while loop, and vice versa.

5.3 Q3: Consider the execution of the following for loop
for (int x = 1; x < 5; increment )
             cout << x + 1 << endl;
If the last value printed is 5, which of the following might have been used for increment?

            Any of the above.
            x += 1.
            a. x++.
            ++x.

Section 5.4 Examples Using the for Statement
5.4 Q1: Which of the following for headers is not valid?

            for ( int i = 0; i < 10; i++ ).
            int i = 0;
for ( ; i < 10; i++ ).
            for ( int i = 0; int j = 5; ; i++ ).
            for ( int i = 0: i < 10; ).

A Caution about Using Type double for Monetary Amounts
5.4 Q2: float and double variables should be used:

            To perform monetary calculations.
            To store true/false values.
            As imprecise representations of decimal numbers.
            As counters.

Using Stream Manipulators to Format Numeric Output
5.4 Q3: Which of the following is a parameterized stream manipulator used to format output?

            setw.
            right.
            left.
            fixed.

Section 5.5 do…while Repetition Statement
5.5 Q1: If a do…while structure is used:

            Counter-controlled repetition is not possible.
            The body of the loop will execute at least once.
            An infinite loop will not take place.
            An off-by-one error will not occur.

5.5 Q2: What will the following program segment do?
int counter = 1;
do {
             cout << counter << " ";
} while ( ++counter <= 10 );

            Cause a syntax error.
            Print the numbers 1 through 11.
            Print the numbers 1 through 9.
            Print the numbers 1 through 10.

Section 5.6 switch Multiple-Selection Statement
5.6 Q1: A switch statement should be used:

            As a multiple-selection structure.
            As a single-selection structure.
            To replace all if and if…else statements.
            As a double-selection structure.

5.6 Q2: In a switch structure:

            A default case is required.
            A break is required after each case.
            A break is required after the default case.
            Multiple actions do not need to be enclosed in braces.

5.6 Q3: Which of the following is correct when labeling cases in a switch structure?

            Case1.
            Case 1.
            case1.
            case 1.

5.6 Q4: switch can be used to test:

            all types of constants.
             int constants.
            string constants.
            float constants.

5.6 Q5: Which of the following data types can be used to represent integers?

            long.
            short.
            char.
            All of the above.

Section 5.7 break and continue Statements
5.7 Q1: Which of the following is          False?

            break statements exit from the loop in which they are embedded.
            continue statements skip the remaining statements in current iteration of the body of the loop in which they are embedded.
            continue and break statements may be embedded within all C++ structures.
            break and continue statements alter the flow of control.

5.7 Q2: Which of the following is          False?

            Many programmers feel that break and continue violate structured programming.
            The effects of break and continue statements can be achieved by structured programming techniques.
            You should always try to write the fastest, smallest code possible before attempting to make it simple and correct.
            break and continue statements can perform faster than their corresponding structured techniques.

Section 5.8 Logical Operators
5.8 Q1: In C++, the condition ( 4 > y > 1 ):

            Evaluates correctly and could be replaced by ( 4 > y && y > 1 ).
            Does not evaluate correctly and should not be replaced by ( 4 > y && y > 1 ).
            Does not evaluate correctly and should be replaced by ( 4 > y && y > 1 ).
            Evaluates correctly and could not be replaced by ( 4 > y && y > 1 ).

5.8 Q2: The OR (||) operator:

            Stops evaluation upon finding one condition to be true.
            Associates from right to left.
            Has higher precedence than the AND (&&) operator.
            Is a ternary operator.

5.8 Q3: An operator that associates from right to left is:

            ().
            !=.
            ?:.
            ,.

5.8 Q4: The expression if ( num != 65 ) cannot be replaced by:

            if ( !( num == 65 ) ).
            if ( num > 65 || num < 65 ).
            d. if ( !( num – 65 ) ).
            if ( num – 65 ).

5.8 Q5: An example of a unary operator is:

            The < relational operator.
            The = assignment operator.
            The % arithmetic operator.
            The ! logical operator.

Section 5.9 Confusing Equality (==) and Assignment (=) Operators
5.9 Q1: Variables are also known as:

            rvalues, and cannot be used as lvalues.
            lvalues, but can be used as rvalues.
            Constant variables.
            lvalues, and cannot be used as rvalues.

5.9 Q2: Consider the following code, assuming that x is an int with an initial value of 12
if( x = 6 )
             cout << x;
What is the output?

            12.
            6.
            A syntax error is produced.
            Nothing.

5.9 Q3: Of the following, which is not a logic error?

             Failing to initialize counter and total variables before the body of a loop.
            Not placing curly braces around the body of an if that contains two statements.
            Using commas instead of the two required semicolons in a for header.
            Using == to assign a value to a variable.

Section 5.10 Structured Programming Summary
5.10 Q1: The ____________, __________ and ____________ are the only three forms of control necessary.

            break, continue, if…else.
            sequence, selection, repetition.
            switch, if, else.
            for, while, do…while.

5.10 Q2: Which of the following is not one of the C++ control structures?

            if.
            switch.
            do…while.
            main.

5.10 Q3: Which of the following is not one the rules for forming structured programs?

            Any action state can be replaced by any control statement.
            Any transition arrow can be reversed.
            Begin with the “simplest activity diagram.”
            Any action state can be replaced by two action states in sequence

Section 5.11 (Optional) Software Engineering Case Study: Identifying Objects’ States and Activities in the ATM System
5.11 Q1: Which of the following is not a part of a UML state diagram?

            A solid circle indicating the initial state.
            Arrows with accompanying event description text representing transitions.
            Rounded rectangles representing states.
            Fractions beside each state indicating the likelihood of entering that state.

5.11 Q2: An activity diagram for modeling the actions involved in executing a balance inquiry transaction using the BalanceInquiry object should not include:

            Retrieving the user’s balance information from the database of accounts.
            All of the above actions should be modeled in this activity diagram.
            Receiving the user’s main menu input indicating a desire to inquire the amount of his or her balance.
            Displaying the user’s balance information on the screen.




Quiz Start Time: 09:34 PM     Time Left        82
sec(s)    


Question # 1 of 10 ( Start time: 09:34:54 PM )          Total Marks: 1
While developing a program; should we think about the user interface? //handouts main reusability hay..us ki yahan option hi nahi hay
 Select correct option:


Yes

No

 

Quiz Start Time: 09:34 PM     Time Left        75
sec(s)  


Question # 2 of 10 ( Start time: 09:35:20 PM )          Total Marks: 1
A character is stored in the memory in _________
 Select correct option:


byte

integer

string

None of the given



Quiz Start Time: 09:34 PM                            


Question # 3 of 10 ( Start time: 09:36:21 PM )          Total Marks: 1
These functions seekg() and seekp() requires an argument of type ____________to let them how many bytes to move forward or backward.
 Select correct option:


int

short

long

double

 

Quiz Start Time: 09:34 PM     Time Left        85
sec(s)    


Question # 4 of 10 ( Start time: 09:37:30 PM )          Total Marks: 1
dereferencing operator is represented by _______
 Select correct option:


*

+

–

None of the given



Quiz Start Time: 09:34 PM     Time Left        86
sec(s)    


Question # 5 of 10 ( Start time: 09:38:55 PM )          Total Marks: 1
______________ transfers the executable code from main memory to hard disk.

 Select correct option:


Loader

Debugger

Compiler

Linker



Quiz Start Time: 09:34 PM     Time Left        85
sec(s)    


Question # 6 of 10 ( Start time: 09:40:21 PM )          Total Marks: 1
When the logical operator OR (||) combine two expressions exp1 and exp2 then the result will be false only, //bitwise “or” applies here….
 Select correct option:


When both exp1 and exp2 are true

When both exp1 and exp2 are false

When exp1 is true and exp2 is false

When exp1 is false and exp2 is true



Quiz Start Time: 09:34 PM     Time Left        79
sec(s)    


Question # 7 of 10 ( Start time: 09:41:43 PM )          Total Marks: 1
suppose we have int y[10]; To access the 4th element of the array we write_________
 Select correct option:


y[4];

y[3]; correct

y[2];

none of given




Quiz Start Time: 09:34 PM     Time Left        82
sec(s)    


Question # 8 of 10 ( Start time: 09:43:10 PM )          Total Marks: 1
we have opened a file stream myfile for reading (getting), myfile.tellg () gives us the current get position of the file pointer. It returns a whole number of type___________
 Select correct option:


long

int

short

double




Quiz Start Time: 09:34 PM     Time Left        80
sec(s)    


Question # 9 of 10 ( Start time: 09:44:42 PM )          Total Marks: 1
ofstream is used for________
 Select correct option:


Input file stream

Output file stream

Input and output file stream

All of the given




Quiz Start Time: 09:34 PM     Time Left        80
sec(s)    


Question # 10 of 10 ( Start time: 09:46:11 PM )        Total Marks: 1
A structure is a collection of _____________under a single name.
 Select correct option:
values
 variables
 data
None of the given
Question No: 1    ( Marks: 1 )    - Please choose one
 In C/C++ the string constant is enclosed ……………. corrected r red one
► In curly braces
       ► In small braces
       ► In single quotes
       ► In double quotes
   
Question No: 2    ( Marks: 1 )    - Please choose one
 The size of int data type is
       ► 1 bytes
       ► 2 bytes
       ► 3 bytes
       ► 4 bytes
   
Question No: 3    ( Marks: 1 )    - Please choose one
 In Flow chart process is represented by

       ► Rectangle
       ► Arrow symbol
       ► Oval
       ► Circle
   
Question No: 4    ( Marks: 1 )    - Please choose one
 If the break statement is missed in switch statement then,// a break statement with no label always completes abruptly, the reason being a break with no label. If no switch, while, do, or for statement in the immediately enclosing method, constructor or initializer encloses the break statement, a compile-time error occurs.
             
       ► The compiler will give error
       ► This may cause a logical error
       ► No effect on program
       ► Program stops its execution
   
Question No: 5    ( Marks: 1 )    - Please choose one
 When we are using const keyword with a variable x then initializing it at the time of declaration is,
      
       ► Must
       ► Optional
       ► Not necessary
       ► A syntax error
   
Question No: 6    ( Marks: 1 )    - Please choose one
Which of the following is the correct way to assign an integer value 5 to element of a matrix say ‘m’ at second row and third column?

    


       ► m[2][3] = 5 ;

       ► m[3][2] = 5 ;

       ► m[1][2] = 5 ;
       ► m[2][3] = ‘5’;
   
Question No: 7    ( Marks: 1 )    - Please choose one
 How many total elements must be in two-dimensional array of 3 rows and 2 columns?
      

       ► 4
       ► 5
       ► 6
       ► 7

   
Question No: 8    ( Marks: 1 )    - Please choose one
 Which of the following is the correct statement for the following declaration?
const int *ptr.
►ptr is a constant pointer

►ptr is constant integer pointer

►ptr is a constant pointer to int

►ptr is a pointer to const int

Question No: 9    ( Marks: 1 )    - Please choose one
 Consider the following code segment. What will be the output of this code segment?As arrays starts from 0 index………at 1st position is 3………n at position 4th is 5…
……5-3=2

int arr[6] = {2, 3, 7, 4, 5, 6} ;
int *ptr1 =&arr[1] ;      
int *ptr2 = &arr[4] ;
cout << (ptr2-ptr1) ;
     

       ► 3
       ► 9
       ► 12
       ► 2
   

Question No: 10    ( Marks: 1 )    - Please choose one
 What will be the correct syntax to assign an array named arr of 5 elements to a pointer ptr?

►*ptr = arr ; 

►ptr = arr ;

►*ptr = arr[5] ;

►ptr = arr[5] ; 


   
Question No: 11    ( Marks: 1 )    - Please choose one
 C is a/an ______ language
►low level
►object based
►object oriented
►function oriented
   
Question No: 13    ( Marks: 1 )    - Please choose one
 The variables having a name, type and size are just like empty boxes.
►False
►True
   
Question No: 14    ( Marks: 1 )    - Please choose one
 
What's wrong with this for loop?
  for (int k = 2, k <=12, k++)
         
       ► the increment should always be ++k
       ► the variable must always be the letter i when using a for loop
       ► there should be a semicolon at the end of the statement
       ► the commas should be semicolons

Question No: 15    ( Marks: 1 )    - Please choose one
Most efficient method of dealing with structure variables is to define the structure globally

►True
       ►False
   
Question No: 16    ( Marks: 1 )    - Please choose one
 Syntax of union is identical to  ______
►Structure
►Class
►Function
►None of the given options
   
FINALTERM  EXAMINATION
Fall 2008
CS201- Introduction to Programming
Time: 120 min
Marks: 75
Question No: 1      ( Marks: 1 ) - Please choose one
 
There are mainly -------------------- types of software.//

       ► Two
       ► Three
       ► Four
       ► Five

Question No: 2      ( Marks: 1 ) - Please choose one
 
seekg() and write() are functionally _________________ .//
Write() Writes a specified number of bytes from a memory location to the file.
seekg() Moves the file position indicator to a specific location in the file.
The Position property of TFileStream simplifies seeking in a file and performs the same function as the ifstream methods tellg() and seekg(). You can read Position to determine the current file position, or you can write to Position to move the file position.

       ► Different
       ► Identical
       ► Two names of same function
       ► None of the above

Question No: 3      ( Marks: 1 ) - Please choose one
When a pointer is incremented, it actually jumps the number of memory addresses

       ► According to data type
       ► 1 byte exactly
       ► 1 bit exactly
       ► A pointer variable can not be incremented

Question No: 4      ( Marks: 1 ) - Please choose one
 
setw is a parameterized manipulator.

       ► True
       ► False

Question No: 5      ( Marks: 1 ) - Please choose one
 
eof( ), bad( ), good( ), clear( ) all are manipulators.

       ► True
       ► False

Question No: 6      ( Marks: 1 ) - Please choose one
 
In functions that return reference, use __________variables.

       ► Local
       ► Global
       ► Global or static
       ► None of the given option

Question No: 7      ( Marks: 1 ) - Please choose one
 //not confirmed

       ► Class-Name  operator + (Class-Name  rhs)
       ► operator Class-Name + ( )
       ► operator Class-Name + ( rhs)
       ► Class-Name  operator + ( )

Question No: 8      ( Marks: 1 ) - Please choose one
 
The compiler does not provide a copy constructor if we do not provide it……….

//Normally it provides but in some cases of classes it is good practice to provide user define copy constructor…
       ► True
       ► False

Question No: 9      ( Marks: 1 ) - Please choose one
 
What is the functionality of the following syntax to delete an array of 5 objects named arr allocated using new operator?
delete arr ;

       ► Deletes all the objects of array
       ► Deletes one object of array 
       ► Do not delete any object
       ► Results into syntax error

Question No: 10      ( Marks: 1 ) - Please choose one
 
What is the sequence of event(s) when allocating memory using new operator?

       ► Only block of memory is allocated for objects
       ► Only constructor is called for objects
       ► Memory is allocated first before calling constructor
       ► Constructor is called first before allocating memory


Question No: 11      ( Marks: 1 ) - Please choose one
What is the sequence of event(s) when deallocating memory using delete operator?

       ► Only block of memory is deallocated for objects
       ► Only destructor is called for objects
       ► Memory is deallocated first before calling destructor
       ► Destructor is called first before deallocating memory

Question No: 12      ( Marks: 1 ) - Please choose one
 
new and delete operators cannot be overloaded as member functions.

       ► True
       ► False



Question No: 13      ( Marks: 1 ) - Please choose one
 
The operator function of <<  and >> operators are always the member function of a class.

       ► True
       ► False

Question No: 14      ( Marks: 1 ) - Please choose one

A template function must have at least ---------- generic data type

       ► Zero
       ► One
       ► Two
       ► Three

Question No: 15      ( Marks: 1 ) - Please choose one
If we do not mention any return_value_type with a function, it will return an _____ value.

       ► int
       ► void
       ► double
       ► float

Question No: 16      ( Marks: 1 ) - Please choose one
 
Suppose a program contains an array declared as int arr[100]; what will be the size of array?

       ► 0
       ► 99
       ► 100
       ► 101

Question No: 17      ( Marks: 1 ) - Please choose one
The name of an array represents address of first location of array element.

       ► True
       ► False

Question No: 18      ( Marks: 1 ) - Please choose one
Reusing the variables in program helps to save the memory

       ► True
       ► False

Question No: 19      ( Marks: 1 ) - Please choose one
Which of the following option is true about new operator to dynamically allocate memory to an object?
// new is an operator that allows dynamic memory allocation on the heap. Except for a form called the "placement new", new attempts to allocate enough memory on the heap for the new data and, if successful, returns the address to the newly allocated memory. However if new can not allocate memory on the heap it will throw an exception of type std::bad_alloc. This removes the need to explicitly check the result of an allocation.

       ► The new operator determines the size of an object
       ► Allocates memory to object and returns pointer of valid type
       ► Creates an object and calls the constructor to initialize the object
       ► All of the given options

Question No: 20      ( Marks: 1 ) - Please choose one
new and delete are _____ whereas malloc and free are _____.

       ► Functions, operators
       ► Classes, operators
       ► Operators, functions
       ► Operators, classes

Question No: 21      ( Marks: 1 ) - Please choose one
Like member functions, ______ can also access the private data members of a class.
       ► Non-member functions
       ► Friend functions
       ► Any function outside class
       ► None of the given options

Question No: 22      ( Marks: 1 ) - Please choose one
 
Which of the following statement is best regarding declaration of friend function?
       ► Friend function must be declared after public keyword.
       ► Friend function must be declared after private keyword.
       ► Friend function must be declared at the top within class definition.
       ► It can be declared anywhere in class as these are not affected by the public and private keywords.

Question No: 23      ( Marks: 1 ) - Please choose one
The operator function overloaded for an Assignment operator (=) must be
       ► Non-member function of class
       ► Member function of class
       ► Friend function of class
       ► None of the given options

Question No: 24      ( Marks: 1 ) - Please choose one
For non-member operator function, object on left side of the operator may be

       ► Object of operator class
       ► Object of different class
       ► Built-in data type
       ► All of the given options

Question No: 25      ( Marks: 1 ) - Please choose one
The operator function will be implemented as _____, if obj1 drive the - operator whereas obj2 is passed as arguments to - operator in the statement given below.
obj3   =   obj1 -   obj2;

       ► Member function
       ► Non-member function
       ► Friend function
       ► None of the given options

Question No: 26      ( Marks: 1 ) - Please choose one
Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?
       ► Class-name operator +() ;
       ► Class-name operator +(int) ;
       ► Class-name operator ++() ;
       ► Class-name operator ++(int) ;

Question No: 27      ( Marks: 1 ) - Please choose one
 
The static data members of a class are initialized _______

       ► at file scope
       ► within class definition
       ► within member function
       ► within main function

Question No: 28      ( Marks: 1 ) - Please choose one
 
Class is a user defined___________.

       ► data type
       ► memory referee
       ► value
       ► none of the given options.

Question No: 29      ( Marks: 1 ) - Please choose one
We can also define a user-defines manipulators.

       ► True
       ► False

Question No: 30      ( Marks: 1 ) - Please choose one
Automatic variable are created on ________.

       ► Heap
       ► Free store
       ► static storage
       ► stack



Question No: 1      ( Marks: 1 ) - Please choose one
 
Compiler is a

       ► System software
       ► Application Software
       ► Driver
       ► Editor

Question No: 2      ( Marks: 1 ) - Please choose one
 
Operating System is

       ► An application software
       ► System Software
       ► Computer Language
       ► Interpreter

Question No: 3      ( Marks: 1 ) - Please choose one
 
Which one is the correct syntax for defining an identifier PI with preprocessor directive?

       ► #define PI 3.1415926;
       ► #define PI 3.1415926
       ► #define  PI = 3.1415926 ;
       ► #define PI = 3.1415926

Question No: 4      ( Marks: 1 ) - Please choose one
 
Character strings are arrays of characters that can store

       ► Only one character
       ► Limited number of characters
       ► Number of characters specified.
       ► None of the given option

Question No: 5      ( Marks: 1 ) - Please choose one
Which of the following is NOT a preprocessor directive?

       ► #error
       ► #define
       ► #line
       ► #ndefine


Question No: 6      ( Marks: 1 ) - Please choose one
 
Which kind of functions can access private member variables of a class?
       ► Friend functions of the class
       ► Private member functions of the class
       ► Public member functions of the class
       ► Friend, private and public functions

Question No: 7      ( Marks: 1 ) - Please choose one
Let suppose    int a, b, c, d, e;,  a = b = c = d = e = 42;
This can be interpreted by the complier as:// assignment is right-associative.

       ► a = (b = (c = (d = (e = 42))));
       ► (a = b = (c = (d = (e = 42))));
       ► a = b = (c = (d = (e = 42)));
       ► (a = b) = (c = d) = (e = 42);

Question No: 8      ( Marks: 1 ) - Please choose one
 
Friend function of a class is ______________ .

       ► Member function
       ► Non-member function
       ► Private function
       ► Public function

Question No: 9      ( Marks: 1 ) - Please choose one
 
Function implementation of friend function must be defined outside the class.
       ► True
       ► False

Question No: 10      ( Marks: 1 ) - Please choose one
When we define an array of objects then,

       ► Constructor will be called once for whole array
       ► Constructor will be called for each object of the array
       ► Constructor will never call
       ► Depends on the size of array

Question No: 11      ( Marks: 1 ) - Please choose one
 
The stream objects cin and cout are included in which header file?
       ► iostream.h
       ► fstream.h
       ► istream.h
       ► ostream.h

Question No: 12      ( Marks: 1 ) - Please choose one
 
What is the sequence of event(s) when allocating memory using new operator?

       ► Only block of memory is allocated for objects
       ► Only constructor is called for objects
       ► Memory is allocated first before calling constructor
       ► Constructor is called first before allocating memory

Question No: 13      ( Marks: 1 ) - Please choose one
Missing semicolon ‘;’ at the end of C++ statement is

       ► Logical error
       ► Syntax error
       ► Runtime error
       ► None of the given options

Question No: 14      ( Marks: 1 ) - Please choose one
 
An array stores the numbers into consecutive memory locations.

       ► True
       ► False

Question No: 15      ( Marks: 1 ) - Please choose one
 
The template functions do NOT promote the code reuse

       ► True
       ► False

Question No: 16      ( Marks: 1 ) - Please choose one
 
What will be the correct syntax for initialization of pointer ptr of type int with variable x?

       ► int ptr = &x ;
       ► int ptr = x ;
       ► int *ptr = &x ;
       ► int ptr* = &x ;

Question No: 17      ( Marks: 1 ) - Please choose one
 
Which of the following function calling mechanism is true for the function prototype given below?
float func(float &);

       ► Call by value
       ► Call by reference using pointer
       ► Call by reference using reference variable
       ► None of the given options

Question No: 18      ( Marks: 1 ) - Please choose one
 
If overloaded plus operator is implemented as non-member function then which of the following statement will be true for the statement given below?
obj3 = obj1 + obj2 ;

       ► obj2 will be passed as an argument to + operator  whereas obj2 will drive the + operator
       ► obj1 will drive the + operator whereas obj2 will be passed as an argument to + operator
       ► Both objects (obj1, obj2) will be passed as arguments to the + operator
       ► Any of the objects (obj1, obj2) can drive the + operator

Question No: 19      ( Marks: 1 ) - Please choose one
Which of the following object(s) will call the member operator function within the statement given below?
obj1=obj2+obj3;

       ► Object obj1
       ► Object obj2
       ► Object obj3
       ► Any of the object

Question No: 20      ( Marks: 1 ) - Please choose one
 
For cin, the source is normally a ________ and destination can be ______.

       ► File, native data type
       ► Disk, user-define type
       ► Keyboard, variable
       ► File, user-define type

Question No: 21      ( Marks: 1 ) - Please choose one
 
The static data members of a class will be ________
       ► shared by objects
       ► created for each object
       ► initialized within class
       ► initialized within main function

Question No: 22      ( Marks: 1 ) - Please choose one
 
Which of the following function cannot be overloaded?
       ► Member functions
       ► Utility functions
       ► Constructor
       ► Destructor

Question No: 23      ( Marks: 1 ) - Please choose one
 
The region of memory, available for allocation at run time in C language is called ________ memory whereas in C++ language is called as ________________.

       ► Heap, Stack
       ► Stack, Free Store
       ► Heap, Free Store
       ► None of above

Question No: 24      ( Marks: 1 ) - Please choose one
 
A variable which is defined inside a function is called

       ► Automatic variable
       ► Global variable
       ► Functional variable
       ► None of the given option

Question No: 25      ( Marks: 1 ) - Please choose one
 
The default copy constructor provides member wise assignment.
       ► True
       ► False

Question No: 26      ( Marks: 1 ) - Please choose one
 
The code is written to __________ the program.
       ► implement
       ► design
       ► analysis
       ► none of the given options.

Question No: 27      ( Marks: 1 ) - Please choose one
 
When a call to a user-defined function finishes, the variable defined inside the function is still in existence.

       ► True
       ► False

Question No: 28      ( Marks: 1 ) - Please choose one
 
To avoid dangling reference, always return the reference of a local variable from a function.

       ► True
       ► False

Question No: 29      ( Marks: 1 ) - Please choose one
 
Analysis is the -------------- step in designing a program.

       ► Last
       ► Middle
       ► Post Design
       ► First

Question No: 30      ( Marks: 1 ) - Please choose one
 
"delete" operator is used to return memory to free store, which is allocated by the "new" operator.

       ► True
       ► False

Question No: 1      ( Marks: 1 ) - Please choose one
 
In C/C++ if we define an array of size eight (8) i.e. int Arr [8]; then the last element of this array will be stored at,

       ► Arr[0]
       ► Arr[8]
       ► Arr[7]
       ► Arr[-1]

Question No: 2      ( Marks: 1 ) - Please choose one
 
When an array is passed to a function then default way of passing this array is,

       ► By data
       ► By reference
       ► By value
       ► By data type

Question No: 3      ( Marks: 1 ) - Please choose one
 
Array is a data structure which store

       ► Memory addresses
       ► Variables
       ► Data Type
       ► Data

Question No: 4      ( Marks: 1 ) - Please choose one
 
We can also create an array of user define data type.

       ► True
       ► False

Question No: 5      ( Marks: 1 ) - Please choose one
 
When we define an array of objects then,

       ► Destructor will call once for whole array
       ► Destructor will call for each object of the array
       ► Destructor will never call
       ► Depends on the size of array


Question No: 6      ( Marks: 1 ) - Please choose one
 
What is the sequence of event(s) when allocating memory using new operator?

       ► Only block of memory is allocated for objects
       ► Only constructor is called for objects
       ► Memory is allocated first before calling constructor
       ► Constructor is called first before allocating memory

Question No: 7      ( Marks: 1 ) - Please choose one
 
We can delete an array of objects without specifying [] brackets if a class is not doing dynamic memory allocation internally.

       ► True
       ► False

Question No: 8      ( Marks: 1 ) - Please choose one
 
The second parameter of operator functions for << and >> are objects of the class for which we are overloading these operators.

       ► True
       ► False

Question No: 9      ( Marks: 1 ) - Please choose one
 
Which of the following is correct way to initialize a variable x of int type with value 10?

       ► int x ; x = 10 ;
       ► int x = 10 ;
       ► int x, x = 10;
       ► x = 10 ;

Question No: 10      ( Marks: 1 ) - Please choose one
 
Default mechanism of function calling in case of array is _____ and in case of variable is ___.

       ► Call by value, call by reference
       ► Call by referene, call by reference
       ► Call by reference, call by value
       ► Call by value, call by value


Question No: 11      ( Marks: 1 ) - Please choose one
 
What does STL stand for?

       ► Source template library
       ► Standard template library
       ► Stream template library
       ► Standard temporary library

Question No: 12      ( Marks: 1 ) - Please choose one
 
Skill(s) that is/are needed by programmers _______________________.

       ► Paying attention to detail
       ► Think about the reusability
       ► Think about user interface
       ► All of the given options

Question No: 13      ( Marks: 1 ) - Please choose one
 
For which array, the size of the array should be one more than the number of elements in an array?

       ► int
       ► double
       ► float 
       ► char

Question No: 14      ( Marks: 1 ) - Please choose one
 
new and delete are _____ whereas malloc and free are _____.

       ► Functions, operators
       ► Classes, operators
       ► Operators, functions
       ► Operators, classes

Question No: 15      ( Marks: 1 ) - Please choose one
 
Friend functions are _____ of a class.
       ► Member functions
       ► Public member functions
       ► Private member functions
       ► Non-member functions

Question No: 16      ( Marks: 1 ) - Please choose one
 
The prototype of friend functions must be written ____ the class and its definition must be written ____
       ► inside, inside the class
       ► inside, outside the class
       ► outside, inside the class
       ► outside, outside the class

Question No: 17      ( Marks: 1 ) - Please choose one
 
If overloaded plus operator is implemented as non-member function then which of the following statement will be true for the statement given below?
obj3 = obj1 + obj2 ;

       ► obj2 will be passed as an argument to + operator  whereas obj2 will drive the + operator
       ► obj1 will drive the + operator whereas obj2 will be passed as an argument to + operator
       ► Both objects (obj1, obj2) will be passed as arguments to the + operator
       ► Any of the objects (obj1, obj2) can drive the + operator

Question No: 18      ( Marks: 1 ) - Please choose one
 
Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?


       ► Class-name operator +() ;
       ► Class-name operator +(int) ;
       ► Class-name operator ++() ;
       ► Class-name operator ++(int) ;

Question No: 19      ( Marks: 1 ) - Please choose one
 
For cin, the source is normally a ________ and destination can be ______.

       ► File, native data type
       ► Disk, user-define type
       ► Keyboard, variable
       ► File, user-define type

Question No: 20      ( Marks: 1 ) - Please choose one
 
We can also do conditional compilation with preprocessor directives.
       ► True
       ► False

Question No: 21      ( Marks: 1 ) - Please choose one
 
The programs, in which we allocate static memory, run essentially on ________

       ► Heap
       ► System Cache
       ► None of the given options
       ► Stack


Question No: 22      ( Marks: 1 ) - Please choose one
 
The default value of a parameter can be provided inside the ________________

      ► function prototype
       ► function definition
       ► both function prototype or function definition
       ► none of the given options.

Question No: 23      ( Marks: 1 ) - Please choose one
 
While calling function, the arguments are assigned to the parameters from _____________.

       ► left to right.
       ► right to left
       ► no specific order is followed
       ► none of the given options.

Question No: 24      ( Marks: 1 ) - Please choose one
 
When an operator function is defined as member function for a binary Plus (+) operator then the number of argument it take is/are.

       ► Zero
       ► One
       ► Two
       ► N arguments

Question No: 25      ( Marks: 1 ) - Please choose one
 
With user-defined data type variables (Objects), self assignment can produce __________.

       ► Syntax error
       ► Logical error
       ► Link error
       ► Non of the given options

Question No: 26      ( Marks: 1 ) - Please choose one
 
Assignment operator is used to initialize a newly declared object from existing object.

       ► True
       ► False

Question No: 27      ( Marks: 1 ) - Please choose one
 
When an object of a class is defined inside an other class then,

       ► Constructor of enclosing class will be called first
       ► Constructor of inner object will be called first
       ► Constructor and Destructor will be called simultaneously
       ► None of the given options

Question No: 28      ( Marks: 1 ) - Please choose one
 
In the member initializer list, the data members are initialized,

       ► From left to right
       ► From right to left
       ► In the order in which they are defined within class
       ► None of the given options

Question No: 29      ( Marks: 1 ) - Please choose one
 
new operator allocates memory from free store and return _____________.

       ► A pointer
       ► A reference
       ► An integer
       ► A float

Question No: 30      ( Marks: 1 ) - Please choose one
 
"new" and "delete" keywords are _____________ in C++ language.
       ► Built-in- Function
       ► Operators
       ► Memory Allocation Function
       ► None of  the given options