Output Questions
Output Questions
Question 1
[Year 2015]
int main()
{
int P1 = 20, P2 = 4;
Position(P1);
cout << P1 << ", " << P2 << endl;
Position(P2, P1);
cout << P1 << ", " << P2 << endl;
}
Question 2.
[Year 2007]
int main()
{
char Memo[] = "Justnow";
Encode(Memo, 2);
cout << Memo << endl;
}
void Encode(char Info[], int N)
{
for (int I = 0; Info[I] != '\0'; I++)
if (I % 2 == 0)
Info[I] = Info[I] - N;
else if (islower(Info[I]))
Info[I] = toupper(Info[I]);
else
Info[I] = Info[I] + N;
}
[Year 2010]
int main()
{
char oldText[] = "pOwERALone";
ChangeIt(oldText, '%');
cout << "New TEXT:" << oldText << endl;
}
Show the answer.
New TEXT:PPW%RRllN%
Question 5.
[Year 2005]
int main()
{
char Text[] = "CBSE Exam 2005";
int Size = strlen(Text);
Convert(Text, Size);
cout << Text << endl;
for (int C = 0, R = Size - 1; C < Size / 2;
C++, R--)
{
char Temp = Text[C];
Text[C] = Text[R];
Text[R] = Temp;
}
cout << Text << endl;
}
Show the answer.
cbse*eXAM*3116
6113*MAXe*esbc
Question 6.
[Year 2010]
int main()
{
POINT P1 = {15, 25, 5}, P2 = {10, 30, 20};
StepIn(P1);
StepOut(P2, 4);
cout << P1.X << ", " << P1.Y << ", " << P1.Z
<< endl;
cout << P2.X << ", " << P2.Y << ", " << P2.Z
<< endl;
StepIn(P2, 12);
cout << P2.X << ", " << P2.Y << ", " << P2.Z
<< endl;
}
[Year 2005]
struct MyBox
{
int Length, Breadth, Height;
};
void Dimension(MyBox M)
{
cout << M.Length << "x" << M.Breadth << "x";
cout << M.Height << endl;
}
int main()
{
MyBox B1 = {10, 15, 5}, B2, B3;
++B1.Height;
Dimension(B1);
B3 = B1;
++B3.Length;
B3.Breadth++;
Dimension(B3);
B2 = B3;
B2.Height += 5;
B2.Length--;
Dimension(B2);
}
Question 8.
[Year 2013]
class Aroundus
{
int Place, Humidity, Temp;
public:
Aroundus(int P = 2)
{
Place = P;
Humidity = 60;
Temp = 20;
}
void Hot (int T)
{
Temp += T;
}
void Humid(int H)
{
Humidity += H;
}
void JustSee()
{
cout << Place << ":" << Temp << "&" <<
Humidity << "%" << endl;
}
};
int main()
{
Aroundus A, B(5);
A.Hot(10);
A.JustSee();
B.Humid(15);
B.Hot(2);
B.JustSee();
A.Humid(5);
A.JustSee();
}
Show the answer.
2:30&60%
5:22&75%
2:30&65%
Question 9.
[Year 2015]
int main()
{
Calc C;
C.Down(2);
C.Show();
C.Up(7);
C.Show();
C.Down(2);
C.Show();
}
[Year 2014]
int main()
{
METRO M(5), T;
M.Trip();
T.Trip(50);
M.StatusShow();
M.Trip(30);
T.StatusShow();
M.StatusShow();
}
[Year 2009]
[Year 2007]
[Year 2013]
[Year 2011]
[Year 2004]
[Year 2012]
int main()
{
char *Notes;
Str80 Str = "vR2GooD";
int L = 6;
Notes = Str;
while(L >= 3)
{
Str[L] = (isupper(Str[L])?
tolower(Str[L]): toupper(Str[L]));
cout << Notes << endl;
L--;
Notes++;
}
}
[Year 2009]
(i) 103#102#101#100#
(ii) 100#101#102#103#
(iii) 100#101#102#103#104#
(iv) 104#103#102#101#100#
Show the answer.
Ans.
Question 18.
[Year 2007]
(i) 99 (ii) 94
(iii) 96 (iv) None of the above
(i) 50 # 51 # 52 # 53 # 54 # 55 #
(ii) 52 # 53 # 54 # 55 #
(iii) 53 # 54 #
(iv) 51 # 52 # 53 # 54 # 55
Least value 50
Highest value 53
Question 20.
[Year 2005]
Output Options:
(i) 1 2 3 4
(ii) 1 2
(iii) 1 2 3 4 5 6 7 8 9
(iv) 1 2 3
Question 21
[Year 2015]
[Year 2013]
(i) 10EXCEL#10EXCEL#8OK#
(ii) 10EXCEL#8OK#9GOOD#
(iii) 10EXCEL#9GOOD#10EXCEL#
(iv) 10EXCEL#10GOOD#8OK#
[Year 2010]
(i) 19:16:15:18:
(ii) 14:18: 15:16:
(iii) 19:16:14:18:
(iv) 19:16:15:16:
[Year 2012]
Observe the following program and find out, which
output(s) out of (i) to (iv) will not be expected from the
program? What will be the minimum and the maximum
value assigned to the variable Chance? Assume all
required header files are already being included in the
program.
int main()
{
randomize();
int Arr[] = {9, 6}, N;
int Chance = random(2) + 10;
for (int C = 0; C < 2; C++)
{
N = random(2);
cout << Arr[N] + Chance << "#";
}
}
(i) 9#6#
(ii) 19#17#
(iii) 19#16#
(iv) 20#16#