Solved MCQS For Mid Terms Papers Solved by JUNAID MALIK and Team
Solved MCQS For Mid Terms Papers Solved by JUNAID MALIK and Team
0
AL-JUNAID INSTITUE OF GROUP
Question 1
What is the other name of the variable?
Identifier
Visual
Static
Constant
Question 2
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 trough the stream simultaneously
D. Bytes that enters first into the stream will go out at last
A &D
A only
C only
A&B
Question 3
When No. of repetition is know then we use the ------ structure to perform repetition tasks.
While loop
For loop
Switch
Do while loop
Question 4
Shifting the binary number is similar to shifting the------ number.
Base 7
Decimal
Hexadecimal
1
0304-1659294
AL-JUNAID INSTITUE OF GROUP
octal
Question 5
We can read, write and manipulate the same file using ---------------.
Stdio.h
Fsteram. h
Iomanp.h
Iostream.h
Question 6
In do while loop the , condition is checked ----------- one execution of loop.
Before
During
At Any time
After
Question 7
< , <=, >, >= are called ----- operators.
Arithmetic
Conational
Logical
Relational
Question 8
For breaking complex problem into smaller pieces we use ------------.
Function
Loops
If/else
Break statement
Question 9
In three – dimensional array. We use------- ‘for loop(s)’ to populate the array.
3
2
2
0304-1659294
AL-JUNAID INSTITUE OF GROUP
1
4
Question 10
a = a +1: can be written as ---------------
1 + a = a:
a+a+1
a+=1
a+1
Question 11
Continue statement usually force the immediate ------ iteration of the loop .
last
previous
first
next
Question 12
If a file is opened with ios: : out mode . then -----------------.
Question 13
----------------------- operator is used to pass the address of variable in call by reference method.
&
@
%
+
Question 14
3
0304-1659294
AL-JUNAID INSTITUE OF GROUP
C++ is a -------------- language.
Machine
Low level
Assembly language
High level
Question 15
By writing a file seekg (15L. ios : : cur) we are moving --------------.
15 bit in the backward direction starting from the pervious position.
15 bit in the backward direction starting from the current position.
15 bytes in the backward direction starting from the pervious position.
15 bytes in the forward direction starting from the pervious
position.
Question 16
Pointer points to a particular -------------.
Data types
Variable
Memory address
value
Question 17
If function has not been, declared before it is a -------.
Run time error
Logical error
Syntax error
Late binding error
Question 18
---------------- statement is used to terminate the processing of a particular case and exit from
switch structure.
Break
4
0304-1659294
AL-JUNAID INSTITUE OF GROUP
If
Goto
continue
Question 19
Which one of the following is used to perform bit- wise OR operation?
~
^
||
|
Question 20
In the following nested For Loop, which loop will run most number of times?
For ( int I = 0 : k : 5 K++)
{
For (int k = 0 : k <: 5: k++)
{
…………………….
}
Inner loop
Depends upon the statements in the inner in the loop body
Outer loop
Both loop run equal number of time
Question 21
We can access a global variable ------------.
Question 22
5
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Structures are syntactically defined with the word------------.
Struct
Struc
Structure
None of the given
Question 23
If y= 20 and z = y++. Then the value of z will be --------------.
22
20
21
19
Question 24
The structure which can execute zero or more times is called ------------.
For structure
Do- while loop
While structure
None of the above
Question 25
Which of the following is the correct way to write a compound assignment operator?\
X + = 4:
X+=4:
X+==4:
None of the above
Question 26
Suppose we have a file with name “my file .txt”. What will be the correct syntax of file opening for the
input.
6
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Question 27
What will be the value of the variable output in the given piece of the code?
Double output = 0
Question 28
Which one of the following languages has been used to write the compiler of “C ”language?
Basic
Fortran
Java
C AL-JUNAID INSTITUE OF GROUP
Question 29
Char name []= “Hello world” :
10
12
13
11
Question 30
What will be output of following code segment?
If (i==5)
Continue:
Cout <<i<<”.”:
7
0304-1659294
AL-JUNAID INSTITUE OF GROUP
}
2, 3, 4
2, 3,4,6,7,8,9
4,6,7,8,9
2,3,7,8,9
Question 31
Identify the correct syntax for making a class friend of other class
friend ClassOne
OtherClass
ClassOne
friend otherclass
friend otherclass
Question 32
The function will be return a reference to the global variable that exits throughout the promgram and
thus there will be no danger of--------.
Garbage collection
Dangling reference
Wastage of memory
8
0304-1659294
AL-JUNAID INSTITUE OF GROUP
System crash
Question 33
The friend function are --------------.
Question 34
The function of calloc takes two arguments, the first argument is the --------- and the second argument is
the -------------.
Question 35
With the use of dynamic allocation of memory, the system resource can be-------------.
Wasted
Used efficiently
Used carelessly
All of the above
Question 36
An instance of a class is called -------.
Structure
Data type
Object AL-JUNAID INSTITUE OF GROUP
Member function
Question 37
Initializing the data member within the class is ---------.
9
0304-1659294
AL-JUNAID INSTITUE OF GROUP
A logical error
A run time error
A syntax error
Not an error
Question 38
A friend function of a class is a function defined -------------.
Inside that class and that has no access to the member of the class
Output that class that right to access public member of the class only
Outside that class and that has the right to access all member of
class.
Outside that class and that has the right to access all member of the class
Question 39
This reference to variable can be obtained by preceding the identifier of a variable with------.
Dot operator
Ampersand sign &
^sign
*operator
Question 40
In c language, the region of memory allocated at run time is called-----------.
Stack
Heap
Free store
Available memory
Question 41
Constructor has -------------.
No name
The same of the class
The same name as data member
Return type
10
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Question 42
Programmer should be very careful about the memory management because it can----------.
Question 43
Something after allocating memory we need additional space for this purpose we use
Reallocation function
Calloc function
Realloc function
Void pointer
Question 44
The constructor contains------.
Return type
No return type
Objects
Classes
Question 45
Encapsulation means-----------------.
Question 46
Friend classes are used in cases where one class is ------------ to another class
11
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Lightly coupled
Loosely coupled
Independent
encapsulted
Question 47
#define CIRCUMFERENCE(X) (2*pl * R ) is a
Question 48
Header files provide -------------- so the program running on one operating system can run without an
error on the other system.
Accessibility
Reliability
Accuracy
portability
Question 49
------ will return the number of bytes reserved for a variable or data type.
Size of operation
Free operator
Void pointer
New operator
Question 50
Default constructor takes----------.
One parameter
Two parameter
No parameter
Character type paremeter
Question 51
12
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Void calloc(50,sizeroof(int))will return
Char pointer
A memory chunk of 50 integers from heap
A memory chunk of 50 integers from stack
A memory chunk with zero pointer
Question 52
We cannot increment -------.
Pointer
Arrays
References
variables
Question 53
Symbolic constant pI can be defined as:
#define PI 3.14;
#define PI 3.14
#define Pi =3.14
#include pi= 3.14
Question 54
Special name which is substituted in code by its definition and as a reslt we get anexpanded code is
called
Union
Directive
Array
Macro AL-JUNAID INSTITUE OF GROUP
Question 55
In a class we can have ------ constructor(s).
Only one
No
Two
Many
13
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Question 56
C++ offers ----------- levels of data access control inside a class.
Three
Four
Two
five
Question 57
For accessing data members we use ------- operator
plus+
multiplication*
dot.
Division/
Question 58
The memory allocation in C++ is carried out with the help of ---------------.
NULL Pointer
New operator
Dot operator
+operator
Question 59
The object code of our program is combined with the --------------.
Source program
Machine code of the operating system
Object code of the library functions
With header files
Question 60
Initializing the data member with in the class is --------------.
A logical error
A run time error
14
0304-1659294
AL-JUNAID INSTITUE OF GROUP
A syntax error AL-JUNAID INSTITUE OF
GROUP
Not an error
Question 61
Look at the program code and identify the error.
1 #include <iostream.h>
3 main()
Question 62
What will be the output of the given code?
#include <iostearm.h>
if( a>b)
return a;
return b;
15
0304-1659294
AL-JUNAID INSTITUE OF GROUP
main()
int I x,y;
x= 23; y=45
X 23 y 45
X 24 y 46
X 22 y 46
X 23 y 47
Question 63
We should not use sch variable names that are starting with ----------- because in C++, there are lots of
internal constant and symbolic names that star with it.
Question 64
For console input and output we use ---------------.
Question 65
The difference b/w pointer and references is that-------.
16
0304-1659294
AL-JUNAID INSTITUE OF GROUP
We cannot reassign pointers
We can assign references
Question 66
If you create a header file of your own and you save it in the “Header file” folder which is located on the
current working directory then you must enclose your header file within-----------------.
Braces
Quotation marks
#sign
Angle brackets
Question 67
Reference Variables must--------------------.
Question 68
To prevent dangling reference the function returning reference should be sued with-----------.
Local variables
Global variables only
Arrays
Static and global variables
Question 69
The function will return a reference to the global variable that exits throughout the program and thus
there will be no danger of ---------------.
Garbage collection
Dangling reference
Wastage of memory
System crash
Question 70
=operator is used for -------------.
17
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Checking equality
Decision making
Comparison
Assigning values to cariables
Question 71
aFile- seeking (-10L,ios:cur)
Both direction
None of the given
Backward direction
Forward direction
Question 72
In C/C++, a variable’s name can start with the symbol------------.
-Underscore
+Plus
:Colon
;semicolon
Question 73
Which is the correct syntax to define a structure named “student”?
Struct student(
//variable
);
Struct student{
//variable
};
Structure student(
//variable
);
Structure student{
//variable
};
Question 74
18
0304-1659294
AL-JUNAID INSTITUE OF GROUP
The exclusive OR operator returns 1 if --------------.
Question 75
If int a = 50; then the value of a/=3; will be
18
15
17
16
Question 76
Identify the logical error in the following if condition
If (( i<5) &&(i>5))
Utility
Device driver
Application
System
Question 78
MS word is type of ------- software. imp
Application
Device Driver
Operating system
utility
19
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Question 79
What will be result of the expression
K=++m;
6
4
0
5
Question 80
Individual characters in a string stored in an array can be accessed directly using array--------.
Subscript
Script
Value
Superscript
Question 81
Structure use ---- for memory allocation
Cache
Stack
Heap
Queue
Question 82
a ^= b; can be written as
a= b^a;
a^=a+b
a=a^+b;
a=a^b;
Question 83
There is a pointer variable named ptr of type float. Which type of variable address can be stored by ptr?
Int
20
0304-1659294
AL-JUNAID INSTITUE OF GROUP
Char
Float
double
Question 84
Compiler translates high language program into------ language code.
Java
Machine
C
C++
Question 85
From the following; which one is the correct syntax of an array declaration; array size is 5 and it offloat
data type?
Question 86
The expression (( a +b )== 10) &&((X + Y)==20) is true only if-----------.
Question 87
In do while loop the condition is checked --------- one execution of loop.
During
Before
At any time
After
Question 88
21
0304-1659294
AL-JUNAID INSTITUE OF GROUP
To get the value stored at a memory address , we use the--------------.
Referencing operator
Binary operator
dereferencing operator
AND(&&) operator
Question 89
Following is the declaration of a ---------- array. Int arr[2][2][2]
2 –Dimensional
3 –Dimensional
1 –Dimensional
22
0304-1659294