CS201
GRAND QUIZ FILE (NEW)
ALMOST 800 + MCQS
BY NIMRA KHAN
1. ------ is used for input file or for reading from the file.
Tellg()
2. Following is the declaration a ------- array. Int arr[2][2][2]
3-demensional
3. ! ( x < 3 ) means in c++ that
X is greater than 3
4. Which of the following option is correct to compare the
declaration of the function?
---------- (parameter1, parameter2)
{
// code to be executed
}
Void functionNAME
5. Ofstream is ued for --------
Output file stream
6. By default, the starting index of an arrar in c++ is ____
0
7. How we declare an array of integer data whose size is 20 with
array name “count”.
Int count [20];
8. Which of the following is a reserve word for data types in c/c++?
Int
9. C was developed with the help of ----------- language
BCPL and B
10. An object of ----- class can be created for saving the
current position of any opened file before reading from the file.
Streampos
11. C ++ is a ----- language.
High level
12. In while loop, the loop counter is initialized at -----
Before entering the loop
13. What is the output of thw following code if the 3rd case is
true
Switch (var)
{Case ‘a’;
Cout<<”apple”<<endl;
Mango
14. ----------- character is used to indicate the end of the
string.
Null
15. Which of the following is used to perform bit-wise
exclusive OR operation?
|
16. If x = 11, and x % = 3, then value of x will be----
2
17. A variable of character data type occupies ---- bytes in
memory.
1
18. Null character is represented by ---- in c ++?
\0
19. In computer system there are mainly ---- type of
softwares.
2
20. There is pointer variable named ptr of type float. Which
type of variable address can be store by ptr?
Float
21. A character is stored in the memory in -----
Byte
22. X is an integer variable; what does x++ means,
Add 1 in x value
23. When we call a function, its control--------
Transfers to its definition
24. ‘\0’ takes ---- space in the memory.
1 byte
25. -------- will be used for enclosing function statements into
a block?
{}
26. How can we declare an array of characters whose size is
12 with array name “country”?
Char country[12];
27. Following is the declaration of a 2d array, how many
columns are declared for this array.
Int arr[3][2];
2
28. If we assign 2.06721 to an integer variable x, what will be
the output if we print x using cout<< statement?
2
29. We can access a global variable ----
From anywhere in the program
30. We use ---- to include all those functions which are
located in different files.
Linker
31. A character is stored in the memory in ----
Byte
32. Which is not true regarding structure?
We can declare array of structure
33. Mr. ahmad sleeps thirty hours every day. This sentence
is ----
Grammatically correct but illogical
34. ----- will explain the function of a program.
Comments
35. Char **argv can be read as ----
Pointer to pointer to char
36. What will be output of the following code?
String name [4] = {“ali”, “bilal”,“omer”, Ayesha”};
Cout<< name [0];
Ali
37. The data type before a function name represents its,
Return type
37. The expression ((a+b) = = 10) || ((x+y) = = 20) is true only if?
Either ((a+b) = =) OR ((x + y) = =20) is true
38. = operator is used for ----
Assigning values to varaibles
39. What is the use of ios::trunc mode?
To truncate an existing file to zero
40. X is an integer variable; what does x ++ means,
Add 1 in x value
41. Structures use ---- allocation.
Heap
42. What will be the size of the following character array?
Char name[] = “adeel”;
6
43. A ---- is an array of characters that can store number of
character specified.
String
44. ----- statement is used to terminate the processing of a
particular case and exit from switch structure.
Break
45. If y = 20 and z = y ++, then the valye of z will be------
2146. If
Int a = 17;
int b = 3;
double c = a/b;
what will be value of variable c?
5
47. What will be the output of the following code?
String grade [3] = {“a’, “b”, “c”};
Grade[2] = “f”;
Cout<< grade[2];
F
48. Declaration of two-dimensional array of integers having 3
rows and 5 columns is following?
Int arr [3][5];
49. A = a + 1; can be written as ----
A+ = 1;
50. A record is a group of related
Fields
51. What will be the result of arithmetic expression
6+48/4*3?
42
52. ---------- construct is used to execute a set of instructions
when a condition is true and other set when it is false?
If\else
53. If an array has 50 elements, what is allowable range of
subscripts?
0 – 49
54. If int a = 50; then the value of a/= 3; will be?
16
55. Which of the following option is/are correct about array?
Only one type of elements can store in an array
56. Whenever some number is added in an array name, it will
jump as many --- as the added number?
Rows
57. --------- returns true if c is a digit or a letter and false otherwise.
Int isalnum(int c)
58. which of the following is the default mode of the opening using of
ofstream class?
Ios::trunc
59. In which language the compiler of c language is written?
C
60. While loop executes at least?
One time
61. String are accessed by variable of type----
Char
62. Which of the following is the correct operator to compare the values of
two variables?
==
63. Not operator is a -----
Single input operator
64. Pointer points to a particular-----
Memory address
65. A function is a block of statements that can be defined once and used-
---in the program.
As many times as user wants
66. -------- function is used to find the number of characters in a string?
Strlen()
67. ! = operator is used to check whether the operand on the left-hand side
is------to the operand on the right-hand-side.
Not equal
68. A while loop may execute ----- or more times.
0
69. How we declare an array of integer data whose size is 20 with array
name “count”.
Int count[20];
70. A variable declared within a code block becomes ---- variable for that
block.
Local
71. If a file is opened with ios::out mode, then -------
We can write in this file
72. A function’s prototype is written --- the function call.
Before
73. ---- Loop is mostly used to perform repetition of a tasks for a known
number of times.
For
74. In shifting operations if zero is inserted at the lest most bit, the
negative number will become a ---- number.
Positive
75. It is the job of ---- to transfer the executable code from hard disk to
main memory.
Loader
76. RAID stands for------
Redundant array of inexpensive devices
77. Array indexes start from ----
0
78. In call by reference, ----- of a variable is passed to the called function.
Address
79. How many times the following do-while loop will execute?
Int k = 10;
Do
{
Cout << “statements” << endle; ?
6
80. The name of a location in memory is called ----
Variable
81. ----- function is used to find the number of character in a string.
Strlen()
82. Which statement is used to close a file?
Myfile.close();
83. ------- allow us to have a memory location and use it as int or char
interchangeably.
None of the given
84. While handling files, one can have ---- options
All of the given
85. ------- function is used to determine the next position to write a
character while writing into a file.
Tellp()
86. Which is the correct syntax to define a structure named ‘student’?
Struct student{
//varaibles
};
87. < and > both are ---- operators.
Logical
Identify the logical error in the following if condition
88. If ((i<5) & & (i>15)) ?
Condition is always false
89. Not operator is a ----
Single input operator
90. The use of *sign in first and second statements is called --- and ----
of pointer.
Int *ptr = &x;
Cout<<*ptr; ?
Referencing, dereferencing
91. C is widely known as development language of ---- operating system.
Linux
92. If x is declare as an integer, what will be result of the given
expression?
X = 2 + 3 * 5 % 2 + 3 / 2 ??
4
93. What will be the correct syntax of declaration of the following
statements?
“ptr is a pointer to const int” ??
Const int *ptr
94. After evaluating the expression
95. X = 10 +3 * 4 / 2 – 1, the value of x will be?
15
96. We can read, write and manipulate the same file using ----
Fstream.h
97. Return type of a function that does not return any value must be ----
Void
98. Pointers store the ----
Memory address
99. ----- operator uses the sign ^.
Exclusive OR
100. To get the value stored at a memory address, we use the ----
Dereferencing operator
101. Telling a computer what to do is called ----
Programming
102. Compiler translates high level language program into ---- language
code.
Machine
103. Each array declaration must provide the information about all these
things except----
The location of the first element to be stored
104. Eof is used to check for the --- of file when a file is being resd.
End
105. The result of 4%3 will be?
1
106. When the logical operator AND (&&) combine two expression exp1 and
exp2 then the result will be true only?
When both exp1 and exp2 are true
107. ‘multi[3][3]’ element can also be accessed by ------
*(*(multi + 3) + 3)
108. What is output of following code?
Int data [10] = {10,20,30,40,50,60,70,80,90,100};
Int *xptr =&data [4];
Int *xptr =&data [6];
Cout<<xptr + yptr ++; ??
120
109. Which of the following is not the subcategory of the system software?
None of the above
110. We get 12 | 8 = ------ where “|” is (bit-wise OR) ?
12
111. ------ is a substitute of multiple if statement.
If..elseif statement
112. Find out the logical error in following lines of code.
If (x = 10)
Cout << “x is 10”; ?
Assignment operator should not be used for comparison
113. Which is not true regarding structure?
c) we can’t declare pointers to structure
114. -------- are used to compiler the code.
Compiler
115. #include <iostream>
#include <cstring>
Using namespace std;
Int main ()
{
Char str1[10] = “hello”;
Char str2[10] = “world”; ?
10
116. A --- structure specifies that an action is to be repeated while some
condition remains true.
Repetition
117. In which language the compiler of c language is written?
C
118. Characters string are terminated by -----
\0
119. A function is a block of statements that can be defined once and used -
-- in the program.
As many times as user wants
120. -------- is used for output during the process of writing to the file.
Seekp()
In case of two-dimnstional array, if you add some number in a two-
dimensional name, it will jump to the next----
Row
121. In while loop the condition is checked ---- the execution of loop.
Before
122. Array indexes start from ----
0
123. Pointers store the ----
Memory address
124. Which step is not not performed during a proper program design?
Write details about the performance of program
125, We can say that a pointer is a variable that holds the --- address.
Memory
126. When accessing a structure memory, the identifier to the left of the
dot operator is the name of ----
Structure variable
127. From the following; which one is the range of random number
generator rand() ?
O – 32767
128. To read command-line arguments, the main () function itself must be
given ---- arguments.
2
129. Which operator has the highest precedence?
(*, -, /, +) ?
* and / both hane the same highest precedence
130. Suppose we have int y[10];
To access the 4th element of the array we write----
Y[3];
131. What will be the value of the variable output in the given piece of code?
Double output = 0;
Output = (2 +2) * 4 + / (4 – 2);
17
132. What is the output of the following statement?
int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10);
error
133. Searching is easier when an array is already sorted
True
134. If an array has 100 elements, what is allowable range of
subscripts?
0 - 99
While developing a program; should we think about the user interface?
//handouts main
Yes
A character is stored in the memory in _________
String
These functions seekg() and seekp() requires an argument of type
____________to let them how many bytes to move forward or backward.
Int
dereferencing operator is represented by _______
*
______________ transfers the executable code from main memory to hard
disk.
Loader
When the logical operator OR (||) combine two expressions exp1 and exp2
then the result will be false only, //bitwise “or” applies here….
When both exp1 and exp2 are false
suppose we have int y[10]; To access the 4th element of the array we
write_________
none of given
we have opened a file stream myfile for reading (getting), myfile.tellg ()
gives us the current get position of the file pointer. It returns a whole
number of type___________
int
ofstream is used for________
Output file stream
A structure is a collection of _____________under a single name.
Variables
In C/C++ the string constant is enclosed ……………. corrected r red one
In curly braces
The size of int data type is
4 bytes
In Flow chart process is represented by
Rectangle
If the break statement is missed in switch statement then,// a break
statement with no label always completes abruptly, the reason being a
break with no label. If no switch, while, do, or for statement in the
immediately enclosing method, constructor or initializer encloses the
break statement, a compile-time error occurs?
This may cause a logical error
When we are using const keyword with a variable x then initializing it at
the time of declaration is, ?
Optional
Which of the following is the correct way to assign an integer value 5 to
element of a matrix say ‘m’ at second row and third column?
m[2][3] = 5 ;
How many total elements must be in two-dimensional array of 3 rows and
2 columns?
6
Which of the following is the correct statement for the following
declaration?
*ptr is a pointer to const int
What will be the correct syntax to assign an array named arr of 5
elements to a pointer
ptr?
*ptr = arr[5] ;
C is a/an ______ language
object oriented
The variables having a name, type and size are just like empty boxes.
True
What's wrong with this for loop?
for (int k = 2, k <=12, k++)
the commas should be semicolons
Most efficient method of dealing with structure variables is to define the
structure globally
True
There are mainly -------------------- types of software.//
Two
When a pointer is incremented, it actually jumps the number of memory
addresses ?
According to data type
setw is a parameterized manipulator.
True
if (a>b && a>c) then the condition will be true only if
Both a>b and a>c are true
In while loop the loop counter must be initialized,
Before entering the loop
__________ of a variable means the locations within a program from where
it can be accessed.
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.
As many times as user wants
_________statement is used to terminate the processing of a particular
case and exit from switch structure.
break
The most suitable data type for number 325.25 is ______.
float
X is an integer variable; what does X++ means,
Add 1 in X value
The operators ++ and –- are used to increment or decrement the value of
a variable by ________
1
Which of the following loops checks the test condition at the end of the
loop?
Do-While
The operator to free the allocated memory using new operator is
________________.
delete
suppose we have int y[10]; To access the 4th element of the array we
write_______
y[3];
From the following; which one is the range of Random number generator
function rand()?
0 – 32767
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?
double arr[10] = {0.0};
The string in the array is terminated by a_____
null
In C/C++; by default arguments are passed by_____to a function.
Value
char name [] = “Hello World” ; In the above statement, a memory
of_______characters will be allocated
12
_______Keyword is used to return some value from a function.
return
Which of the function call is call by value for the following function
prototype? float add(int);
add(x);
The increment of a pointer depends on its_________.
data type
The ASCHI code of null character is_________
000
Pointers are a special type of __________in which a memory address is
stored
variables
Transpose of a matrix means that when we interchange rows and
columns_____________
the first row becomes the first column
Pointers store the ____________________
value of a variable
Which of the following function call is “call by reference” for the following
function prototype? int add (int *);
add(&x);
The name of the array is a constant pointer which contains the memory
address of the ____________of the array.
first element
array name always contains the memory address of the ___________of the
array
first element
At the___________, we try to break up the problem into functional units
design phase
Syntax of a union is identical to __________ .
structure
A union is a user-defined data type that contains only _______from its list
of members at a
time.
one object
Which of the given file handling modes are similar in their functionality ?
ios::trunc, ios::ate
Which one of the given option is not a mode for reading/writing the data
from a file?
Trunk
In C/C++, the header file used for string manipulation is __________.
string.h
A 2D array multi[5][10] can be accessed using the array name as **multi ,
this technique is
called __________.
Double dereferencing
C language was evolved from _____ language(s).
B and BCPL
The __________ statement forces the immediate next iteration of the loop.
Continue
_________ are very good tools for code reuse.
Functions
When an argument is passed by reference, ___________
the function accesses the argument’s original value in the calling program.
___________ executes all the lines before error and stops at the line which
contains the error.
Intrepreter
Analysis is the -------------- step in designing a program.
First
Which of the following is the correct function call, having array named
student of 10
elements as a parameter?
addRecord(student);
When an array element is passed to a function, it is passed by
________________.
Reference
What is the correct syntax to declare an array of size 10 of int data type?
int name[10] ;
If we want to copy an array, both arrays need to be of same___________.
Data type and size
Which of the following is the correct syntax to print multiple values or
variables in a single command using cout?
cout << "H" << x << "\n";
Which one of the statements given below is equivalent to x %= 5?
x=x%5
The condition in loop should be a(n) ___________.
Boolean Expression
Which structure is represented by following flow chart ?
if structure
Stream which sends data to the program is called _________.
Input stream
Syntax of a union is identical to __________ .
Structure
When accessing a structure member, the identifier to the left of the dot
operator is the
name of ______________.
a structure variable
The parameter passed to isdigit() function is ____________.
a character variable
TWAIN stands for _________ .
Technology Without An Interesting Name
______ translates high level language program into machine language
code.
Compiler
From the option given below, what will be the correct output of the code?
for (int a = 1; a <= 3; a++)
cout<<a*3-1<<" ";
258
If the return type of a function is void then it means that it will _________.
return any type of data
return no data
The functions that have already been defined as a part of the language are
called
___________.
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[4]
The symbol which is used to represent a process in a flow chart is
__________.
Rectangle
When an array is passed to a function, by default it will be passed
by_____________.
Reference
What is the range of Random number generator function rand()?
0 – 32767
The first character of a variable name must be an alphabet or
________________.
Underscore
In ________, the first pointer stores the address of the some other pointer,
which contains the address of any variable.
single dereference
Initialization of variable at the time of definition is --------------practice.
Good Programming
Which looping process checks the test condition at the end of the loop?
do-while
You can use a _________ statement to transfer control elsewhere out of the
nested structure.
Goto
Which of the following array is the most suitable for storing a matrix
structure?
Single-dimensional array
The microsoft word document(.doc) is a kind of __________ .
Random Access File
A union is a user-defined data type that contains only _______from its list
of members at a time.
one object
In C/C++, ___________ are the doors through which data can enter and come
out of a program.
Streams
Which one of the given option is not a mode for reading/writing the data
from a file?
Trunk
C++ views each file as a sequential stream of ___________.
Bytes
In 2D array, the technique used to access the array elements is called
___________
Double dereferencing
From the options given below, identify the correct option which is used for
calling the function float square (int &);
square (num);
Identify the correct option which is used for calling the function float area
(int).
area(num) ;
Which kind of error occurs in the code below to access the variable num
in the main
function?
int num =10;
int main(){
int x ;
x = num ;
}
No error
A program statement that invokes a function is called _________.
function call
What will be the output of the following code segment?
main(){
int a = 10 ;
int b =0;
int *x = &a;
b = (*x)+3 ;
cout << a << ―, ‖ << b ;
}
10,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
For which array, the size of the array should be one more than the number
of elements in an array?
char
What is the range of Random number generator function rand()?
0 – 32767
To assigned a value to a character type variable, ________ are used around
the value.
single qoutes ' '
In C/C++, the #include is called______________.
Preprocessor Directive
The number 544.53 must be stored in _____ data type.
Float
Use of the _________ statement violates the rules of structured
programming.
Goto
In Flow Chart, flow of control is represented by ____________.
Arrow
What will be the correct syntax for initialization of pointer ptr of type int
with variable x?
int *ptr = &x ;
Syntax of a union is identical to __________ .
structure
A union is a user-defined data type that contains only _______from its list
of members at a time.
one object
Which of the given file handling modes are similar in their functionality ?
ios::trunc, ios::ate
Which one of the given option is not a mode for reading/writing the data
from a file?
Trunk
Stream which sends data to the program is called _________.
Input stream
Syntax of a union is identical to __________ .
Structure
When accessing a structure member, the identifier to the left of the dot
operator is the name of ______________.
a structure variable
The parameter passed to isdigit() function is ____________.
a character variable
TWAIN stands for _________ .
Technology Without An Interesting Name
______ translates high level language program into machine language
code.
Compiler
From the option given below, what will be the correct output of the code?
for (int a = 1; a <= 3; a++)
cout<<a*3-1<<" ";
258
If the return type of a function is void then it means that it will _________.
return no data
The functions that have already been defined as a part of the language are
called
___________.
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[4]
The symbol which is used to represent a process in a flow chart is
__________.
Rectangle
When an array is passed to a function, by default it will be passed
by_____________.
Reference
The first character of a variable name must be an alphabet or
________________.
Underscore
In ________, the first pointer stores the address of the some other pointer,
which contains the address of any variable.
single dereference
Initialization of variable at the time of definition is --------------practice.
Good Programming
Which looping process checks the test condition at the end of the loop?
do-while
You can use a _________ statement to transfer control elsewhere out of the
nested structure.
Goto
An object of _________ class can be created for saving the current position
of any opened file
before reading from the file
Stream
The value returned by the eof() function is of __________ type.
Character
If a file is not properly closed in a program then what is the status of the
program ?
The program will terminate normally
The parameter passed to isdigit() function is ____________.
a character variable
In C/C++, the header file used for string manipulation is __________.
string.h
Arrays are best data structures _________.
for relatively permanent collections of data
Each array declaration must provide the information about all these things
except
__________.
Number of elements of the array
The First step for developing a program is ____________.
Linking
Analysis
___________ transfers the executable code from hard disk to main memory.
Loader
___________ operator is used to pass the address of a variable to the called
function.
&
In call by reference, __________ of a variable is passed to the called
function.
Address
___________ of a function is also known as signature of a function.
Declaration
Preprocessor program performs its function before ______ phase takes
place.
Compiling
Which of the following is the correct function call, having array named
student of 10 elements as a parameter?
addRecord(student[10]);
The remainder (%) operator is a __________operator.
Arithmetic
Which of the following array is the most suitable for storing a matrix
structure?
Two-dimensional array
*.doc is _____________ by type.
► Random Access File
Which of the following is NOT a preprocessor directive?
► #define
The return type of operator function must always be void.
► False
Question No: 4 ( Marks: 1 ) - Please choose one
What does (*this) represents?
► A value of the data member
The statement cin.get (); is used to,
► Read a character from keyboard
When we do dynamic memory allocation in the constructor of a class, then
it is necessary to provide a destructor.
► True
Overloaded new operator function takes parameter of type size_t and
returns
► void pointer
The second parameter of operator functions for << and >> are objects of
the class for which we are overloading these operators.
► True
C++ is a case-sensitive language
► True
To include code from the library in the program, such as iostream, a
directive would be called up using this command.
► #include <iostream.h>
A template function must have only generic data types.
► True
Template class can not have static variables.
► False
What will be the correct syntax to assign an array named arr of 5
elements to a pointer
ptr?
► *ptr = arr[5] ;
What will be the correct syntax to access the value of fourth element of an
array using pointer ptr?
► Both 1and 3
If most significant bit of un-signed number is 1 then it represents a
positive number.
► True
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
_____.
► Reference variable, address of variable
We can also do conditional compilation with preprocessor directives.
► True
The default value of a parameter can be provided inside the
________________
► function definition
Classes defined inside other classes are called ________ classe
► nested
What purpose do classes serve?
► All of the given options
Every class contains _______________.
► Constructor
new operator is used to allocate memory from the free store during
► None of the given options
When an object of a class is defined inside another class then,
► Destructor of inner object will be called first
It is possible to define a class within another class.
► True
New and Delete are also used with ___________ and data types as well.
► Class, Objects
With New keyword, data types and class members are initialized with
meaningful values instead of garbage.
► True
C language is developed by
► Dennis Ritchie
Which of the following choice is not an example of an int data type?
► -4.0
In flow chart, the symbol used for decision making is,
► Diamond
Switch statement deals with,
► Integer and character data
Default case in switch statement is,
► Optional
*.doc is _____________ by type.
► Sequential File
Member function tellg() returns the current location of the _____________
pointer.
► tellptr()
Dealing with structures and functions passing by reference is the most
economical method
► True
In C/C++ all character strings are terminated with,
► Null character
Word processor is http://vustudents.ning.com
► Application software
Which of the following can not be a variable name?
10area
Which looping process is best, when the number of iterations is known?
► while
By default an array of characters is passed by value to a function
► False
Which of the following operator is used to access the address of a
variable?
► & operator
The name of an array represents address of first location of array
element.
► False
Compiler is a
► Application Software
If Num is an integer variable then Num++ means,
► Add 1 with Num
For one byte there are _____ combinations of values that can be stored in
computer.
► 2^8
In C/C++ language the header file which is used to perform useful task and
manipulation of character data is
► ctype.h
Default case in switch statement is,
► Optional
When break statement is encountered in switch statement, it
► Exits from switch statement
What will be the result of arithmetic expression 6+27/3*3?
► 33
What is the correct syntax to declare an array of size 10 of int data type?
► int name[10] ;
How many dimensions does n-dimensional array has?
► n dimensions
What will be the correct syntax to access the value of fourth element of an
array using pointer ptr?
► ptr[3]
Which of the following values C++ use to represent true and false?
► 1 and 0
Declaring structures does not mean that memory is allocated.
► True
For which array, the size of the array should be one more than the number
of elements in an array?
► char
If a variable is passed by value to a function and the function makes some
changes to that variable then it
► does not affect the original variable
In C/C++ the #include is called,
► Preprocessor Directive
Loops are ------------------------ Structure.
► Repetition
the sizeof operator is used to determine the size of _____________.
data type
Structures use ________ allocation.
Stack
Which header file must be included to use the functions tolower() and
toupper()?
ctype.h
In Analysis, we try to have a______________
Precise problem statement
Pointers store the ____________________
memory address
___________ Returns true if c is a digit and false otherwise.
int isdigit( int c )
eof is used to check for the _________ of file when a file is being read.
End
The statement cout << yptr will show the __________the yptr points to.
memory address
Which of the following is true about streams?
A& B
While handling files, one can have _____________ options
All of the given
If an array has 50 elements, what is allowable range of subscripts?
0 – 49
A structure is a collection of _____________under a single name.
variables
Ifstream is used for________
Input file stream
The ASCHI code of null character is___________
000
dereferencing operator is represented by _______
*
Whenever some number is added in an array name, it will jump as many
_____________as the added number.
rows
To access the data members of structure, _______ is used.
Dot operator
Which of the following is true about streams? A. It is a sequence of bytes
B. It is an ordered sequence C. All bytes can
go through the stream simultaneously D. Bytes that enters first into the
stream will go out at last
A and B
We use _________ to open a file or stream for extraction
in
char **argv can be read as__________________.
pointer to pointer to char
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?
double arr[10] = {0.0};
Pointers work by pointing to a particular___________
data type
_______________function give the position of the next character to be read
from that file.
tellg()
aFile. seekg (-10L, ios:cur)
backward direction
An object of _________ class can be created for saving the current position
of any opened file before reading from the file.
Stream
Structures are syntactically defined with the word_____________.
struct
__________ allow us to have a memory location and use it as int or char
interchangeably
union
Question # 9 of 10 ( Start time: 12:25:41 PM ) Total Marks: 1
A hierarchy of classes which are used to deal with console and disk files
are called __________.
IO classes
__________________function is used to determine the next position to write a
character while writing into a file.
tellp()
For binary member operators, operands on the ________ drives (calls) the
operation.
Left
We cannot increment ________.
references
We can ________ pointer.
all of the given
We can ________ references.
None of the given
What will be the correct syntax for the following function call?
add(x);
An instance of a class is called ________.
object
The ________ is called automatically when an object destroys
destructor
The destructor is used to ________.
deallocate memory
________ data isn't accessible by non-member functions or outside classes.
private
Member functions of the class ________ main program.
are accessible from
Overloading means :
Using the same name to perform multiple tasks or different tasks
depending on the situation.
The main advantage of function overloading is ________.
The program becomes more readable
You cannot overload the ________ operator.
?:
In C++, a variable can be declared anywhere in the program this will
increase ________.
efficiency
Memory allocated from heap or free store ________.
cannot be returned back unless freed explicitly using free and delete
operators
We cannot use ________ pointer for storing and reading data from it.
'NULL
The dynamic memory allocation uses ________ whereas static memory
allocation uses ________.
heap , stack
What will be the output of the given code?
#include #define MAX( A, B ) ((A) > (B) ? (A) : (B))
void main() {
int i, x, y;
x = 23;
y = 45;
i = MAX( x++, y++ );
// Side-effect: // larger value incremented twice
cout << "x = " << x << " y = " << y << '\n';
}
x=24 y=47
NULL has been defined in ________ header file.
Stdlib.h
Symbolic constant PI can be defined as:
#define PI 3.14
The friend function of a class can have access ________.
to the private data members
C++ was developed by ________.
Bejarne Stroustrup
Once the ________ are created, they exist for the life time of the program.
static variables
Encapsulation means ________.
that the data of a class can be accessed from outside
An address is a ________, while a pointer is a ________.
constant, variable
The syntax of declaration of a function that returns the reference to an
integer is ________.
int & myfunc();
Which one of the following is mandatory preprocessor directive for c++?
#include
The members of a class declared with the keyword struct are ________ by
default.
Public
getche() is a ________ function and defined in ________ header file.
built-in function , conio.h
________ operators are the ones that require two operands on both sides of
the operator.
Binary
________ will return the number of bytes reserved for a variable or data
type.
sizeof operator
________ are not available in C language.
Library functions
The members of a class declared without any keyword are ________ by
default.
private
For console input and output we use ________.
conio.h header file
The name of the destructor is the same as that of a class proceeding with
a ________.
~ sign
A reference cannot be NULL it has to point a data type.
True
A pointer is ________.
a variable for storing address
Constructor is a special function, called whenever we ________.
instantiate an object of a class
Symbolic constant PI can be defined as:
#define PI 3.14
Object code is machine code but it is not ________ and ________.
relocatable, executable
The default visibility for the data members of the class is
private
accessible outside the class
The ________ is called automatically when an object destroys.
destructor
Constructor is special type of function :
which has no return type
________ variables are those that are defined outside of main.
Global
Within the statement obj1=obj2; obj1 will call the assignment operator
function and obj2 will be passed as an argument to function.
True
When the compiler overload the assignment (=) operator by default then
Compiler does member wise assignment.
It is possible to return an object from function using this pointer.
True
Overloaded assignment operator must be
Member function of class
Let suppose
int a, b, c, d, e;
a = b = c = d = e = 42;
This can be interpreted by the compiler as
a = (b = (c = (d = (e = 42))));
In statement a+b+c, at first
b+c is executed first
Suppose int i = 10; then what is the output of cout<<oct<<i;
12
ostream is a ________ operator.
Standalone
________ must be included to use stream manipulation in your code.
Iomanip
________ operators are the ones that require only one operator to work.
Unary
The endl and flush are ________.
Manipulators
When operator function is implemented as member function then return
type of function ________.
Can be any data type
When a variable is defined as static in a class then ________.
Only one copy is created for all objects of this class
Automatic variables are created on ________.
Stack
cout << i << " ";
cout << d <<" ";
cout << f;
Above statements can be written within statement of one line as:
cout << i <<" "<< d <<" "<< f;
dec, hex, oct are all ________.
Non-parameterized manipulators
What will be the output of following statement?
cout<<setfill('0')<<setw(7)<< 128;
0000128
Which of the following syntax is best used to delete an array of 5 objects
named 'string' allocated using new operator.
delete []string;
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
The first parameter of operator function for << operator ________.
Must be passed by reference
The second parameter of operator function for >> operator must always be
passed
By reference
The only operator that the compiler overloads for user define data type by
default is------
Assignment (=) operator
Consider the following code, the printed value will be converted into:
int n=10;
cout <<oct<<n;
Base 8
________ variables are defined in the main.
Local
ostream class is ________ and not under our control.
built-in
The memory allocation in C++ is carried out with the help of ________.
new operator
If B is designated as friend of A, B can access A's non-public members.
A can access non-public members of B
If the request of new operator is not fulfilled due to insufficient memory in
the heap ________.
the operator returns 0
We should not use such variable names that are starting with ________
because in C++, there are lots of internal constants and symbolic names
that start with it.
double underscore
The friend keyword provides access ________.
in one direction only
The malloc function takes ________ argument(s).
one
The constructor contains ________.
no return type
What will be the output of the following c++ code?
#include<iostream.h>
#define max 100
main()
{
#ifdef max
Cout<<"Hellow;
}
Error
Once we have defined a symbolic constant value using #define, that value
________ during program execution
cannot be changed
The memory allocation functions return a chunk of memory with a pointer
of type ________.
ptr
A class can be declared as a ________ of other class.
member
To avoid dangling reference, don't return ________.
the reference of a local variable from the function
Constructor is itself a ________ of C++ and ________.
function, can be overloaded
The parameter passed to isdigit() function is ________ variable.
Integer
char **argv can be read as ________.
pointer to pointer to char
To read command-line arguments, the main() function itself must be given
________ arguments.
2
How many bytes an integer type pointer intPtr will jump in memory if the
statement below is executed?
intPtr += 2;
8
The increment of a pointer depends on its ________.
data type
The statement cout << yptr will show the ________ the yptr points to.
memory address
________ is used as a dereferencing operator.
*
Transpose of a matrix means that when we interchange rows and
columns ________.
the first row becomes the first column
Individual characters in a string stored in an array can be accessed
directly using array ________.
subscript
We can define a matrix as ________ array.
Multi dimensional
A ________ is an array of characters that can store number of character
specified.
String
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[2][3] = 6;
________ of a variable means the locations within a program from where it
can be accessed.
Visibility
Which of the following function call is "call by reference" for the following
function prototype? int add (int *);
add(&x);
Which of the following function call is "call by reference" for the following
function prototype? float add (float *);
add(&x);
Which of the function call is call by value for the following function
prototype? float add(float);
add(x);
Which of the function call is "call by value" for the following function
prototype? float add(int);
add(x);
Return type of a function that does not return any value must be ________.
void
________ will be used for enclosing function statements into a block.
{}
What is the output of the following code if the 2nd 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;
}
Banana mango any fruit
When the break statement is encountered in a loop's body, it transfers the
control ________ from the current loop.
Outside
What is the output of the following code if the 3rd 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;
}
Mango any fruit
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 banana mango any fruit
What will be the output of following code segment?
for (int i = 2; i<10; i++) {
if ( i == 5) continue;
cout << i << "," ;
}
2,3,4,6,7,8,9
________ statement is used to terminate the processing of a particular case
and exit from switch structure.
break
What will be the result of the expression j = i++; if initially j = 0 and i = 5?
5
What will be the result of the expression k = ++m; if initially k = 0 and m =
5
What will be the result of the expression k = ++m; if initially k = 0 and m =
5?
6
How many times the following do-while loop will execute?
int k = 10; do { cout << "Statements" << endl; k -= 2; } while(k>0);
6
Which of the following loops checks the test condition at the end of the
loop?
Do-While
The operators ++ and -- are used to increment or decrement the value of
a variable by ________.
1
How many times the following loop will execute?
int j = 3; while(j > 0) { cout << "Statements" << endl; j -= 2; }
2
A ________ structure specifies that an action is to be repeated while some
condition remains true.
Control
!( x > 3) means in C++ that
x is less than or equal to 3
When the logical operator && combines two expressions then the result
will be true only when the both expressions are ________.
true
< and > both are ________ operators.
Relational
What will be the value of variable “input” if the initial value of input is 67?
if(input >= 50)
input = input + 1;
if(input <= 75)
input = input + 2;
else
input = input - 1;
70
!( x < 3) means in C++ that
x is greater than or equal to 3
!= operator is used to check whether the operand on the left-hand-side is
__________ to the operand on the right-hand-side.
Not equal
When the if statement consists more than one statement then enclosing
these statement in curly braces is,
Must
The most suitable data type for number 325.25 is ________.
Float
What will be the result of arithmetic expression 6+48/4*3?
42
Which of the following will be the most appropriate data type to store the
value 63.547?
Float
In the given expression which operator will be evaluated first? 10 + (6 / 2) -
2 * 3?
/
What will be the value of the variable output in the given piece of code?
double output = 0;
output = (2 + 2) * 4 + 2 / (4 - 2);
17
It is the job of ________ to transfer the executable code from hard disk to
main memory.
Loader
In computer systems there are mainly ________ type of softwares.
2
________ will explain the function of a program.
Comments
if (a>b && a>c) then the condition will be true only if
Both a>b and a>c are true
A variable of character data type occupies ________ byte(s) in memory.
1
We must include the header file ________ to convert the value of one type
into another type using built-in functions.
string.h
A function is a block of statements that can be defined once and used
________ in the program.
As many times as user wants
Select the correct way to assign the address of first element of array to
pointer?
int *ptr = &data;
Consider the following code segment. What will be the output of following
code?
int addValue (int *a){
int b = (*a) + 2;
return b;
}
main() {
int x = 6;
cout<<addValue(&x)<<",";
cout<<x;
}
6,8,6
Here the code is given below. You have to identify the problem in the code.
while(i < 10) && (i > 24))
the test condition is always false
The correct syntax of do-while loop is ________.
do {statements;} while (condition);
Matrix is defined as ________.
Multi-dimensional array
In programming, comments are used to explain the functioning of the
________.
Program
Operating System is a type of a/an ________.
system software
From the options given, you need to choose the option which is true for
the given code.
for (int i = 1; i>0; i++) {
/*loop code*/
}
the test condition is always true
Which of the following values are used in C/C++ to represent true and
false?
1 and 0
'While' loop may execute ________ or more times.
zero
Body of any function is enclosed within ________.
{}
What will be the correct syntax for initialization of a pointer ptr with string
"programming"?
char *ptr = "programming";
Which one of the given option is not a mode for reading/writing the data
from a file?
Get
Which of the following operators is used to access the value of variable
pointed by a pointer?
* operator
In case of single dereferencing, the value of the ________ is the address of
the ________.
pointer, variable
The remainder (%) operator is a ________ operator.
Arithmetic
What will be the output of following code?
int x = 10;
cout<<"x="<<x;
x=10
The purpose of using cout<< is to ________.
Display information on the screen
Which of the following data types will be assumed if no data type is
specified with constant?
short
When an array element is passed to a function, it is passed by ________.
reference
While programming, it is good to provide an easy to understand and easy
to use interface; this programming skill is called ________.
usability
________ executes all the lines before error and stops at the line which
contains the error.
Intrepreter
Which of the following is the correct syntax to access the value of first
element of an array using pointer ptr?
*ptr[0]
C is a/an ________ language.
function oriented
________ of a function is also known as signature of a function.
Declaration
________ are very good tools for code reuse.
functions
If any break statement is missed in switch statement then ________.
this may cause a logical error
A 2D array multi[5][10] can be accessed using the array name as **multi,
this technique is called ________.
Double dereferencing
In C/C++, the default command line arguments passed to the main function
are ________.
int argc, char **argv
A record is a group of related ________.
Fields
The microsoft word document (.doc) is a kind of ________.
Random Access File
NULL character is used to indicate the ________ of string.
End
How many dimensions does n-dimensional array has?
n dimensions
Which of the following function call is "call by reference" for the following
function prototype?
func(&num);
The loop which is most suitable to be used when the number of iterations
is known is called ________.
for
In C/C++, the string constant is enclosed in ________.
double quotes " "
In order to get the right most digit of a number, we divide this number by
10 and take ________.
Its remainder
What is the correct syntax to declare an array of size 10 of int data type?
int name[10];
How many bytes of memory are occupied by array 'str'?
char str[] = "programming";
11
Suppose that an integer type pointer contains a memory address
0x22f230. What will be the new memory address if we increment this
pointer by one?
0x22f234
Which of the following if missing would result in infinite recursion in case
of recursive function?
Recursive call
Whenever we use a library function or a predefined object or macro, we
need to use a ________.
header file
Switch statement deals with ________ type of data.
Both Integer and Character
Both compiler and ________ are used to translate program into machine
language code.
Interpreter
TWAIN stands for ________.
Technology Without An Interesting Name
The parameter passed to isdigit() function is ________.
a character variable
C++ views each file as a sequential stream of ________.
Bytes
Structure is a collection of ________ under a single name.
only variables
The default mode for writing into a file using ofstream object is ________.
out
The memory address of the first element of an array is called ________.
base address
We want to access array in random order which of the following approach
is better?
Pointer
The ________ structure is a multiple-selection construct which makes the
code more efficient and easy to read and understand.
switch
Which of the following is not a reserved word in C/C++?
Sum
To access rand(), which library is required to be included in program?
stdlib.h
What is the highest legal index for the following array?
int arr[4]
Word processor is a type of a/an ________.
application software
Identify the correct option which is used for calling the function float area
(int).
area(int num);
The ________ statement allows us to select from multiple choices based on
a set of fixed values for a given expression.
switch
C is widely known as development language of ________ operating system.
Unix
To convert the value of one type into another type using built-in functions,
we include ________ header file.
stdlib.h
The keyword ________ is used to get some value back from a function.
return
The function seekg() takes ________ parameter(s).
2
The function write() takes ________ as parameter(s).
String and no. of bytes to be written
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
Syntax of a union is identical to ________.
structure
In Flow Chart, flow of control is represented by ________.
Arrow
There can be ________ 'default' statement(s) in any switch structure.
2
The condition in loop should be a(n) ________.
Arithmetic Expression
How many nested loops would be required to manipulate n-dimensional
array?
2n
Which of the following is not an example of int data type?
-4
We should use ________ for clarity and to force the order of evaluation in
an expression.
parenthesis ()
Which of the following is the starting index of an array in C++?
The statement x += y can be interpreted as ________.
Adding the value of the x to the value of the y and storing the result in x
Given a 2D array of integers, what would be the correct way of assigning
the value 5 to the element at second row and third column?
m[1][2] = 5;
Array is a data structure that stores ________.
Variables
A program statement that invokes a function is called ________.
function call
The compiler of C language is written in ________ language.
C
Which function is used to locate the first occurance of a character in any
string?
strlen()
To access the data members of structure, ________ is used.
Dot operator
In the following nested For Loop, which loop will run most number of
times?
for( int i = 0; i < 5; i++)
{
for(int k = 0; k < 5; k++)
{
.....
}
}
Depends upon the statements in the inner loop's body
Structure use ________ allocation.
Heap
________ function give the position of the next character to be read from
that file.
tellp()
What will be the size of the following character array?
char name[] = "Adeel";
5
Function prototype is written,
Before call of that function
Which one of the following languages has been used to write the compiler
of "C" language?
C
A hierarchy of classes which are used to deal with console and disk files
are called ________.
Stream classes
________ stops execution at the line that contains error(s) in the code.
Interpreter
C++ is a ________ language.
High level
How many elements are stored in the following?
int matrix [4][5];
20
________ is a substitute of multiple if statement.
if. . .elseif statement
if
int sum = 54;
Then the value of the following statement is
sum = sum - 3;
51
What will be the correct syntax for declaration of the following statement?
"ptr is a constant pointer to an integer"
const int *myptr;
________ operator is used to pass the address of a variable in call by
reference method.
&
________ data type can operate on modulus operator.
int
Whenever some number is added in an array name, it will jump as many
________ as the added number.
rows
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?
0x22f224
________ is the pointer which determines the position in a file from where
the next read operation occurs.
put
what is the correct centex to declare an array of 15 elements of type float?
float array [14]
suppose we have a file with name “mylife.txt” . what will be the correct
Syntax of file opening for input?
my file (“myfile.txt”. ios::in)
which of the following will be the most appropriate data type to store the
value 63.5 47?
Float
------- will explain the function of a program
Comments
these functions Seekg( ) and seekp( ) requires an argument of type------
-- to let them how many bites to move forward or backward
Int
all elements of an array must be of --------- data type
Same
what will be the result of arithmetic expression 6 + 48 / 4 * 3?
42
----------- allow us to have a memory location and use it as int or char
interchangeably
none of the given
accessing a structure member the identifier to the left of the dot operator
is the name of----------
structural variable
< and > both are--------- operators
Arithmetic
what will be the output of the following code segment?
For (int = 2; i<10; i ++){
If ( i = = 5 )
Continue;
cout<< i << “.”;
}
2,3,4,5,6,7,8,9
----------- returns true if she is a digit or a letter and false otherwise
Int isalnum (int c)
if a ----- find an error, it stop translating without generating any E
executable code
Compiler
the ASCII code of null character is----------
000
if X = 9; then the expressions x%=2; will calculate the value of x as ------
-
1
the original value means unchanged in --------
Call by Value
which of the following is used to create an account stream?
Ofstream
how many times the following loop will execute?
Int j = 3;
While (j > 0)
{
Cout << “ statements” << endl;
J - = 2;
}
2
Use of word processor for writing the code of a program is not good
because --------
It has less feature for writing code of a program
how many bytes and integer type pointer intptr will jump in memory if the
statement below is executed?
Intptr + = 2;
8
avoid loop may execute ------ or more Times
0
raid stands for ------
redundant array of inexpensive dices
in a file is opened with iOS:: out mode, then-------------
a new file is created
first step in designing a program is
Analysis
what will be the result of the expression
J = i ++
If initially j = 0 and i = 5?
5
suppose we have int y [10];
to access the 4th element of the array be write-------
Y [3];
A ------------- structure specify that an action is to be repeated while
some condition remains true
Control
the most suitable data type for number 325.25 is------
float
Which one of the following should be placed immediately either before or
after the noun?
Modifiers of Nouns
Titles typically include both ………………………
a number and a description
For what purposes colons are used?
All of the above
The name of the array is a constant pointer which contains the memory
address of the ____________of the array.
first element
What will be the correct syntax for the following function call? float add
(int &);
add(x);
In C/C++; by default arguments are passed by _______ to a function.
Value
< , <= , > , >= are called __________ operators.
Relational
char name [ ] = “Hello World” ; In the above statement, a memory of
_________ characters will be allocated
12
While developing a program; should we think about the reusability?
Yes
C is widely known as development language of _______ operating system.
Unix
Which of the following function call is “call by reference” for the following
function prototype? int add (int *);
add(&x);
If a function has not been declared before its definition, It is a
None of these
While loop executes at least----
Zero time
A _____________is a precise sequence of steps to solve a particular
problem.
Program
In while loop the loop counter must be initialized,
Before entering the loop
int counter = 0 ;
while(counter < 15)
cout << counter << “ ”;
counter++;
Infinite loop
Why we use "cin"?
To read data from keyboard
Loops are _______________ Structure
Repetition