CS201_Solved_Final_Term_Papers by zulqarnainjobs

VIEWS: 2 PAGES: 6

									http://vustudents.ning.com/


                                 MCQS SOLVED BY: _ALIMS_


Question: 1
New operator is used to allocate memory from the free store during ______________

Compile Time
Run Time
Link Time
None of above


Question: 2
To get the memory address of a variable we use _____

&
&&
*
|


Question: 3

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 will gather the number is called

Buffer
Stream
Memory
None of these


Question: 4

What functionality the following program is performing?

#include <iostream.h>

int main()
{
       const int SIZE = 80;
       char buffer[SIZE];
       cout <<" Enter a sentence : ";
       cin.getline(buffer, SIZE);
       cout<<buffer <<endl;


http://vustudents.ning.com/
http://vustudents.ning.com/


        system("pause");

}

objects are used respectively to read a sentence from the key board and then print it on the screen.
Using getline function
using character arrays
Doing nothing


Question: 5

The get member function, when passed no arguments, inputs an entire stream and returns it
as the value of the function call.

True
False

Question: 6
New operator allocates memory from free store and returns ___________

Void
NULL
Nothing return
None of above


Question: 7

The statement cin.get (); is used to,

Read a character from keyboard
Read a an entire string
Read integer values
Read float values


Question: 8
Suppose int i = 10; then what will be the value of i after being converted in to octal value

10
12
14
16

Question: 9


http://vustudents.ning.com/
http://vustudents.ning.com/


Which of the following is a destination of cout stream?

Monitor /screen
Keyboard
Memory
None of these

Question: 10
Which of the following is the correct definition of streams ?

streams are memory locations
sequence of bytes are called streams
sequence of variables are called streams
sequence does not have any definition


Question: 11
Stream operators are heavily overloaded means , they allow to handle int and character data
type only.

true
false


Question: 12
What functionality the following program is performing?

int main()
{
       const int SIZE = 80;
       char buffer[SIZE];
       cout <<" Enter a sentence : ";
       cin.getline(buffer, SIZE);
       cout<<buffer <<endl;
       system("pause");

}

read and write member functions of cin and cout objects are used respectively to read a sentence
from the key board and then print it on the screen.

read and put member functions of cin and cout objects are used respectively to read a sentence from
the key board and then print it on the screen.

get and write member functions of cout and cin objects are used respectively to read a sentence
from the key board and then print it on the screen.


http://vustudents.ning.com/
http://vustudents.ning.com/



get and write member functions of cout and cin objects are used respectively to read a sentence
from the key board and then print it on the screen.


Question: 13
Which of the following is a source for cout stream?

monitor / screen
keyboard
proccessor
none of these


Question: 14
If we use cin stream to read some value and store it in some integer variable and press some
alphabet key instead of numeric keys. then what will happen?


Its binary representation will be ignored and the character will be stored

Its binary representation will be ignored and the value will be stored

Its ASCII code will be stored inside the computer

Some error will occur and cin stream will detect this error.


The endl and flush are _____

Functions
Operators
Manipulators
Objects

What is the difference between cout and cerr ?

cout is unbuffered output and cerr is buffered output

cout is standard output and cerr is not a standard output

cout is not a standard output and cerr is standard output

cout is buffered output and cerr is unbuffered output

The operator function for << (stream insertion) >> and stream extraction must be


http://vustudents.ning.com/
http://vustudents.ning.com/



Member function of class
Non-member function of class
Both member and non-member function
None of the given options
Reference: (These cin and cout objects will remain intact for our overloaded
insertion and extraction operators. Therefore, the overloaded operators cannot
be member operators.)

Note: I took this reference



The pointer returned by the new operator points to --------------- of memory chunks allocated
by the new operator

First memory address

Second memory address

Last memory address
None of the above


When we used eof (end of file) with the file reading than which of the following is a true
statement?
This is way to check source of the stream
This is way to check destination of the stream
This is way to check state of the stream
This is way to check type of the stream

The stream insertion and extraction operators are not already overloaded for ____

Built-in data types

User-defined data types

Both built-in and user-defined types

None of the given options

When a variable is defined as static in a class then ___________

Separate copy of this variable is created for each object
Only one copy is created for all objects of this class
A copy of this variable is created for only static objects.
None of the given options



http://vustudents.ning.com/
http://vustudents.ning.com/



Static variable which is defined in a function is initialized ________.
Only once during its life time

Every time the function call

Compile time of the program

None of the above



Which of the following concept is NOT associated with stream?

NULL




http://vustudents.ning.com/

								
To top