cs201 BEST MID fileMEGA FILE PDF
cs201 BEST MID fileMEGA FILE PDF
com
www.facebook.com/Vuplanet
Follow us on Facebook
CS201 MID Term 2012 & 2011 SOLVED MCQS
MCQS
Syntax of a union is identical to __________ .
structure
Class
Function
Oop
A union is a user-defined data type that contains only _______from its list of members at a
time.
one object
two objects
three objects
four objects
Which of the given file handling modes are similar in their functionality ?
ios::out, ios::trunk
ios::trunc, ios::ate
ios::trunc, ios::nocreate
ios::trunc, ios::ate
Which one of the given option is not a mode for reading/writing the data from a file?
In
Out
Trunk
Get
A 2D array multi[5][10] can be accessed using the array name as **multi , this technique is
called __________.
Single referencing
Single dereferencing
Double referencing
Double dereferencing
www.vuplanet.com
www.vuplanet.com
BASIC
C++
B and BCPL
FORTRAN
The __________ statement forces the immediate next iteration of the loop.
Switch
Goto
Continue
Break
___________ executes all the lines before error and stops at the line which contains the error.
Intrepreter
Compiler
Linker
Debugger
Middle
Post design
First
Last
Which of the following is the correct function call, having array named student of 10
elements as a parameter?
addRecord(student[]);
addRecord(student);
addRecord(student[10]);
addRecord(*student);
www.vuplanet.com
www.vuplanet.com
What is the correct syntax to declare an array of size 10 of int data type?
int [10] name ;
name[10] int ;
int name[10] ;
int name[] ;
Which of the following is the correct syntax to print multiple values or variables in a single
command using cout?
cout << "H" << x << "\n";
cout << "Hello" + x + "\n";
cout << "H", x, "\n";
cout << ("H" & x & "\n");
Arithmatic Expression
Constant Expression
Boolean Expression
Primary Expression
www.vuplanet.com
www.vuplanet.com
If condition
is true
Then Process
if-else structure
else-if structure
switch structure
if structure
MCQS
Stream which sends data to the program is called _________.
Input stream
Output stream
Inline stream
Function stream
When accessing a structure member, the identifier to the left of the dot operator is the
name of ______________.
a structure member
a structure tag
a structure variable
the keyword struct
www.vuplanet.com
www.vuplanet.com
______ translates high level language program into machine language code.
Compiler
Linker
Debugger
Editor
From the option given below, what will be the correct output of the code?
If the return type of a function is void then it means that it will _________.
return any type of data
return some specific type of data
return no data
return just character data
The functions that have already been defined as a part of the language are called
___________.
user-defined functions
programmer-defined functions
inner funtions
built-in functions
www.vuplanet.com
www.vuplanet.com
Given that doubleArray is an array of 7 integers. Which of the below is the correct
statement to access the 5th element of the array?
doubleArray[7]
doubleArray[4]
doubleArray{7}
doubleArray(4)
In ________, the first pointer stores the address of the some other pointer, which contains the
address of any variable.
single dereference
double dereference
single reference
double reference
Bad Programming
Necessary
www.vuplanet.com
www.vuplanet.com
Good Programming
Not a necessary
Which looping process checks the test condition at the end of the loop?
For
While
do-while
no looping process checks the test condition at the end
You can use a _________ statement to transfer control elsewhere out of the nested structure.
Continue
Goto
Pause
Break
Which of the following array is the most suitable for storing a matrix structure?
Single-dime nsional array
Two-dimensional array
Three-dimensional array
Four-dimensional array
A union is a user-defined data type that contains only _______from its list of members at
a time.
one object
two objects
three objects
four objects
In C/C++, ___________ are the doors through which data can enter and come out of a
program.
www.vuplanet.com
www.vuplanet.com
Streams
Fields
Variables
Header files
Which one of the given option is not a mode for reading/writing the data from a file?
In
Out
Trunk
Get
Bits
Bytes
Numbers
Words
In 2D array, the technique used to access the array elements is called ___________
Single referencing
Double referencing
Double dereferencing
Single dereferencing
From the options given below, identify the correct option which is used for calling the
function float square (int &);
Identify the correct option which is used for calling the function float area (int).
area(&num) ;
area(num) ;
area(int num) ;
area(*num) ;
Which kind of error occurs in the code below to access the variable num in the main
function?
www.vuplanet.com
www.vuplanet.com
int main(){
int x ;
x = num ;
}
Syntax error
Logical error
main(){
int a = 10 ;
int b =0;
int *x = &a;
b = (*x)+3 ;
cout << a << ―, ‖ << b ;
}
10,0
10,3
10,13
0,13
When the logical operator AND (&&) combines two expressions exp1 and exp2 then the
result will be true only ____________
When both exp1 and exp2 are true
When both exp1 and exp2 are false
When exp1 is true and exp2 is false
www.vuplanet.com
www.vuplanet.com
For which array, the size of the array should be one more than the number of elements in
an array?
int
double
float
char
To assigned a value to a character type variable, ________ are used around the value.
parenthesis ( )
single qoutes ' '
double qoutes " "
curly braces { }
Rectangle
Circle
www.vuplanet.com
www.vuplanet.com
Diamond
Arrow
What will be the correct syntax for initialization of pointer ptr of type int with variable x?
int ptr = &x ;
int ptr = x ;
MCQS
Syntax of a union is identical to __________ .
structure
Class
Function
Oop
A union is a user-defined data type that contains only _______from its list of members at a
time.
one object
two objects
three objects
four objects
Which of the given file handling modes are similar in their functionality ?
ios::out, ios::trunk
ios::trunc, ios::ate
ios::trunc, ios::nocreate
ios::trunc, ios::ate
Which one of the given option is not a mode for reading/writing the data from a file?
In
Out
Trunk
Get
www.vuplanet.com
www.vuplanet.com
MCQS
Stream which sends data to the program is called _________.
Input stream
Output stream
Inline stream
Function stream
When accessing a structure member, the identifier to the left of the dot operator is the
name of ______________.
a structure member
a structure tag
a structure variable
the keyword struct
______ translates high level language program into machine language code.
Compiler
Linker
Debugger
Editor
www.vuplanet.com
www.vuplanet.com
From the option given below, what will be the correct output of the code?
If the return type of a function is void then it means that it will _________.
return any type of data
return some specific type of data
return no data
return just character data
The functions that have already been defined as a part of the language are called
___________.
user-defined functions
programmer-defined functions
inner funtions
built-in functions
Given that doubleArray is an array of 7 integers. Which of the below is the correct
statement to access the 5th element of the array?
doubleArray[7]
doubleArray[4]
doubleArray{7}
doubleArray(4)
www.vuplanet.com
www.vuplanet.com
Unde rscore
Digit
Special character
Comma
In ________, the first pointer stores the address of the some other pointer, which contains the
address of any variable.
single dereference
double dereference
single reference
double reference
Bad Programming
Necessary
Good Programming
Not a necessary
Which looping process checks the test condition at the end of the loop?
For
While
do-while
no looping process checks the test condition at the end
You can use a _________ statement to transfer control elsewhere out of the nested structure.
Continue
Goto
Pause
Break
MCQS:
An object of _________ class can be created for saving the current position of any opened file
before reading from the file
Filepos
Streampos
Stream
Filestream
www.vuplanet.com
www.vuplanet.com
Integer
Float
Character
Boolean
If a file is not properly closed in a program then what is the status of the program ?
Runtime error will be generated in the program
The program will terminate normally
Compiler will generate syntax error
The Program will crash
Each array declaration must provide the information about all these things except
__________.
www.vuplanet.com
www.vuplanet.com
___________ transfers the executable code from hard disk to main memory.
Linker
Loader
Editor
Interpreter
___________ operator is used to pass the address of a variable to the called function.
*
**
&&
&
Preprocessor program performs its function before ______ phase takes place.
Editing
Linking
Compiling
Loading
Which of the following is the correct function call, having array named student of 10
elements as a parameter?
addRecord(student[]);
addRecord(student);
addRecord(student[10]);
addRecord(*student);
Logical
Arithmetic
www.vuplanet.com
www.vuplanet.com
Relational
Conditional
Which of the following array is the most suitable for storing a matrix structure?
Single-dimensional array
Two-dimensional array
Three-dimensional array
Four-dimensional array
Assignment operators
Logical operator
OK
Unary operator
switch
www.vuplanet.com
www.vuplanet.com
continue
goto
OK
break
Underscore
OK
Special character
Digit
mango
OK
mango
any fruit
www.vuplanet.com
www.vuplanet.com
apple
Add 1 in X value
OK
Add 2 in X value
None of these
Comments
OK
Debugger
Compiler
www.vuplanet.com
www.vuplanet.com
Linker
Loader
Debugger
Compiler
OK
Linker
data
variable
data type
OK
www.vuplanet.com
www.vuplanet.com
Queue
Heap
Cache
Stack
Ok
13
11
12
Ok
www.vuplanet.com
www.vuplanet.com
10
iostream.h
conio.h
ctype.h
OK
stdlib.h
Break up of problem
Ok
www.vuplanet.com
www.vuplanet.com
value of a variable
memory address
Ok
characters
www.vuplanet.com
www.vuplanet.com
Ok
Start
End
Ok
Middle
Name
Value
memory address
Ok
www.vuplanet.com
www.vuplanet.com
Variable
Ok
www.vuplanet.com
www.vuplanet.com
0 – 49
OK
1 – 49
0 – 50
1 – 50
values
variables
ok
data
www.vuplanet.com
www.vuplanet.com
ok
000
OK
010
111
110
www.vuplanet.com
www.vuplanet.com
Ok
rows
OK
value
column
www.vuplanet.com
www.vuplanet.com
Logical operator
Dereference operator
Dot operator
OK
Address operator
A only
C only
A and B
OK
A and D
www.vuplanet.com
www.vuplanet.com
in
OK
out
app
ate
pointer to pointer
pointer to char
OK
www.vuplanet.com
www.vuplanet.com
arr[10] = {0.0};
Ok
Value
variable
data type
ok
www.vuplanet.com
www.vuplanet.com
tellp()
tellg()
OK
seekg()
seekp()
forward direction
backward direction
Ok
both direction
www.vuplanet.com
www.vuplanet.com
Stream
Filepos
Streampos
Filestream
struc
struct
structure
www.vuplanet.com
www.vuplanet.com
structures
union
OK
construct
Stream classes
Simple classes
Binary classes
IO classes
www.vuplanet.com
www.vuplanet.com
__________________function is used to determine the next position to write a character while writing into a file.
tellg()
seekg()
seekp()
tellp()
Ok
► Sequential File
► Data File
► Record File
www.vuplanet.com
www.vuplanet.com
► #error
► #define
► #line
► #ndefine
► True
► False
www.vuplanet.com
www.vuplanet.com
► True
► False
► void (nothing)
► void pointer
► object pointer
► int pointer
www.vuplanet.com
www.vuplanet.com
The second parameter of operator functions for << and >> are objects of the class for
which we are overloading these operators.
► True
► False
► True
► False
Question No: 10 ( Marks: 1 ) - Please choose one
To include code from the library in the program, such as iostream, a directive would be
called up using this command.
► #include ―iostream.h‖
► include <iostream.h>
► include <iostream.h>
► #include <iostream.h>
► True
► False
► True
► False
What will be the correct syntax to assign an array named arr of 5 elements to a pointer
ptr?
www.vuplanet.com
www.vuplanet.com
► *ptr = arr ;
► ptr = arr ;
► *ptr = arr[5] ;
► ptr = arr[5] ;
What will be the correct syntax to access the value of fourth element of an array using
pointer ptr?
► ptr[3]
► (ptr+3)
► *(ptr+3)
► Both 1and 3
► True
► False
www.vuplanet.com
www.vuplanet.com
► True
► False
► function prototype
► function definition
► looped
► nested
► overloaded
www.vuplanet.com
www.vuplanet.com
► Data encapsulation
► Constructor
► Destructor
► Compile Time
► Run Time
www.vuplanet.com
www.vuplanet.com
► Link Time
► True
► False
► Class, Objects
► Structures, Pointers
► None of above
www.vuplanet.com
www.vuplanet.com
► True
► False
C language is developed by
► Bill Gates
► Robert Lafore
► Dennis Ritchie
www.vuplanet.com
www.vuplanet.com
►0
► -32
► 65531
► -4.0
► Circle
► Arrow
► Diamond
Then draw a line to its right
and use the decision symbol i.e. diamond diagram. Pag no 51
Question No: 4 ( Marks: 1 ) - Please choose one
www.vuplanet.com
www.vuplanet.com
► Must
► Optional
► syntax error
► Necessary
The default statement is optional. If
there is no case which matches the value of the switch statement, then the statements
of default are executed pag no 68
http://vustudents.ning.com
*.doc is _____________ by type.
.
► Sequential File
► Data File
► Record File
Member function tellg() returns the current location of the _____________ pointer.
► tellptr()
► write()
► seekg()
www.vuplanet.com
www.vuplanet.com
► get()
s
Dealing with structures and functions passing by reference is the most economical
method
http://vustudents.ning.com
► True
► False
► Null character
► String
► Zero
► Full stop
http://www.vuzs.net/index.php?option=com_content&view=article&id=306:cs201-
spring2009-4-solved-by-vuzs-team-with-reference&catid
► Operating system
www.vuplanet.com
www.vuplanet.com
► Application software
► Device driver
► Utility software
► area
► _area
► 10area
► area2
► for
► while
► do-while
► True
www.vuplanet.com
www.vuplanet.com
► False
► * operator
► -> operator
► && operator
► & operator
► True
► False
Compiler is a
► System software
► Application Software
► Driver
► Editor
www.vuplanet.com
www.vuplanet.com
For one byte there are _____ combinations of values that can be stored in computer.
► 26
► 27
► 28
► 24
http://vuzs.net/index.php?option=com_content&view=article&id=431:cs201- mid- for-
vuzs&catid=315&Itemid=54
In C/C++ language the header file which is used to perform useful task and manipulation
of character data is
► cplext.h
► ctype.h
► stdio.h
www.vuplanet.com
www.vuplanet.com
► delay.h
The function toupper and islowe r are part of the characte r handling
library<ctpe.h>
► Must
► Optional
► syntax error
► Necessary
► 33
► 45
►9
www.vuplanet.com
www.vuplanet.com
► 30
What is the correct syntax to declare an array of size 10 of int data type?
► name[10] int ;
► int name[10] ;
► int name[] ;
► n dimensions
► 2n dimensions
► (n+1) dimensions
What will be the correct syntax to access the value of fourth element of an array using
pointer ptr?
www.vuplanet.com
www.vuplanet.com
► ptr[3]
► (ptr+3)
► *(ptr+3)
► Both 1and 3
Which of the following values C++ use to represent true and false?
http://vustudents.ning.com
► 1 and 0
► 1 and -1
► 11 and 00
► True
► False
For which array, the size of the array should be one more than the number of elements in
an array?
► int
www.vuplanet.com
www.vuplanet.com
► double
► float
► char
If a variable is passed by value to a function and the function makes some changes to that
variable then it
► Header file
► Preprocessor Directive
► Statement
► Function
http://vustudents.ning.com
www.vuplanet.com
www.vuplanet.com
► Decision
► Repetition
► Sequential
► Hierarchical
www.vuplanet.com