Professional Documents
Culture Documents
Fall 2009
CS201- Introduction to Programming
Ref No: 1125946
Time: 120 min
Marks: 75
Student Info
Student ID: MC090407138
Center:
Exam Date:
Marks
Q No. 9 10 11 12 13 14 15 16
Marks
Q No. 17 18 19 20 21 22 23 24
Marks
Q No. 25 26 27 28 29 30 31 32
Marks
Q No. 33 34 35 36 37 38 39 40
Marks
Q No. 41
Marks
Question No: 1 ( Marks: 1 ) - Please choose one
► Two
► Three
► Four
► Five
► functions
► datatypes
► Arithmetic operations
A special name which is substituted in code by its definition and as a result we get an expanded
code is called,
► include
► Directive
► Macro
► Define
If constructor contains a return statement in its body then compiler will give __________
► No error
► Syntax error
► Logical error
► True
► False
If a friend function outside the class declare itself friend of the class, this will neglect concept of
___________.
► encapsulation and data accessing
Which of the following is the only operator that the compiler overloads for user define data type?
► Plus (+)
► Minus (-)
► Equal (= =)
► Assignment (=)
► Member function
► Non-member function
► Private function
► Public function
► True
► False
The default scope for members of structures is public whereas the default visibility for class
members is private.
► True
► False
What is the sequence of event(s) when deallocating memory using delete operator?
Overloaded delete operator function takes the same parameter as an argument returned by new
operator function.
► True
► False
Which of the following syntax will be used to initialize an array of size 5 of int data type to value
0?
► arr[5] = {0} ;
► int arr[5]= 0 ;
► int arr[] = 0 ;
► Pointers
► Array index
► 510
►5
► 48
► error
► Certain overloaded operators can change the number of arguments they take.
The stream insertion and stream extraction operators are already overloaded for ______.
► User-defined data types
The stream insertion and extraction operators are not already overloaded for _______
► Heap
► System Cache
► Stack
Question No: 22 ( Marks: 1 ) - Please choose one
► Stack
► Heap
► System Cache
► function prototype
► function definition
class M {
friend int operator!(const M &);
...
};
► Member function
► Non-member function
The second parameter of operator function for >> operator must always be passed
► By reference
► By value
► Explicitly
► Implicitly
► void pointer
► int
What will be the output of following function if we call this function by passing int 5?
If the requested memory is not available in the system then what does calloc/malloc and new
operator return?
If we want to send the data by reference and don’t want that original data should be affected then
what can we do to prevent any change?
Why the first parameter of operator function for << operator must be passed by reference?
Question No: 39 ( Marks: 5 )
main () {
int x, y;
x = 23;
cout << "Value of x before calling addValue ():\t" << x << endl;
y = addValue (x);
cout << "Value of x after calling addValue ():\t" << x <<endl;
cout << "Value of y:\t" << y;
}
While doing dynamic memory allocation in class what are the important things that should be
implemented in class.