MCQs of CS201 2013 updated

There is an array of characters having name „course‟ that has to be initialized by string „programming‟ which of the following is the correct way to do this,
i. course[] = {„p‟, ‟r‟, ‟o‟, ‟g‟, ‟r‟, ‟a‟, ‟m‟, ‟m‟, ‟i‟, ‟n‟, ‟g‟};
ii.course[] = „programming‟ ; iii. course[12] = “programming” ; iv. course = “programming” ;
Choose the correct options.
► (i) and (ii) only
► (i) and (iv) only
► (i) and (iii) only
► (ii) and (iii) only
Overloaded member operator function is always called by _______
► Class
► Object
► Compiler
► Primitive data type

Consider the following code segment
class M {    friend int operator!(const M &);
...
};
!s // code of line implies that    operator!(s)
...
Let assume if s is an object of the class then function is implemented as ___________
► Member function
► Non-member function
► Binary operator function
► None of the given options
None of the given options
Copy constructor becomes necessary while dealing with _______allocation in the class.
► Dynamic memory
► Static memory
► Both Dynamic and Static memory
► None of the given options
1) C/C++ string constant is enclosed in       
Small braces
Curly braces
Double quote
Single quote
2) Unary operator takes argument
Zero
One
Two
Three
3) When define array of objects
Constructor will call
Destructor will call
The size of int data type is
► 1 bytes
► 2 bytes
► 3 bytes
► 4 bytes
In Flow chart process is represented by
► Rectangle
► Arrow symbol
► Oval
► Circle
If the break statement is missed in switch statement then,
► The compiler will give error
► This may cause a logical error
► No effect on program
► Program stops its execution
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
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‟;
How many total elements must be in two-dimensional array of 3 rows and 2 columns?
►4
►5
►6
►7
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 ►
Consider the following code segment. What will be the output of this code segment? int arr[6] = {2, 3, 7, 4, 5, 6} ; int *ptr1 =&arr[1] ; int *ptr2 = &arr[4] ; cout << (ptr2-ptr1) ;
►3
►9
► 12
►2
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] ; ►
The variables having a name, type and size are just like empty boxes.
►False
True ►
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

Most efficient method of dealing with structure variables is to define the structure globally 
► True
False ►
Syntax of union is identical to ______
► Structure
► Class
► Function
► None of the given options
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
Function created with in function called?

nested overloaded grouped none of them