CS201 - Word Document
CS201 - Word Document
CS201 - Word Document
1
FINALTERM EXAMINATION 2011
CS201- Introduction to Programming
► Zero
► One
► Two
► Three
► data type
► memory referee
► value
► none of the given options.
2
► 3 bytes
► 6 bytes
► 12 bytes
► 24 bytes
► new int(10) ;
► new int[10] ;
► int new(10) ;
► int new[10];
► Data values
► Memory Address
► Both data and values
► None of the given option
► implement
► design
► analysis
► none of the given options
FINALTERM EXAMINATION
CS201 - Introduction to programming
Final Term Spring 2010
► Direct Reference
►Indirect Reference.
3
► Partial Reference
► Proper Reference
► malloc
► calloc
► realloc
► free
► #error
► #define
► #line
► #ndefine
► iostream.h
► fstream.h
► istream.h
► ostream.h
► True
► False
The same pointer that is returned by the new operator, is passed as an argument to the delete
operator. These rules apply to both, if operators (new and delete) are overloaded as member or non-
member operators (as global operators).
► True
► False
► True
► Fals
e
► True
► False
Class templates can have friends. A class or class template, function, or function template can be a
friend to a template class. Friends can also be specializations of a class template or function template,
but not partial specializations.
► 3, 4
► 4, 4
► 3, 3
► 4, 3
► Functions, operators
► Classes, operators
► Operators, functions (Page 342-285)
► Operators, classes
► Non-member functions
► Friend functions (Page 346)
► Any function outside class
► None of the given options
► right
► left
► binary
► unary
► Explicitly
► Implicitly
► Both explicitly and implicitly
► None of the given options
► calloc() function
► Both malloc() and calloc()
► None of the above
► malloc() function
The malloc function differs from calloc in the way that the space allocated by malloc is not initialized
and contains any values initially.
► stac
k
► heap
► stack and heap
► None of the given options
► cin object
► cout object
► Both cin and cout object
► None of the given option
► true
► false
Templates are type-safe. This is because the types that templates act upon are known at compile time,
so the compiler can perform type checking before errors occur.
► True
► False
► True
► False
► Member function
► Non-member function
► Private function
► Public function
► True
► False
► File
► Disk
► Keyboard
► RAM
► int x ; x = 10;
► int x = 10;
► int x, x = 10;
► x = 10;
int func(int) ;
int num = 10 ;
int main(){
int num ;
num = 5 ;
cout << num ;
cout << func(num) ;
}
int func(int x){
return num ;
}
► 5, 5
► 10, 5
► 5, 10
► 10, 10
► True
► False
► float arr{2}{2} ;
► float arr[2][2] ;
10
► float arr[2,2] ;
► float[2][2] arr ;
► True
► False
► left to right.
► right to left
► no specific order is followed
► none of the given options.
► looped
► nested
► overloaded
► none of the given options.
► Constructor
► Destructor
► Both a constructor and a destructor
► None of the given options
► Databases Management
► Networks
► Writing Operating System
► none of the given options
► True
► False
► True
► False
13
Question No: 26 ( Marks: 1 ) - Please choose one
"delete" operator is used to return memory to free store, which is allocated by the "new" operator.
► True
► False
FINALTERM EXAMINATION
Spring 2010
CS201- Introduction to Programming
► Data
► Memory Address
► Data Type
► Values
►*
►+
►@
►#
Within the statement obj1=obj2; obj1 will call the assignment operator function and obj2 will be
passed as an argument to function.
► True
► Fals
e
15
overloading these operators.
► True
► False
► #include “iostream.h”
► include <iostream.h>
► include <iostream.h>
► #include <iostream.h>
► int
► short
► float
► char
► True
► False
int
number=1;
while (true) {
cout << number;
if (number == 3) break;
number += integer_value;
}
17
Question No: 11 ( Marks: 1 ) - Please choose one
Which of the following is used with bit manipulation?
► Signed integer
► Un-signed integer
► Signed double
► Un-signed double
► Only Functions
► Only Variables
► Both Functions and Variables
► None of the given options
► new int(10)
;
► new int[10] ;
► int new(10)
;
► int
new[10];
► One,
zero
► Zero, one
► One,
two
► Two,
one
18
Question No: 16 ( Marks: 1 ) - Please choose one
We can also do conditional compilation with preprocessor directives.
► True
► False
19
Question No: 17 ( Marks: 1 ) - Please choose one
If a symbolic constant has been defined, it will be an error to define it again.
► True
► False
► left to right.
► right to left
► no specific order is followed
► none of the given options.
► looped
► nested
► overloaded
► none of the given options.
► cannot be replaced
► None of the given options
► Remain constant.
► can be changed by some operation
► right
► left
► binary
► unary
http://msdn.microsoft.com/en-us/library/ms173145.aspx
► implement
► design
► analysis
► none of the given options.
► True
► False
FINALTERM EXAMINATION
Spring 2010
CS201- Introduction to Programming
► #error
21
► #define
► #line
► #ndefine
► True
► False
► True
► False
► void (nothing)
► void pointer
► object pointer
► int pointer
► True
► False
► True
► False
► #include “iostream.h”
► include <iostream.h>
► include <iostream.h>
► #include <iostream.h>
► True
► False
► Tru
e
► False
► *ptr = arr ;
► ptr = arr ;
► *ptr = arr[5] ;
► ptr = arr[5] ;
► ptr[3]
► (ptr+3)
► *(ptr+3)
► Both 1and 3
► True
► False
23
Question No: 16 ( Marks: 1 ) - Please choose one
24
If there is a symbol (& sign) used with the variable name followed by data type then it refers to
and if & is being used with variable name
then it refers to .
► True
► False
► function prototype
► function definition
► both function prototype or function definition
► none of the given options.
► looped
► nested
► overloaded
► none of the given options.
► Data encapsulation
► Providing a convenient way of modeling real-world objects
► Simplifying code reuse
► All of the given options
► Constructor
► Destructor
► Both a constructor and a destructor (Lecture 27)
► None of the given options
26
► Compile Time
► Run Time
► Link Time
► None of the given options
► True
► False
► Class, Objects
► Structures, Pointers
► Both Class and structures
► None of above
► True
► False
FINALTERM EXAMINATION
Spring 2010
CS201- Introduction to Programming
27
Question No: 2 ( Marks: 1 ) - Please choose one
Dealing with structures and functions passing by reference is the most economical method
► True
► False
http://mathbits.com/MathBits/CompSci/Structures/Functions
.htm
► True
► False
► void (nothing)
► void pointer
► object pointer
► int pointer
► True
► False
► parentheses ( )
► braces { }
► brackets [ ]
► arrows < >
► float
► int
► void
► double
► Non-member functions
► Friend functions
► Any function outside class
► None of the given options
► Functions
► Operators
► Manipulators
► Objects
► True
► False
► True
► False
Which of the following function call is correct for the function prototype?
defaultParameters ( int a, int b = 7, char z = ‘*’ );
► defaultParameters (5);
► defaultParameters (5, ‘8’);
► defaultParameters (6, ‘#’);
► defaultParameters (0, 0, ‘*’, 0);
► Zero
► One
► Two
► N arguments
► True
► False
30
Question No: 20 ( Marks: 1 ) - Please choose one
The appropriate data type to store the number of rows and colums of the matrix is .
► float
► int
► char
► none of the given options.
► data type
► memory referee
► value
► none of the given options.
► Decremented
► Incremented
► Multiplied
► Both Iecremented and Decremented
A Matrix can be composed of ints, floats or doubles as their elements. Best way is to handle this ,
Fall 2009
CS201- Introduction to Programming
► Arr[0]
► Arr[8]
► Arr[7]
► Arr[-1]
► By data
► By reference
► By value
► By data type
► Memory addresses
► Variables
► Data Type
► Data
► True
► False
32
Question No: 5 ( Marks: 1 ) - Please choose one
When we define an array of objects then,
► True
► False
► True
► False
► int x ; x = 10 ;
► int x = 10 ;
► int x, x = 10;
► x = 10 ;
► int
► double
► float
► char
► Functions, operators
► Classes, operators
► Operators, functions
► Operators, classes
► Member functions
► Public member functions
► Private member functions
► Non-member functions
35
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 (not sure)
► Any of the objects (obj1, obj2) can drive the + operator
► True
► False
► Heap
► System Cache
► None of the given options
► Stack
The programs, in which we allocate static memory, run essentially on stack.
► function prototype
► function definition
► both function prototype or function definition
► none of the given options.
The default value of a parameter is provided inside the function prototype or function definition.
► left to right.
► right to left
► no specific order is followed
► none of the given options.
► Zero
► One
► Two
► N arguments
► Syntax error
► Logical error
► Link error
► Non of the given options
► True
► False
37
► A pointer
► A reference
► An integer
► A float
► Built-in- Function
► Operators
► Memory Allocation Function
► None of the given options
Spring 2010
CS201- Introduction to Programming
► An arithmetic
► Logical
► Relational
► Unary
► isdigit(int c)
► isxdigit(int c )
► tolower(int c)
► All of the above
Question No: 3 ( Marks: 1 ) - Please choose one
Disks are devices having access time of milliseconds.
► Electro-physical, 6
► Electro-Mechanical, 4
► Electro-physical, 5
► Electro-Mechanical, 7
http://www.tns.com/taocs_dp.asp
►*
38
► ++
►@
►#
► iostream.h
► stdlib.h
► stdio.h
► iomanip.h
Question No: 6 ( Marks: 1 ) - Please choose one
setprecision is a parameter less manipulator.
► True
► False
Question No: 7 ( Marks: 1 ) - Please choose one
Which of the following is NOT a preprocessor directive?
► #error
► #define
► #line
► #ndefine
► True
► False
► Member function
► Non-member function
► Private function
► Public function
39
► True
► False
► True
► False
► True
► False
The second parameter to operator << is an object of the class that we are overloading the operator for.
Similar is the case for operator >>
► Zero
► One
► Two
► Three
► True
► False
Question No: 16 ( Marks: 1 ) - Please choose one
We can not make a member function of a class as template function.
► True
► False
Question No: 17 ( Marks: 1 ) - Please choose one
Which character is inserted at the end of string to indicate the end of string?
► new line
► tab
► null
► carriage return
40
► calculation
► reading
► assigning value to variables
► None of the given options.
► fstream,
► ifstream,
► ofstream,
► none of the given options.
► Heap
► System Cache
► None of the given options
► Stack
► void
► void pointer
► pointer to an object
► pointer of type int
► void pointer
► int
► same as object type
► constructors do not return any thing
► True
41
► False
► true
► false
Question No: 26 ( Marks: 1 ) - Please choose one
The functions used for dynamic memory allocation return pointer of type
► int
► float
► void
► double
FINALTERM EXAMINATION
Fall 2008
CS201- Introduction to Programming
► Two Three
► Four
► Five
► Different
► Identical
► Two names of same function
► None of the above
42
► True
► False
► True
► False
► Local
► Global
► Global or static
► None of the given option
► True
► False
43
► Only block of memory is allocated for objects
► Only constructor is called for objects
► Memory is allocated first before calling constructor
► Constructor is called first before allocating memory
Question No: 11 ( Marks: 1 ) - Please choose one
What is the sequence of event(s) when deallocating memory using delete operator?
► True
► False
► True
► False
► Zero
► One
► Two
► Three
► int
► void
► double
► float
►0
► 99
► 100
► 101
44
Question No: 17 ( Marks: 1 ) - Please choose one
The name of an array represents address of first location of array element.
► True
► Fals
e
The name of the array is a constant pointer which contains the memory is the address of first
element of the array
► True
► Fals
e
► Functions, operators
► Classes, operators
► Operators, functions
► Operators, classes
► Non-member functions
► Friend functions
► Any function outside class
► None of the given options
45
► It can be declared anywhere in class as these are not affected by the public and private
keywords.
46
Question No: 23 ( Marks: 1 ) - Please choose one
The operator function overloaded for an Assignment operator (=) must be
► at file scope
► within class definition
► within member function
► within main function
► data type
47
► memory referee
► value
► none of the given options.
► True
► Fals
e
Parameterized manipulators require one or more arguments. setfill (near the bottom of the iomanip.h header file) is an
example of a parameterized manipulator. You can create your own parameterized manipulators and your own simple
manipulators.
► Heap
► Free store
► static storage
► stack
FINALTERM EXAMINATION
fall 2008
CS201- Introduction to Programming (Session - 2)
class A { int x; };
class B { }
public class A { }
object A { int x; };
48
Question No: 4 ( Marks: 1 ) - Please choose one
49
When we use manipulators in our program then which header file should be included?
iostream.h
stdlib.h
stdio.h
iomanip.h
True
False
File
Disk
Keyboard
RAM
True
False
True
False
Question No: 10 ( Marks: 1 ) - Please choose one
The second parameter of operator functions for << and >> are objects of the
class for which we are overloading these operators.
True
False
50
for
while
do while
no looping process checks the test condition at the end
http://mathbits.com/MathBits/CompSci/looping/MCLooping.
htm
True
False
(ii) only
(iii) only
(ii) and (iii)
and (iii)
52
intorDouble VAZ;
int size ;
size = sizeof(VAZ);
}
What will be the value of variable "size", if int occupies 4 bytes and double
occupies 8 bytes?
2
4
8
12
Functions, operators
Classes, operators
Operators, functions
Operators, classes
separate, each
common, all
different, each
different, all
Member functions
Public member functions
Private member functions
Non-member functions
Operators
Functions
Objects
Structures
Member functions
Objects of input/output streams
Parameterized manipulators
Non-parameterized manipulators
Question No: 24 ( Marks: 1 ) - Please choose one
What will be the output of the following
statement? cout << setbase(16) << 52 ;
74
52
34
64
True
False
Syntax error
Logical error
Link error
Non of the given options
54
class for which we overload this operator
reference of ostream class (ostream&)
reference of istream class (istream&)
void
any where
in start
at the end
none of the given options.
55