I
irshadjat
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
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
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
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
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
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 (==)
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
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;
}
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.
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
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
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
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
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
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
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
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 (==)
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
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;
}
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.
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
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