SlideShare a Scribd company logo
1 of 59
XII CBSE
Previous Year
Question Paper
QUESTION NO
1 (D)
2 or 3 Marks
1. (d) Find the output of the following program :
Delhi 2006 3
#include<iostream.h>
#include<string.h>
class state
{ char *state_name;
int size;
public:
state( ); { size=0; state_name=new
char[size+1]; }
state(char *s)
Contd…
{ size = strlen(s) ; state_name = new
char[size+1];
strcpy(state_name,s);
}
void display( ) {cout<<state_name<<endl;}
void Replace (state & a, state & b)
{ size = a.size + b.size;
delete state_name;
state_name = new char[size+l];
strcpy(state_name, a.state_name);
strcat(state_name, b.state_name);
}
}; contd…
void main( )
{ char * temp = “Delhi”;
state state1 (temp), state2(“Mumbai”),
state3(“Nagpur”), S1, S2;
S1.Replace(state1, state2);
S2. Replace(S1, state3);
S1.display( );
S2.display( );
}
Answer:
(d) DelhiMumbai
DelhiMumbaiNagpur
(3 full marks for identifying error in
definition of the constructor
state() in Line 7)
OR
(3 marks for the correct lines of output)
OR
(2 marks for any one correct line of output)
OR
(1 Mark for showing the output starting with
Delhi)
2 (d) Find the output of the following program :
OD 2006 3
#include<iostream.h>
#include<string.h>
class student
{ char *name;
int l;
public:
student() { l=0; name=new char[1+1]; }
student(char *s)
{ l=strlen(s); name=new char[1+1];
strcpy (name,s);
} contd…
void display() { cout<<name<<endl;}
void manipulate(student & a, student & b)
{ l=a.l + b.l;
delete name;
name=new char[l+l];
strcpy(name, a.name);
strcat(name, b.name);
}
};
void main()
{ char * temp =''Jack'';
student name1(temp), name2('' Jill''), name3(''
John'' ),S1,S2;
S1.manipulate(name1,name2);
S2.manipulate(S1,name3);
S1.display();
S2.display();
}
Answer :
(d) JackJill
JackJillJohn
(2 marks for any one correct line)
(Full 3 marks for both lines correct)
(½ mark to be deducted from full 3 marks,
if endl is not considered)
3 (d) Find the output of the following program :
Delhi 2007 2
#include<iostream.h>
void main()
{
int Numbers[] = {2,4,8,10};
int *ptr = Numbers;
for (int C = 0; C<3; C++)
{
cout<< *ptr << “@”;
ptr++;
}
3 (d) Find the output of the following program :
Delhi 2007 2
cout<<endl;
for(C = 0; C<4; C++)
{
(*ptr)*=2;
--ptr;
}
for(C = 0; C<4; C++)
cout<< Numbers [C]<< “#”;
cout<<endl;
}
(d) 2 @ 4 @ 8 @
4 # 8 # 16 # 20 #
(1 Mark for each correct line of output)
Note:
· ½ Mark to be deducted for missing symbols in each
line of output
· ½ Mark to be deducted if endl is not considered in the
output
· As Borland C++ Compiler declares for loop variable
locally,the program will result in syntax errors. So, any
studentspecifying Variable C not declared OR
mentioning that the program will not RUN
4 (d) Find the output of the following program :
OD 2007 2
# include < iostream.h>
void main ()
{
intArray[] = {4,6,10,12};
int *pointer = Array ;
for (int I=1 ; I<=3 ; I++)
{
cout<<*pointer<<#”;
pointer ++;
}
4 (d) Find the output of the following program :
OD 2007 2
cout<<endl;
for (I=1 ; I<=4 ; I++)
{
(*pointer)*=3 ;
-- pointer;
}
for(I=l; I<5; I + + )
cout << Array [I-1] << “@”;
cout << endl;
}
(d) 4 # 6 # 10 #
12 @ 18 @ 30 @ 36 @
(1 Mark for each correct line of output)
Note:
· ½ Mark to be deducted for missing symbols in the
output
· ½ Mark to be deducted if endl is not considered in
the output
· As Borland C++ Compiler declares for loop variable
locally,the program will result in syntax errors. So,
any student specifying Variable I not declared OR
mentioning that the program will not RUN due to
incorrect syntax should be awarded full 2 Marks
5 (d) Find the output of the following program:
Delhi 2008 3
#include<iostream.h>
#include<ctype.h>
void main ( )
{
char Text [ ] = “Mind@Work!”;
for (int I = 0; Text (I)! = ‘0’; 1++)
{
if (!isalpha (Text[I]))
Text [I] = ‘*’;
else if (isupper (Text[I]))
Text [I] = Text [I] + 1 ;
5 (d) Find the output of the following program:
Delhi 2008 3
Text [I] = Text [I] + 1 ;
else
Text (I) = Text [I+ 1];
}
cout<<Text;
}
Ans:
Nnd@*Xrk!*
(½ Mark for N in the 1st position)
(½ Mark for nd in the 2nd and 3rd position)
(½ Mark for @ in the 4th position)
(½ Mark for * in the 5th position)
(½ Mark for Xrk!)
(½ Mark for * at the end)
332
OR
(Fu1l 3 Marks If error is mentioned in the code for
Text (I) after last else)
6. (d) Find the output of the following program :
OD 2008 3
#include<iostream.h>
#include<ctype.h>
void main ( )
{
char Mystring[ ] =“What@OUTPUT!” ;
for(int I = 0; Mystring [I] ! =’ 0'; I++)
{
if (!isalpha (Mystring[I]))
Mystring [I] = ‘*’;
else if (isupper (Mystring[I]))
6. (d) Find the output of the following program :
OD 2008 3
Mystring [I] = Mystring[I] +1;
else
Mystring [I] = Mystring [I+1];
}
cout<<Mystring;
}
Ans:
Xat@*PVUQVU*
(½ Mark for X in the first position)
(½ Mark for at in the 2nd & 3rd positions)
(½ Mark for @ in the 4th position)
(½ Mark for * in the 5th position)
(½ Mark for PVUQvu)
(½ Mark for * at the end)
7 (d) Find the output of the following program :
Delhi 2009 3
#include<iostream.h>
void main ( )
{
int X[ ] = {10, 25, 30, 55, 100};
int *p = X ;
while ( *p < 110)
{
if (*p%3 ! = 0)
*p = *p + 1 ;
else
*p = *p + 2 ;
7 (d) Find the output of the following program :
Delhi 2009 3
p++;
}
for(int I = 4 ; 1>= 1 ; I - -)
{
cout << X[I] << “*” ;
if ( I%3 = = 0) cout<<endl ;
}
cout<<X[0]*3<<endl ;
}
Ans
1110*56*
32*26*33
(½ Mark for each correct value)
(½ Mark for all correct endl and *)
8 (d) Find the output of the following program:
OD 2009 3
#include<iostream.h>
void main ( )
{
int A[ ] = {10, 15, 20, 25, 30}
int *p = A;
while (*p < 30)
{
if (*p%3 ! = 0)
*p = *p + 2 ;
else
*p = *p + 1;
8 (d) Find the output of the following program:
OD 2009 3
p++;
}
for (int J = 0; J<=4; J++)
{
cout << A[J] << “*” ;
if ( J%3 = = 0) cout<<end1;
Ans
12*
16*22*27*
30*90
(1 Mark for each line with correct values)
Note:
Deduct ½ Mark if any/all ‘*’ missing
Deduct ½ Mark if endl is not considered at the
right positions
9 (d) Find the output of the following program :
Delhi 2010 3
#inc1ude <iostream.h>
struct POINT
{int X, Y, Z;};
void StepIn(POINT & P, int Step=1)
{
P.X+=Step;
P.Y -=Step;
P.Z+=Step;
}
9 (d) Find the output of the following program :
Delhi 2010 3
void StepOut(POINT & P, int Step=1)
{
P.X-=Step;
P.Y+=Step;
P.Z–=Step;
}
9 (d) Find the output of the following program :
Delhi 2010 3
void 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;
}
Ans.
16, 24, 6
6, 34, 16
18, 22, 28
(1 Mark for each line with -correct values)
OR
(½ Mark for any two correct values in each line)
Note:
Deduct (½ Mark if any/all ‘,’ missing
Deduct (½ Mark if endl is not considered at the right
positions
10 (d) Find the output of the following program:
OD 2010 3
#include <iostream.h>
struct THREE_D
{int X,Y,Z;};
void MoveIn(THREE_D &T, int Step=l)
}
T.X+=Step;
T.Y-=Step;
T.Z+=Step
}
10 (d) Find the output of the following program:
OD 2010 3
void MoveOut(THREE_D &T, int Step=l)
{
T.X-=Step;
T.Y+=Step;
T.Z-=Step;
}
10 (d) Find the output of the following program:
OD 2010 3
void main ()
{
THREE_D Tl={lO,20,5},T2={30,lO,40};
MoveIn(T1);
MoveOut(T2,5);
cout<<Tl.X<<“,”<<Tl.Y<<“,”<<T1.Z<<endl;
cout<<T2.X<<“,”<<T2.Y<<“,”<<T2.Z<<endl;
MoveIn(T2,l0);
cout<<T2.X<<“,”<<T2.y<<“,”<<T2.Z<<endl;
}
Ans.
11, 19, 6
25, 15, 35
35, 5, 45
(1 Mark for each line with correct values)
OR
(½ Mark for any two correct values in each
line)
Note:
Deduct ½ Mark if any/all ',' missing
Deduct ½ Mark if endl is not considered at the
right positions
11 (d) Find the output of the following program:
Delhi 2011 3
#inc1ude<iostream.h>
void ChangeArray(int Number, int ARR[ ], int
Size)
{
for (int L =0; L<Size; L++)
if (L<Number)
ARR [L] +=L;
e1se
ARR [L] *=L;
}
11 (d) Find the output of the following program:
Delhi 2011 3
void Show (int ARR [ ], int Size)
{
for (int L=0; L<Size; L++)
(L%2!=0) ?cout<<ARR[L] <<"#":
cout<<ARR[L]<<end1 ;
}
void main ( )
{
int Array [ ] = {30, 20, 40, 10, 60, 50};
ChangeArray (3, Array, 6) ;
Show (Array, 6) ;
12 (d) Find the output of the following program:
OD 2011 3
#include <iostream.h>
void SwitchOver(int A [ ], int N, int Split)
{
for (int K=0 ; K<N; K++)
if (K<Split)
A(K]+ =K;
else
A [K]*=K;
}
12 (d) Find the output of the following program:
OD 2011 3
void Display (int A [ ], int N)
{
for (int K=0 ; K<N ; K++)
(K%2==0)? cout<<A[K]<<"%":cout<<A(K]<<end1;
}
void main ( )
{
int H[ ]= {30,40,50,20,10,5};
SwitchOver (H, 6, 3);
Display (H, 6);
}
13 (d) Find the output of the following program:
SP 2010 SET I 3
#include <iostream.h>
struct GAME
{ int Score, Bonus;};
void Play(GAME &g, int N=10)
{
g.Score++;g.Bonus+=N;
}
13 (d) Find the output of the following program:
SAMPLE PAPER 2010 SET I 3
void main()
{
GAME G={110,50};
Play(G,10);
cout<<G.Score<<":"<<G.Bonus<<endl;
Play(G);
cout<<G.Score<<":"<<G.Bonus<<endl;
Play(G,15);
cout<<G.Score<<":"<<G.Bonus<<endl;
}
Ans: (d) 3
111:60
112:70
113:85
(1 Mark for each correct line of output)
14 (d) Find the output of the following
program: SAMPLE PAPER 2010 SET II 3
#include <iostream.h>
void Changethecontent(int Arr[ ], int Count)
{
for (int C=1;C<Count;C++)
Arr[C-1]+=Arr[C];
}
void main()
{
int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200};
Changethecontent(A,3);
14 (d) Find the output of the following
program: SAMPLE PAPER 2010 SET II 3
Changethecontent(B,4);
Changethecontent(C,2);
for (int L=0;L<3;L++) cout<<A[L]<<'#';
cout<<endl;
for (L=0;L<4;L++) cout<<B[L] <<'#';
cout<<endl;
for (L=0;L<2;L++) cout<<C[L] <<'#';
}
d)
7#9#5#
30#50#70#40#
2100#1200#
(1 Mark for each line of output)
15 SAMPLE PAPER 2012 SET I
15 SAMPLE PAPER 2012 SET I
16 SAMPLE PAPER 2012 SET II
16 SAMPLE PAPER 2012 SET II
17 (d) Find the output of the following
program:
SAMPLE PAPER 2009 SET I
3
#include <iostream.h>
struct PLAY
{ int Score, Bonus;};
void Calculate(PLAY &P, int N=10)
{
P.Score++;P.Bonus+=N;
}
void main()
{
PLAY PL={10,15};
Calculate(PL,5);
17 (d) Find the output of the following
program:
SAMPLE PAPER 2009 SET I
3
cout<<PL.Score<<”:”<<PL.Bonus<<endl;
Calculate(PL);
cout<<PL.Score<<”:”<<PL.Bonus<<endl;
Calculate(PL,15);
cout<<PL.Score<<”:”<<PL.Bonus<<endl;
}
18 (d) Find the output of the following
program:
SAMPLE PAPER 2009 SET II 3
#include <iostream.h>
void Changethecontent(int Arr[], int Count)
{
for (int C=1;C<Count;C++)
Arr[C-1]+=Arr[C];
}
18 (d) Find the output of the following
program:
SAMPLE PAPER 2009 3
void main()
{
int
A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200};
Changethecontent(A,3);
Changethecontent(B,4);
Changethecontent(C,2);
for (int L=0;L<3;L++)
18 (d) Find the output of the following
program:
SAMPLE PAPER 2009 SET II 3
cout<<A[L]<<’#’;
cout<<endl;
for (L=0;L<4;L++) cout<<B[L]
<<’#’;
cout<<endl;
for (L=0;L<2;L++) cout<<C[L]
<<’#’;
}
THANK
YOU

More Related Content

What's hot

Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Deepak Singh
 
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)Make Mannan
 
Object Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileHarjinder Singh
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101premrings
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14Matthieu Garrigues
 
CBSE Grade12, Computer Science, Sample Question Paper
CBSE Grade12, Computer Science, Sample Question PaperCBSE Grade12, Computer Science, Sample Question Paper
CBSE Grade12, Computer Science, Sample Question PaperMalathi Senthil
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQLvikram mahendra
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Aman Deep
 
Oops practical file
Oops practical fileOops practical file
Oops practical fileAnkit Dixit
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manualSANTOSH RATH
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical FileAshwin Francis
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYRadha Maruthiyan
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Saket Pathak
 
Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)MountAbuRohini
 

What's hot (20)

Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009
 
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
 
Object Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical FileObject Oriented Programming Using C++ Practical File
Object Oriented Programming Using C++ Practical File
 
C program
C programC program
C program
 
Qno 1 (c)
Qno 1 (c)Qno 1 (c)
Qno 1 (c)
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
CBSE Grade12, Computer Science, Sample Question Paper
CBSE Grade12, Computer Science, Sample Question PaperCBSE Grade12, Computer Science, Sample Question Paper
CBSE Grade12, Computer Science, Sample Question Paper
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQL
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
C questions
C questionsC questions
C questions
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
informatics practices practical file
informatics practices practical fileinformatics practices practical file
informatics practices practical file
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
 
Qno 1 (a)
Qno 1 (a)Qno 1 (a)
Qno 1 (a)
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)
 
Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)
 

Similar to Qno 1 (d)

Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Syed Umair
 
Assignement of c++
Assignement of c++Assignement of c++
Assignement of c++Syed Umair
 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011Deepak Singh
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual finalAhalyaR
 
Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Jaydip JK
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd StudyChris Ohk
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Syed Umair
 
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPERCLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPERRc Os
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1kvs
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacionJeff Tu Pechito
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfHIMANSUKUMAR12
 
please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...hwbloom27
 

Similar to Qno 1 (d) (20)

Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
 
Assignement of c++
Assignement of c++Assignement of c++
Assignement of c++
 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
pattern-printing-in-c.pdf
pattern-printing-in-c.pdfpattern-printing-in-c.pdf
pattern-printing-in-c.pdf
 
Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
 
Opp compile
Opp compileOpp compile
Opp compile
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd Study
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)
 
C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
C++ practical
C++ practicalC++ practical
C++ practical
 
C++ programs
C++ programsC++ programs
C++ programs
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPERCLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPER
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacion
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
 
please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...
 

More from Praveen M Jigajinni

Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithmsPraveen M Jigajinni
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructorsPraveen M Jigajinni
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programmingPraveen M Jigajinni
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with pythonPraveen M Jigajinni
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingPraveen M Jigajinni
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow chartsPraveen M Jigajinni
 

More from Praveen M Jigajinni (20)

Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
 
Chapter 08 data file handling
Chapter 08 data file handlingChapter 08 data file handling
Chapter 08 data file handling
 
Chapter 07 inheritance
Chapter 07 inheritanceChapter 07 inheritance
Chapter 07 inheritance
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructors
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
 
Chapter 03 python libraries
Chapter 03 python librariesChapter 03 python libraries
Chapter 03 python libraries
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
 
Unit 3 MongDB
Unit 3 MongDBUnit 3 MongDB
Unit 3 MongDB
 
Chapter 17 Tuples
Chapter 17 TuplesChapter 17 Tuples
Chapter 17 Tuples
 
Chapter 15 Lists
Chapter 15 ListsChapter 15 Lists
Chapter 15 Lists
 
Chapter 14 strings
Chapter 14 stringsChapter 14 strings
Chapter 14 strings
 
Chapter 13 exceptional handling
Chapter 13 exceptional handlingChapter 13 exceptional handling
Chapter 13 exceptional handling
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinking
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow charts
 
Chapter 5 boolean algebra
Chapter 5 boolean algebraChapter 5 boolean algebra
Chapter 5 boolean algebra
 
Chapter 4 number system
Chapter 4 number systemChapter 4 number system
Chapter 4 number system
 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

Qno 1 (d)

  • 1. XII CBSE Previous Year Question Paper QUESTION NO 1 (D) 2 or 3 Marks
  • 2. 1. (d) Find the output of the following program : Delhi 2006 3 #include<iostream.h> #include<string.h> class state { char *state_name; int size; public: state( ); { size=0; state_name=new char[size+1]; } state(char *s) Contd…
  • 3. { size = strlen(s) ; state_name = new char[size+1]; strcpy(state_name,s); } void display( ) {cout<<state_name<<endl;} void Replace (state & a, state & b) { size = a.size + b.size; delete state_name; state_name = new char[size+l]; strcpy(state_name, a.state_name); strcat(state_name, b.state_name); } }; contd…
  • 4. void main( ) { char * temp = “Delhi”; state state1 (temp), state2(“Mumbai”), state3(“Nagpur”), S1, S2; S1.Replace(state1, state2); S2. Replace(S1, state3); S1.display( ); S2.display( ); }
  • 5. Answer: (d) DelhiMumbai DelhiMumbaiNagpur (3 full marks for identifying error in definition of the constructor state() in Line 7) OR (3 marks for the correct lines of output) OR (2 marks for any one correct line of output) OR (1 Mark for showing the output starting with Delhi)
  • 6. 2 (d) Find the output of the following program : OD 2006 3 #include<iostream.h> #include<string.h> class student { char *name; int l; public: student() { l=0; name=new char[1+1]; } student(char *s) { l=strlen(s); name=new char[1+1]; strcpy (name,s); } contd…
  • 7. void display() { cout<<name<<endl;} void manipulate(student & a, student & b) { l=a.l + b.l; delete name; name=new char[l+l]; strcpy(name, a.name); strcat(name, b.name); } };
  • 8. void main() { char * temp =''Jack''; student name1(temp), name2('' Jill''), name3('' John'' ),S1,S2; S1.manipulate(name1,name2); S2.manipulate(S1,name3); S1.display(); S2.display(); }
  • 9. Answer : (d) JackJill JackJillJohn (2 marks for any one correct line) (Full 3 marks for both lines correct) (½ mark to be deducted from full 3 marks, if endl is not considered)
  • 10. 3 (d) Find the output of the following program : Delhi 2007 2 #include<iostream.h> void main() { int Numbers[] = {2,4,8,10}; int *ptr = Numbers; for (int C = 0; C<3; C++) { cout<< *ptr << “@”; ptr++; }
  • 11. 3 (d) Find the output of the following program : Delhi 2007 2 cout<<endl; for(C = 0; C<4; C++) { (*ptr)*=2; --ptr; } for(C = 0; C<4; C++) cout<< Numbers [C]<< “#”; cout<<endl; }
  • 12. (d) 2 @ 4 @ 8 @ 4 # 8 # 16 # 20 # (1 Mark for each correct line of output) Note: · ½ Mark to be deducted for missing symbols in each line of output · ½ Mark to be deducted if endl is not considered in the output · As Borland C++ Compiler declares for loop variable locally,the program will result in syntax errors. So, any studentspecifying Variable C not declared OR mentioning that the program will not RUN
  • 13. 4 (d) Find the output of the following program : OD 2007 2 # include < iostream.h> void main () { intArray[] = {4,6,10,12}; int *pointer = Array ; for (int I=1 ; I<=3 ; I++) { cout<<*pointer<<#”; pointer ++; }
  • 14. 4 (d) Find the output of the following program : OD 2007 2 cout<<endl; for (I=1 ; I<=4 ; I++) { (*pointer)*=3 ; -- pointer; } for(I=l; I<5; I + + ) cout << Array [I-1] << “@”; cout << endl; }
  • 15. (d) 4 # 6 # 10 # 12 @ 18 @ 30 @ 36 @ (1 Mark for each correct line of output) Note: · ½ Mark to be deducted for missing symbols in the output · ½ Mark to be deducted if endl is not considered in the output · As Borland C++ Compiler declares for loop variable locally,the program will result in syntax errors. So, any student specifying Variable I not declared OR mentioning that the program will not RUN due to incorrect syntax should be awarded full 2 Marks
  • 16. 5 (d) Find the output of the following program: Delhi 2008 3 #include<iostream.h> #include<ctype.h> void main ( ) { char Text [ ] = “Mind@Work!”; for (int I = 0; Text (I)! = ‘0’; 1++) { if (!isalpha (Text[I])) Text [I] = ‘*’; else if (isupper (Text[I])) Text [I] = Text [I] + 1 ;
  • 17. 5 (d) Find the output of the following program: Delhi 2008 3 Text [I] = Text [I] + 1 ; else Text (I) = Text [I+ 1]; } cout<<Text; }
  • 18. Ans: Nnd@*Xrk!* (½ Mark for N in the 1st position) (½ Mark for nd in the 2nd and 3rd position) (½ Mark for @ in the 4th position) (½ Mark for * in the 5th position) (½ Mark for Xrk!) (½ Mark for * at the end) 332 OR (Fu1l 3 Marks If error is mentioned in the code for Text (I) after last else)
  • 19. 6. (d) Find the output of the following program : OD 2008 3 #include<iostream.h> #include<ctype.h> void main ( ) { char Mystring[ ] =“What@OUTPUT!” ; for(int I = 0; Mystring [I] ! =’ 0'; I++) { if (!isalpha (Mystring[I])) Mystring [I] = ‘*’; else if (isupper (Mystring[I]))
  • 20. 6. (d) Find the output of the following program : OD 2008 3 Mystring [I] = Mystring[I] +1; else Mystring [I] = Mystring [I+1]; } cout<<Mystring; }
  • 21. Ans: Xat@*PVUQVU* (½ Mark for X in the first position) (½ Mark for at in the 2nd & 3rd positions) (½ Mark for @ in the 4th position) (½ Mark for * in the 5th position) (½ Mark for PVUQvu) (½ Mark for * at the end)
  • 22. 7 (d) Find the output of the following program : Delhi 2009 3 #include<iostream.h> void main ( ) { int X[ ] = {10, 25, 30, 55, 100}; int *p = X ; while ( *p < 110) { if (*p%3 ! = 0) *p = *p + 1 ; else *p = *p + 2 ;
  • 23. 7 (d) Find the output of the following program : Delhi 2009 3 p++; } for(int I = 4 ; 1>= 1 ; I - -) { cout << X[I] << “*” ; if ( I%3 = = 0) cout<<endl ; } cout<<X[0]*3<<endl ; }
  • 24. Ans 1110*56* 32*26*33 (½ Mark for each correct value) (½ Mark for all correct endl and *)
  • 25. 8 (d) Find the output of the following program: OD 2009 3 #include<iostream.h> void main ( ) { int A[ ] = {10, 15, 20, 25, 30} int *p = A; while (*p < 30) { if (*p%3 ! = 0) *p = *p + 2 ; else *p = *p + 1;
  • 26. 8 (d) Find the output of the following program: OD 2009 3 p++; } for (int J = 0; J<=4; J++) { cout << A[J] << “*” ; if ( J%3 = = 0) cout<<end1;
  • 27. Ans 12* 16*22*27* 30*90 (1 Mark for each line with correct values) Note: Deduct ½ Mark if any/all ‘*’ missing Deduct ½ Mark if endl is not considered at the right positions
  • 28. 9 (d) Find the output of the following program : Delhi 2010 3 #inc1ude <iostream.h> struct POINT {int X, Y, Z;}; void StepIn(POINT & P, int Step=1) { P.X+=Step; P.Y -=Step; P.Z+=Step; }
  • 29. 9 (d) Find the output of the following program : Delhi 2010 3 void StepOut(POINT & P, int Step=1) { P.X-=Step; P.Y+=Step; P.Z–=Step; }
  • 30. 9 (d) Find the output of the following program : Delhi 2010 3 void 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; }
  • 31. Ans. 16, 24, 6 6, 34, 16 18, 22, 28 (1 Mark for each line with -correct values) OR (½ Mark for any two correct values in each line) Note: Deduct (½ Mark if any/all ‘,’ missing Deduct (½ Mark if endl is not considered at the right positions
  • 32. 10 (d) Find the output of the following program: OD 2010 3 #include <iostream.h> struct THREE_D {int X,Y,Z;}; void MoveIn(THREE_D &T, int Step=l) } T.X+=Step; T.Y-=Step; T.Z+=Step }
  • 33. 10 (d) Find the output of the following program: OD 2010 3 void MoveOut(THREE_D &T, int Step=l) { T.X-=Step; T.Y+=Step; T.Z-=Step; }
  • 34. 10 (d) Find the output of the following program: OD 2010 3 void main () { THREE_D Tl={lO,20,5},T2={30,lO,40}; MoveIn(T1); MoveOut(T2,5); cout<<Tl.X<<“,”<<Tl.Y<<“,”<<T1.Z<<endl; cout<<T2.X<<“,”<<T2.Y<<“,”<<T2.Z<<endl; MoveIn(T2,l0); cout<<T2.X<<“,”<<T2.y<<“,”<<T2.Z<<endl; }
  • 35. Ans. 11, 19, 6 25, 15, 35 35, 5, 45 (1 Mark for each line with correct values) OR (½ Mark for any two correct values in each line) Note: Deduct ½ Mark if any/all ',' missing Deduct ½ Mark if endl is not considered at the right positions
  • 36. 11 (d) Find the output of the following program: Delhi 2011 3 #inc1ude<iostream.h> void ChangeArray(int Number, int ARR[ ], int Size) { for (int L =0; L<Size; L++) if (L<Number) ARR [L] +=L; e1se ARR [L] *=L; }
  • 37. 11 (d) Find the output of the following program: Delhi 2011 3 void Show (int ARR [ ], int Size) { for (int L=0; L<Size; L++) (L%2!=0) ?cout<<ARR[L] <<"#": cout<<ARR[L]<<end1 ; } void main ( ) { int Array [ ] = {30, 20, 40, 10, 60, 50}; ChangeArray (3, Array, 6) ; Show (Array, 6) ;
  • 38.
  • 39. 12 (d) Find the output of the following program: OD 2011 3 #include <iostream.h> void SwitchOver(int A [ ], int N, int Split) { for (int K=0 ; K<N; K++) if (K<Split) A(K]+ =K; else A [K]*=K; }
  • 40. 12 (d) Find the output of the following program: OD 2011 3 void Display (int A [ ], int N) { for (int K=0 ; K<N ; K++) (K%2==0)? cout<<A[K]<<"%":cout<<A(K]<<end1; } void main ( ) { int H[ ]= {30,40,50,20,10,5}; SwitchOver (H, 6, 3); Display (H, 6); }
  • 41.
  • 42. 13 (d) Find the output of the following program: SP 2010 SET I 3 #include <iostream.h> struct GAME { int Score, Bonus;}; void Play(GAME &g, int N=10) { g.Score++;g.Bonus+=N; }
  • 43. 13 (d) Find the output of the following program: SAMPLE PAPER 2010 SET I 3 void main() { GAME G={110,50}; Play(G,10); cout<<G.Score<<":"<<G.Bonus<<endl; Play(G); cout<<G.Score<<":"<<G.Bonus<<endl; Play(G,15); cout<<G.Score<<":"<<G.Bonus<<endl; }
  • 44. Ans: (d) 3 111:60 112:70 113:85 (1 Mark for each correct line of output)
  • 45. 14 (d) Find the output of the following program: SAMPLE PAPER 2010 SET II 3 #include <iostream.h> void Changethecontent(int Arr[ ], int Count) { for (int C=1;C<Count;C++) Arr[C-1]+=Arr[C]; } void main() { int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200}; Changethecontent(A,3);
  • 46. 14 (d) Find the output of the following program: SAMPLE PAPER 2010 SET II 3 Changethecontent(B,4); Changethecontent(C,2); for (int L=0;L<3;L++) cout<<A[L]<<'#'; cout<<endl; for (L=0;L<4;L++) cout<<B[L] <<'#'; cout<<endl; for (L=0;L<2;L++) cout<<C[L] <<'#'; }
  • 48. 15 SAMPLE PAPER 2012 SET I
  • 49. 15 SAMPLE PAPER 2012 SET I
  • 50. 16 SAMPLE PAPER 2012 SET II
  • 51. 16 SAMPLE PAPER 2012 SET II
  • 52. 17 (d) Find the output of the following program: SAMPLE PAPER 2009 SET I 3 #include <iostream.h> struct PLAY { int Score, Bonus;}; void Calculate(PLAY &P, int N=10) { P.Score++;P.Bonus+=N; } void main() { PLAY PL={10,15}; Calculate(PL,5);
  • 53. 17 (d) Find the output of the following program: SAMPLE PAPER 2009 SET I 3 cout<<PL.Score<<”:”<<PL.Bonus<<endl; Calculate(PL); cout<<PL.Score<<”:”<<PL.Bonus<<endl; Calculate(PL,15); cout<<PL.Score<<”:”<<PL.Bonus<<endl; }
  • 54.
  • 55. 18 (d) Find the output of the following program: SAMPLE PAPER 2009 SET II 3 #include <iostream.h> void Changethecontent(int Arr[], int Count) { for (int C=1;C<Count;C++) Arr[C-1]+=Arr[C]; }
  • 56. 18 (d) Find the output of the following program: SAMPLE PAPER 2009 3 void main() { int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200}; Changethecontent(A,3); Changethecontent(B,4); Changethecontent(C,2); for (int L=0;L<3;L++)
  • 57. 18 (d) Find the output of the following program: SAMPLE PAPER 2009 SET II 3 cout<<A[L]<<’#’; cout<<endl; for (L=0;L<4;L++) cout<<B[L] <<’#’; cout<<endl; for (L=0;L<2;L++) cout<<C[L] <<’#’; }
  • 58.