Almost 300 Solved MCQs of CS201



w1
Almost 300 Solved MCQs of CS201
By
Default constructor takes _________.
one parameter
two parameters
no parameters
character type parameter
All the preprocessors directives start with ________.
$
&
#
_
The members of a class declared with the keyword struct are _____________by default.
static
private
protected
public
Loops are _______________ Structure
Decision
Sequential
Repetition
None of the given options
We cannot use ______________ pointer for storing and reading data fromit.
NULL
integer
double
zero
2
When an object of a class is defined inside another class then,
Destructor of enclosing class will be called first
Destructor of inner object will be called first
Constructor and Destructor will be called simultaneously
None of the given options
Consider the following code segment. Which of the following will be called while
executing code at line 2? String s1 , s2; s1 = s2 ;
Copy constructor
Default constructor
Assignment operator
Parameterized constructor
We cannot increment ________________.
pointers
arrays
references
variables
In statement Matrix m2 = m1 ;
Assignment operator is being used
Copy constructor is being used.
Statement has syntax error
None of the given options
From the following; which on is the correct syntax of an array declaration: array size is 5
and it is of float data type?
float [5] name;
name[5] float;
float name[5];
None of the given options
If an array has 50 elements, what isallowable range of subscripts?
0 – 49
1 – 49
0 – 50
1 – 50
3
A structure is a collection of _____________under a single name.
values
variables
data
None of the given
If a function has not been declaredbefore its definition, It is a
logical error
syntax error
run time error
None of these
When the if statement consists more than onestatement then enclosing these statement in
curly braces is,
Not required
Good programming
Relevant
Must
__________ allow us to have a memory location and use it as int or char interchangeably
structures
union
construct
None of the given
In Analysis, we try to have a______________
Determined the inputs
Break up of problem
Precise problem statement
None of the given
_______________function give the position of the next character to be read from that
file.
tellp()
tellg()
seekg()
seekp()
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
4
Pointers store the ____________________
value of a variable
memory address
characters
None of the given
In order to get the right most digit of a number, we divide this number by 10 and take its
Remainder
Quotient
Divisor
None of the given options
___________ 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 )
If int a = 50; then the value of a/= 3; will be,
15
18
16
17
_______________________ contains functions for manipulations of character data.
ctype.h
iostream.h
string.h
None of the given
____________________ Returns true if c is a digit ora letter and false otherwise.
int isalpha( int c )
int isalnum( int c )
int isxdigit( int c )
int isdigit( int c )
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
5
Ifint sum = 54; Then the value of the following statement is sum = sum - 3 ;
52
50
51
57
To get the value stored at a memory address, we use the________________
referencing operator
dereferencing operator
simple operator
None of the given
In C/C++; by default arguments are passed by _______ to a function.
Reference
Value
Type
Data
The string in the array is terminated by a _______
zero
nil
null
one
Structures are syntacticallydefined with the word_____________.
struc
struct
structure
None of the given
C is widely known as development language of _______ operating system.
Linux
Unix
Windows
Mac OS
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
6
At the___________, we try to break up the problem into functional units
analysis phase
design phase
Implementation phase
None of the given
While developing a program; should wethink about the user interface?
Yes
No
What will be the result of arithmetic expression 5+25/5*5?
45
6
30
9
Why we use"cin"?
To send data to printer
To read data fromkeyboard
To display message
To display output on the screen
_________operator uses the sign ^.
Bit-wise OR
Exclusive OR
AND Operator
NOT operator
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
7
C++ is a_________________ language.
High level
Low level
Machine
Fourth Generation
12 & 8 = (1000) 2 =________. & is usedto AND two numbers bit-wise
4
8
6
12
Fromthe following; which one is used as an assignment operator?
Equal sign ‘=’
Double equal sign ‘==’
Both equal and double equal sign
None of the given options
What will be the value of ‘a’ and ‘b’ after executing the following statements? int a = 9;
int b = a++; cout<<
10,9
9,10
9,9
10,10
These functions seekg() and seekp() requires an argument of type ____________to let
them how many bytes to move forward or backward.
int
short
long
double
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
8
A character is stored in the memory in _________
byte
integer
string
None of the given
dereferencing operator is represented by _______
*
+
None of the given
______________ transfers the executable code frommain memory to hard disk.
Loader
Debugger
Compiler
Linker
When the logical operator OR(||) combine two expressions exp1 and exp2 then the result
will be false only,
When both exp1 and exp2 are true
When both exp1 and exp2 are false
When exp1 is true and exp2 is false
When exp1 is false and exp2 is true
suppose we have int y[10]; To access the 4th element of the array we write_________
y[4];
y[3];
y[2];
none of given
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
9
we have opened a file streammyfile for reading (getting), myfile.tellg () gives us the
current get position of the file pointer. It returns a whole number of type___________
long
int
short
double
ofstreamis used for________
Input file stream
Output file stream
Input and output file stream
All of the given
A structure is a collection of _____________under a single name.
values
variables
data
None of the given
The first character of a variable name must be an alphabet or
Underscore
Digit
Special character
Comma
Suppose int multi[5][10];when we are using **multi , it means,
Single dereferencing
Single referencing
Double referencing
Double dereferencing
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
10
eof( ), bad( ), good( ), clear( ) all are manipulators.
True
False
It is possible to return anobject from a function through thispointer.
True
False
Function implementation of friend function must be defined outside the class.
True
False
The default scope for members of structures is publicwhereas the default visibility for
class members is private.
True
False
The operator function of << and >> operators are always the member function of a class.
True
False
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
11
How many bytes are occupied by declaring following array of characters?
char str[] = “programming”;
10
11
12
13
What does STL stand for?
Source template library
Standard template library
Stream template library
Standard temporary library
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
What will be the output of following code segment?
main(){
int x = 5 ;
{
int x = 4 ;
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
12
cout << x << “,” ;
}
cout << x ;
}
5, 5
4, 4
4, 5
5, 4
Single line comments explaining code would bepreceded like in the following example.
/*
//
/
//*
The ________ statement interrupts the flow of control.
switch
continue
goto
break
smart solution
Best Blog To Help VUStudents
smart solution
Best Blog To Help VUStudents
13