Cplusplus Mock Test IV
Cplusplus Mock Test IV
This section presents you various set of Mock Tests related to C++ Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
#include<isotream>
switch(t)
{
case 2: cout<<”Hi”;
default: cout<<"Hello";
}
}
A - Hi
B - HiHello
C - Hello
D - Error
#include<isotream>
cout<<p[1];
}
A-1
B-2
C - Compile error
D - Runtime error
#include<isotream>
i^=j;
j^=i;
i^=j;
cout<<i<<” “<<j;
}
A - 73 73
B - 60 13
C - 13 60
D - 60 60
#include<isotream>
var.ch = 'A';
cout<<var.x;
}
A-A
B - Garbage value
C - 65
D - 97
A - Executable code
B - Object code
C - Assembly code
A-$
B-@
C-_
D-.
Q 7 - A single line comment in C++ language source code can begin with _____
A-;
B-:
C - /*
D - //
A - True
B - False
A - Int
B - bool
C - DOUBLE
D - __0__
A - cpp
B - g++
C - Borland
D - vc++
A - #include <file>
#include<isotream>
int& f() {
return x;
}
main() {
f() = 10;
cout<<x;
}
A-5
B - Address of ‘x’
C - Compile error
D - 10
A - a.exe
B-a
C - a.out
D - out.a
#include<isotream>
cout<<i;
if(--i) f();
}
main() {
f();
}
A-3210
B-321
C-333
D - Compile error
main() {
}
A - No output
B - Garbage
C - Compile error
D - Runtime error
Q 16 - Does both the loops in the following programs prints the correct string length?
#include<isotream>
i=0;
while(s[i++]);
cout<<i;
}
#include<isotream>
cout<<*a+1;
}
A - 10
B - 20
C - 11
D - 21
#include<isotream>
cout<<s<<endl;
}
A - Fine
B - Nine
C - Compile error
D - Runtime error
#include<isotream>
cout<<s<<endl;
}
A - Fine
B - Nine
C - Compile error
D - Runtime error
A - string_cmp
B - strcmp
C - equals
D - str_compare
#include<isotream>
cout<<s<<" ";
s++;
cout<<s<<" ";
}
A - C++ C++
B - C++ ++
C - ++ ++
D - Compile error
#include<isotream>
cout<<s<<" ";
s++;
cout<<s<<" ";
}
A - C++ C++
B - C++ ++
C - ++ ++
D - Compile error
#include<isotream>
#include<string.h>
Cout<<strlen(s)<<” “<<sizeof(s);
}
A-59
B - 7 20
C - 5 20
D - 8 20
#include<isotream>
cout<<v.rno;
}
A - 10
B - Garbage
C - Runtime error
D - Compile error
A - Only i is true
B - Only ii is true
ANSWER SHEET
1 D
2 B
3 B
4 C
5 B
6 C
7 D
8 A
9 B
10 B
11 C
12 D
13 C
14 B
15 A
16 B
17 C
18 B
19 D
20 B
21 B
22 D
23 A
24 D
25 B
Loading [MathJax]/jax/output/HTML-CSS/jax.js