The More I Help Others To Succeed, The More I Succeed

CS201 Midterm Quiz And Grand Quiz

Past Papers Quiz 242
CS201 Midterm Quiz And Grand Quiz

CS201 Midterm Quiz And Grand Quiz

CS201-Introduction to Programming

CS201 Midterm Quiz And Grand Quiz

CS201 Midterm Quiz And Grand Quiz



if (a>b && a>c) then the condition will be true only if 
Both a>b and a>c are true
 a>b is false and a>c is true
 a>b is true and a>c is false
 Both a>b and a>c are false 

In while loop the loop counter must be initialized, 
 With in the loop
 Before entering the loop
 At the end of the loop
 None of the given options

 __________ of a variable means the locations within a program from where it can be accessed. 
  Data type
Visibility
 Value
 Reference

 Switch support_______________ data.
 Integer 
 Character
 Float 
 Both integer and character 

 A function is a block of statements that can be defined once and used ________ in the program. 
 One time
 Two times
 Three times
 As many times as user wants

_________statement is used to terminate the processing of a particular case and exit from switch structure. 
 if
 goto
 break
 continue
 

The most suitable data type for number 325.25 is ______. 
 char
 int
 short
 float 
X is an integer variable; what does X++ means, 
 Add 1 two times in X value 
 Add 1 in X value 
 Add 2 in X value 
 None of these  

The operators ++ and –- are used to increment or decrement the value of a variable by ________ 
 1
 2
 3
 4

Which of the following loops checks the test condition at the end of the loop?
 While
 Do-While
 For
 Nested Loop

Overloaded delete operator function takes parameter of void pointer and returns void (nothing)

For binary member operators, operands on the         drives (calls) the operation.

 Left

                  operators are the ones that require only one operator to work.

Unary

dec, hex, oct are all                                                    

Non-parameterized manipulators

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;

}

CS201 Midterm Quiz And Grand Quiz

When an operator function is define as member function for a Unary operator then the number of argument it take is/are,

Zero

C++ offers type-safe I/O. The << and >> operators are overloaded to accept data items of specific types.

True

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

True

The ws manipulator can be used with                                                                               stream(s). Input/Output

Which of the following is true about streams?

  1. It is a sequence of bytes
  2. It is an ordered sequence
  3. All bytes can go through the stream simultaneously
  4. Bytes that enters first into the stream will go out at last

A and B

We Cannot Use              _ Pointer for storing and reading data from it

 NULL

The Friend Keyword Provides access                                                   . In

one direction Only

Bug can Occur due to                                                 . Uninitialized data

In C language, the region of memory allocated at runtime is called                                                                                                            . Heap

Default Constructor takes                                                         . No parameters

Which of the following permits function overloading in C++?

Both type and arguments

                       is a special type of pointer we have to cast it before. void

Object Code is machine code but it is not                                                                                              and               . relocatable, executable

                       for parameters is also done for inline functions.

Automatic type checking

#undef is used for                                         . Making a symbol undefined

< and > both are _________ operators.
Arithmetic
Relational
Logical   

Mathematical

Find out the logical error in following lines of code. If (x = 10) cout “x is 10”;

There is no semicolon at the end of if condition
Assignment operator should not be used for Comparison 
Variable x should not be inside parenthesis

CS201 Midterm Quiz And Grand Quiz


What will be the result of the expression j = i++; if initially j = 0 and i = 5?
0
5 
6
4

Default mechanism of calling a function by passing it array is call by ________ and in case of passing variable is call by ________.
Reference, Reference
Reference,value   
Value, Reference
Value, Value

When the break statement is encountered in a loop’s body, it transfers the control ________from the current loop.
Inside

Outside 

To break statement
To continue statement

CS201 Midterm Quiz And Grand Quiz


________statement is used to terminate the processing of a particular case and exit from switch structure.
If
Goto
Break 
Continue

When the if statement consists of more than one statement then enclosing these statement in braces is _________. 
 
Compulsory 

 Optional
 Not required
 Relevant

We use _________ to open a file or stream for extraction
  in
Null character is represented by _________ in C++.
/0
An object of _________ class can be created for saving the current position of any opened file before reading from the file.
Streampos
 ____________________ Returns true if c is a digit or a letter and false otherwise.
int isalnum( int c )  
We use _________ to open a file or stream for insertion.
out
Base address is the memory address of _______ element of an array.
1st
__________ allow us to have a memory location and use it as int or char interchangeably
union
To read command-line arguments, the main() function itself must be given ___________ arguments.
2
Individual characters in a string stored in an array can be accessed directly using array _______.
subscript
To manipulate n-dimensional array ___________ nested loops are required.
n-1
A character is stored in the memory in _________
string
What will be the size of following array? int arr[29];
29
An object of _________ class can be created for saving the current position of any opened file before reading from the file.
Streampos
We use _________ to open a file or stream for extraction.
in
We use _________ to open a file or stream for insertion.
out
 _______________are conventional names of the command line parameters of the ‘main()’ function.
‘argc’ and ‘argv’
In_____________, we have different data members and all of these have their own memory space.
structures
How we declare an array of integer data whose size is 20 with array name “count”.
int count[20];
A ________is an array of characters that can store number of character specified.
String
File. seekg (-10L, ios:cur)
backword direction
CS201 Midterm Quiz And Grand Quiz

_______________are conventional names of the command line parameters of the ‘main()’ function.

 ‘argb’ and ‘argv’

 ‘argc’ and ‘argv’

‘argc’ and ‘argu’

Suppose that an integer type pointer contains a memory address 0x22f220. What will be the new memory address if we increment this pointer by one?

0x22f221

0x22f222

0x22f223

0x22f224

Which header file must be included to use the functions tolower() and toupper()?

iostream.h

conio.h

ctype.h

stdlib.h

dereferencing operator is represented by

*

+

none

In Analysis, we try to have a______________

Determined the inputs

Break up of problem (I think not sure)

Precise problem statement

None of the given

Base address is the memory address of _______ element of an array.

1st

2nd

3rd

4th

CS201 Midterm Quiz And Grand Quiz

Pointers store the

value of a variable

memory address

characters

none

CS201 Midterm Quiz And Grand Quiz

The name of the array is a constant pointer which contains the memory address of the ____________of the array.

first element

Last element

second element

none

Whenever some number is added in an array name, it will jump as many _____________as the added number.

rows

value

col

none

 ___________ Returns true if c is a digit and false otherwise

int isalpha( int c )

int isalnum( int c )

int isxdigit( int c )

int isdigit( int c )

Base address is the memory address of _______ element of an array.

1st element(Not Sure)
2ad element
3rd element
none of above

In_________, we try to have a precise problem statement

Analysis
Desing
Coding
None of the given


Each array declaration must provide the information about all these things except

Name of the array
Type of data stored in the array
The location of the first element to be stored
Number of elements of the array

 Pointers work by pointing to a particular___________

value
variable
data type
None of the given

 are conventional names of the command line parameters of the ‘main()’ function.

‘argb’ and ‘argv’
‘argc’ and ‘argv’
‘argc’ and ‘argu’
None of above


Which header file must be included to use the functions tolower() and toupper()?


iostream.h
conio.h
ctype.h (not sure)


 The statement cout yptr will show the __________the yptr points to.

Value
memory address

 In Analysis, we try to have a______________

Determined the inputs
Break of problem
Precise problem statement
None of the given


 Pointers are a special type of __________in which a memory address is stored

variable

 ___________ Returns true if c is a digit and false otherwise.

int isalpha( int c )
int isalnum( int c )
int isxdigit( int c )
int isdigit( int c )


 At the___________, we try to break up the problem into functional units

analysis phase
design phase
Implementation phase
None of the given


 The increment of a pointer depends on its___________.

variable
value
data type
none

 We must include the header file ________to convert the value of one type into another type using built-in functions.

conio.h
stdlib.h.
string.h
iostream.h


 We must include the header file ________to convert the value of one type into another type using built-in functions.


To get the value stored at a memory address, we use the_______________

referencing operator
dereferencing operator
simple operator
None of the given

 A character is stored in the memory in _________

byte
integer
string
none


 char **argv can be read as_________________

pointer to pointer(Not Sure)
pointer to char
pointer to pointer to char
None of the given

 ______________ Returns true if c is a letter and false otherwise.

int isalpha( int c )
int isalnum( int c )
int isxdigit( int c )
int isdigit( int c )

 suppose we have int y[10]; To access the 4th element of the array we write________

y[4];
y[3];
y[2];
none


 Given a two dimensional array of integers, what would be the correct way of assigning the value 6 to the element at third row and fourth column?

array[3][4] = 6 ;
array[2][4] = 6 ;
array[4][3] = 6 ;
array[2][3] = 6 ;

Return type of a function that does not return any value must be ________.
Select correct option:
char
int
void
double

A function’s prototype is written __________the function call.
Select correct option:

After
Before
With
At the end of

What will be the size of the following character array? char name[] = “Adeel”;
Select correct option:
5
6
4
7

From following; which one is the correct syntax of an array initialize: Array size is 10 and it is of double data type to value 0?
arr[10] = {0.0};
double arr[10]= 0.0;
double arr[10] = {0.0};
double arr[] = 0.0;

Which of the function call is call by value for the following function prototype? float add(int);

add(&x);
add(x);
add(int x);
add(*x);

Null character is represented by _________ in C++.

/0
\0 *
\n
\t

What is the output of the following code, if the first case is true switch (var) { case ‘a’: cout”apple”endl; case ‘b’: cout”banana”endl; case ‘m’: cout”mango”endl; default: cout”any fruit”endl; }

apple 
apple anyfruit
apple banana mango *
none of above

Which of the following function call is “call by reference” for the following function prototype? int add (int *)

add(&x);
add(int x);
add(x);
add(*x);

The string in the array is terminated by a _______

0
nil
null
on

Default mechanism of calling a function by passing it array is call by ________ and in case of passing variable is call by ________

Reference, Reference
Reference, value
Value, Reference
Value, Value



What does STL stand for?

► Source template library
► Standard template library
► Stream template library
► Standard temporary library



Skill(s) that is/are needed by programmers _______________________.

► Paying attention to detail
► Think about the reusability
► Think about user interface
► All of the given options

For which array, the size of the array should be one more than the number of elements in an array?

► int
► double
► float
► char


new and delete are _____ whereas malloc and free are _____.

► Functions, operators
► Classes, operators
► Operators, functions
► Operators, classes


Friend functions are _____ of a class.
► Member functions
► Public member functions
► Private member functions
► Non-member functions




The prototype of friend functions must be written ____ the class and its definition must be written ____
► inside, inside the class
► inside, outside the class
► outside, inside the class
► outside, outside the class



If overloaded plus operator is implemented as non-member function then which of the following statement will be true for the statement given below?
obj3 = obj1 + obj2 ;

► obj2 will be passed as an argument to + operator whereas obj2 will drive the + operator
► obj1 will drive the + operator whereas obj2 will be passed as an argument to + operator
► Both objects (obj1, obj2) will be passed as arguments to the + operator
► Any of the objects (obj1, obj2) can drive the + operator


Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?

► Class-name operator +() ;
► Class-name operator +(int) ;
► Class-name operator ++() ;
► Class-name operator ++(int) ;


For cin, the source is normally a ________ and destination can be ______.

► File, native data type
► Disk, user-define type
► Keyboard, variable
► File, user-define type



We can also do conditional compilation with preprocessor directives.
► True
► False



The programs, in which we allocate static memory, run essentially on ________

► Heap
► System Cache
► None of the given options
► Stack


The default value of a parameter can be provided inside the ________________

► function prototype
► function definition
► both function prototype or function definition
► none of the given options.


While calling function, the arguments are assigned to the parameters from _____________.

► left to right.
► right to left
► no specific order is followed
► none of the given options.


When an operator function is defined as member function for a binary Plus (+) operator then the number of argument it take is/are.

► Zero
► One
► Two
► N arguments


With user-defined data type variables (Objects), self assignment can produce __________.

► Syntax error
► Logical error
► Link error
► Non of the given options


Assignment operator is used to initialize a newly declared object from existing object.

► True
► False


When an object of a class is defined inside an other class then,

► Constructor of enclosing class will be called first
► Constructor of inner object will be called first
► Constructor and Destructor will be called simultaneously
► None of the given options


In the member initializer list, the data members are initialized,

► From left to right
► From right to left
► In the order in which they are defined within class
► None of the given options


new operator allocates memory from free store and return _____________.

► A pointer
► A reference
► An integer
► A float


“new” and “delete” keywords are _____________ in C++ language.
► Built-in- Function
► Operators
► Memory Allocation Function
► None of the given options

ttp://vueducation.com/forum/index.php

Care must be taken about the correct ______________ of operator while overloading. (Choose the most appropriate).

  1.  Semantic
  2. Complexity
  3. Both Semantic and Complexity
  4. None of the given options

In functions, that returns reference use ______________.

  1. global or local variables
  2. global or static variables
  3. ordinary variables

In overloading the assignment (=) operator, which object(s) will call the operator function?

  1. Left object of the assignment operator
  2. Right object of the assignment operator
  3. Both objects will call the operator function
  4. No object will call the operator function

Friend functions are _____________.

  1. Unidirectional (not confirm)
  2. bidirectional
  3.  like inline functions
  4. private

We cannot increment ________________.

  1. pointers
  2. arrays
  3. references
  4. Vaiables

ttp://vueducation.com/forum/index.php

A pointer is _____________.

  1. the address of a variable
  2. an indication of the variable to be accessed next.
  3. the data type of an address variable

Overloaded assignment operator must be

  1. Member function of class
  2. Non-member function of class (not confirm)
  3. Friend function of class
  4. Global function

The concept of friend function negates the concept of _________________.

  1. inheritance
  2. polymorphism
  3. persistence
  4. encapsulation

If class A is a friend of class B, and class B is a friend of class C. If class A wants class C to be a friend, __________________

  1. it has to declare, class C as a friend
  2. it has to declare, class B as a friend
  3. it has to declare , class A as a friend
  4. it has to declare, class B and class A as friend classes

The difference between pointers and references is that _________________.

  1. we cannot do arithmetic with pointers
  2. we can do arithmetic with pointers
  3. we cannot reassign pointers
  4. we can assign references

A reference cannot be _____________.

  1. 1
  2. zero
  3. NULL
  4. 4 integer

An address is a ____________________ , while a pointer is a ________________.

  1. constant , variable
  2. variable , constant
  3. global , variable
  4. non static variable , constant

The reference data types are used as __________________ variables without any _______________ operator

  1. ordinary , deference
  2. global , dot
  3. static , deference
  4. local , &

The syntax of declaration of a function that returns the reference to an integer is ___________.

  1. int & myfunc() ;
  2. int myfunc();
  3. int myfunc() &;
  4. integer & myfunc();

References cannot be uninitialized. Because it is impossible to _________________

  1. reinitialize a pointer
  2. reinitialize a reference
  3. initialize a NULL pointercast a pointer

For More Midterm And Grand Quiz Details

Leave a Reply

Your email address will not be published.

Be silent and let your success shout