irshadjat@gmail.com wrote:
Quote:
Question No.01
Which of the following is true about streams?
>
A. It is a sequence of bytes
B. It is an ordered sequence
C. All bytes can go through the stream simultaneously
D. Bytes that enters first into the stream will go out at last
0 A only
0 C only
0 A and B
0 A and D
C only.
Quote:
Question No.02
Consider the following code segment.
1. String s1, s2;
2. s1 = s2;
>
Which of the following will be called while executing code at line 2 ?
>
0 Copy constructor
0 Default constructor
0 Assignment operator
0 Parameterized constructor
Either the default constructor or the parameterized constructor,
depending on whether you're using Visual Studio or gcc.
Quote:
Question No.03
What is the difference between cout and cerr ?
>
>
0 cout is unbuffered output and cerr is buffered output
0 cout is standard output and cerr is not a standard output
0 cout is not a standard output and cerr is standard output
0 cout is buffered output and cerr is unbuffered output
Answer 3 is correct.
Quote:
Question No.04
If text is a pointer of type String then what will be the
functionality of following statement?
text = new String [5];
>
0 Creates array of 5 Staring objects statically
0 Creates array of 5 String objects dynamically
0 Creates array of pointers to String objects
0 Creates a String object
The first answer, obviously.
Quote:
Question No.05
When an operator function is defined as member function for a Unary
operator then how many argument it will take?
>
0 Zero
0 One
0 Two
0 More then two arguments
Of course it's more than two arguments, often 4 or 5, depending on
whether the "that" pointer is also passed.
Quote:
Question No.06
Which of the following is the only operator that the compiler
overloads for user define data type?
0 Assignment (=)
0 Plus (+)
0 Minus (-)
0 Equal (==)
It's "==", for which the compiler will automatically generate code to
compare a hashsum of the memory areas occupied by the objects in question.
Quote:
Question No.07
If we do not write our own assignment operator then which of the
following problem may occur?
0 Memory Leak
0 Dangling pointer
0 NULL pointer
0 Unreferenced memory
Dangling pointer. There're a couple other problems, such as possibly
preventing the system from deallocating a process' CPU time when it
exits but these are rather system-dependent.
Quote:
Question No.08
What functionality the following program is performing?
>
#include <iostream.h>
>
int main(0
{
const int SIZE = 80;
char buffer[SIZE];
cout <<” Enter a sentence : “<<endl;
cin.read (buffer, SIZE);
cout << “ The sentence entered is : “ <<endl;
cout.write(buffer, cin.gcount());
>
return 0;
}
It prints the length of the sequence it read from cerr.
Quote:
0 read and write member functions of cin and cout objects are used to
read a sentence from the keyboard and then print it on the screen.
0 read and put member functions of cin and cout objects are used to
read a sentence from the key board and then print it on the screen.
0 get and write member functions of cout and cin objects are used to
read a sentence from the keyboard and then print it on the screen.
0 read and write member functions of cin and cout objects are used to
read a word from the key board and then print it on the screen.
This is a really hard one and it's difficult to decide. I'd go with the
first answer.
Quote:
Question No.09
If we have a program that writes the output data (numbers) to the disc
and if we collect the output data and write it on the disc in one
write operation instead of writing the numbers one by one.
In the above situation the area where we gather the number is called
>
0 Heap
0 Stack
0 Buffer
0 Cache
On the stack, of course.
Quote:
Question No.10
Consider the following code segment.
String str[5] = {String(“Programming”), String(“CS201”)};
0 Default constructor will be called for all 5 objects
0 Parameterized constructor will be called for all 5 objects
0 Parameterized constructor will be called for first 2 objects
0 Default constructor will be called for first 2 objects
Obviously the default constructor will be called for all 5 objects.
These were pretty easy. Good luck. Hope that helps.