XII CBSE Previous Year Question Paper QUESTION NO 1 (E) 2 or 3 Marks.

Slides:



Advertisements
Similar presentations
XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.
Advertisements

Programming Functions: Passing Parameters by Reference.
C Strings. The char Data Type for Storing Characters The char data type can is used to declare a variable that can hold a single character. Examples:
 Monday, 9/30/02, Slide #1 CS106 Introduction to CS1 Monday, 9/30/02  QUESTIONS (on HW02, etc.)??  Today: Libraries, program design  More on Functions!
Arrays Hanly - Chapter 7 Friedman-Koffman - Chapter 9.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation –The new operator –The delete operator –Dynamic.
XII CBSE Previous Year Question Paper QUESTION NO 2 (a) 2 Marks.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Programming in C++ Lecture Notes 6 Void Functions (Procedures) Andreas Savva.
XII CBSE Previous Year Question Paper QUESTION NO 2 (b) 2 Marks.
Recursion Chapter Nature of Recursion t Problems that lend themselves to a recursive solution have the following characteristics: –One or more.
Modular Programming Chapter Value and Reference Parameters computeSumAve (x, y, sum, mean) ACTUALFORMAL xnum1(input) ynum2(input) sumsum(output)
Selection Statements in C++ If Statement in C++ Semantics: These statements have the same meaning as in the algorithmic language. 2- Two way selection:
M. Taimoor Khan #include void main() { //This is my first C++ Program /* This program will display a string message on.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
XII CBSE Previous Year Question Paper QUESTION NO 1 (a) 1 OR 2 Marks.
COMP104B Introduction to Comp Sci 2 Introduction and Revision 1.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan Snd Term Nouf Aljaffan (C) CSC 1201 Course at KSU1.
1 C++ Programming Basics Chapter 2 Lecture CSIS 10A.
Chapter: 01 C++ Revision Tour
XII CBSE Previous Year Question Paper QUESTION NO 3 (a) 3 Marks.
CSE 201 – Elementary Computer Programming 1 Extra Exercises Source: Suggested but not selected midterm questions.
Fundamental Programming: Fundamental Programming Introduction to C++
COMPUTER PROGRAMMING. Functions’ review What is a function? A function is a group of statements that is executed when it is called from some point of.
Scope When we create variables and functions, they are limited in where they are visible and where they can be referenced For the most part, the identifiers.
Chapter 13 – C++ String Class. String objects u Do not need to specify size of string object –C++ keeps track of size of text –C++ expands memory region.
XII CBSE Previous Year Question Paper QUESTION NO 1 (b) 1 OR 2 Marks.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan (C) CSC 1201 Course at KSU1.
Data Types Declarations Expressions Data storage C++ Basics.
Data Structures & Algorithms
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
1 Cannon_Chapter9 Strings and the string Class. 2 Overview  Standards for Strings  String Declarations and Assignment  I/O with string Variables 
CHAPTER 2 C++ SYNTAX & SEMANTICS #include using namespace std; int main() { cout
Homework #4: Operator Overloading and Strings By J. H. Wang Apr. 17, 2009.
Review for Final Exam. Contents 5 questions (20 points each) + 1 bonus question (20 points) – Basic concepts in Chapters 1-4 – Chapters 5-9 – Bonus: Chapter.
Programming Fundamentals. Summary of previous lectures Programming Language Phases of C++ Environment Variables and Data Types.
LINKED LISTS Midwestern State University CMPS 1053 Dr. Ranette Halverson 1.
1 Huffman Codes Drozdek Chapter Encoding Next we will add the capability to encode a message entered as normal text. The Huffman Tree that we use.
CS Class 15 Today  More practice with arrays  Introduction to Multi-dimensional arrays Announcements  Programming project #4 due 10/23 by midnight.
XII CBSE Previous Year Question Paper QUESTION NO 1 (F) 2 or 3 Marks.
Fundamental Programming Fundamental Programming More Expressions and Data Types.
Programming Fundamentals by Dr. Nadia Y. Yousif1 Control Structures (Selections) Topics to cover here: Selection statements in the algorithmic language:
Extra Recitations Wednesday 19:40-22:30 FENS L055 (tomorrow!) Friday 13:40-16:30 FENS L063 Friday 17: :30 FENS L045 Friday 19:40-22:30 FENS G032.
 Memory setup  Pointer declaration  Address operator  Indirection  Printing addresses or pointers.
Objective Write simple computer program in C++ Use simple Output statements Become familiar with fundamental data types.
Arrays An array is a sequence of objects all of which have the same type. The objects are called the elements of the array and are numbered consecutively.
XII CBSE Previous Year Question Paper QUESTION NO 1 (D) 2 or 3 Marks.
REEM ALAMER REVISION FOR C LANGUAGE COURSE. OUTPUTS int main (void) { int C1, C2; int *p1, *p2; C1 = 8; p1 = &C1; C2 = *p1 / 2 + 5; p2 = &C2; printf ("C1.
Constants, Data Types and Variables
Basic concepts of C++ Presented by Prof. Satyajit De
Chapter 1.2 Introduction to C++ Programming
Variables Mr. Crone.
Pointers & Arrays 1-d arrays & pointers 2-d arrays & pointers.
Command Line Arguments
School of EECS, Peking University
Method Mark and Lyubo.
CS 1430: Programming in C++ Turn in your Quiz1-2 No time to cover HiC.
Arrays November 8, 2017.
Review for Final Exam.
Chapter 2.2 Control Structures (Iteration)
Variables T.Najah Al_Subaie Kingdom of Saudi Arabia
CS150 Introduction to Computer Science 1
Review for Final Exam.
Fundamental Programming
Programming Strings.
Reading from and Writing to Files Part 2
Functions Chapter No. 5.
Presentation transcript:

XII CBSE Previous Year Question Paper QUESTION NO 1 (E) 2 or 3 Marks

1 (e) Find the output of the following program : Delhi #include void main( ) { long NUM= ; int F=0, S=0; do { int Rem = NUM% 10 ; if (Rem % 2 !=0) F+=R; else S+=R; NUM /=10; }while(NUM>0); cout<<F-S; }

Ans: (e) 2 (assuming R as Rem) (2 marks for correct output as 2) OR (2 marks for identifying error as R is not declared) OR (Full 2 marks to be awarded to the students who have scored at least 1 mark in the entire Q. No. 1 i.e. from 1(a) to 1(f))

2 (e) Find the output of the following program : OD #include void main() { long Number = ; int First=0, Second=0; do { int R = Number%10; if(R%2==0) First+=R; else Second+=R; Number /=10; }while(Number>0); cout<<First-Second; }

(e) -2 (Full 2 marks for correct output) OR (Full 2 marks for mentioning values of First as 14 and Second as 16, as representation of minus sign is not very prominent) OR (Full 2 marks for mentioning syntax error with justification as insertion operator << expected in between First and Second)

3 (e) Find the output of the following program : Delhi #include void Indirect(int Temp=20) { for (int 1=10; I<=Temp; I+=5) cout<<I<<”, “ ; cout<<endl; } void Direct (int &Num) { Num+=10; Indirect(Num); }

3 (e) Find the output of the following program : Delhi void main() { int Number=20; Direct(Number) ; Indirect(); cout<< “ Number=” <<Number<<endl ; }

(e) 10, 15, 20, 25, 30, 10, 15, 20, Number=30 (1 Mark for each correct line of output) Note: · ½ Mark to be deducted for missing Commas (,) in each line of output · ½ Mark to be deducted if endl is not considered in the output

4 (e) Find the output of the following program : OD # include void Withdef (int HisNum = 30) { for (int 1=20 ; I<*= HisNum; I+=5) cout<<I<<””; cout<<endl; } void Control (int &MyNum) { MyNum+=10; Withdef(MyNum); }

4 (e) Find the output of the following program : OD void main () { int YourNum=20; Control (YourNum); Withdef(); cout<<”Number=”<<YourNum<<endl; }

(e) 20,25,30, Number=30 (1 Mark for each correct line of output) Note: · ½ Mark to be deducted for missing Commas (,) in the output · ½ Mark to be deducted if endl is not considered in the output

5 (e) Find the output of the following program: Delhi #include void main ( ) { int U = 10, V = 20; for (int I = 1; 1 < = 2; 1++) { cout<<“[1]=”<<U++<<“&”<<V–5<<endl; cout<<“[2]=”<<++V<<“&”< <U+ 2< <endl; }

Ans: (½ Mark for N in the 1st position) (½ Mark for nd in the 2nd and 3rd position) (½ Mark in the 4th position) (½ Mark for * in the 5th position) (½ Mark for Xrk!) (½ Mark for * at the end) OR (Fu1l 3 Marks If error is mentioned in the code for Text (I) after last else)

6 (e) Find the output of the following program : OD #include void main ( ) { int A=5, B=10; for (int I = 1; I<=2; 1++) { cout<< “Linel=”<<A++<<“&”<<B–2<<endl; cout<<“Line2=”<<++B<<“&”<<A+3<<endl; }

Ans: Line1=5&8 Line2=11&9 Line1=6&9 Line2=12&10 (½ Mark for each correct line of output) Note:. ½ Mark to be deducted for missing Ampersand (&) in each line of output ½ Mark to be deducted if endl is not considered in the output

7 (e) Find the output of the following program : Delhi #include void Encode (char Info [ ], int N) ; void main ( ) { char Memo [ ] = “Justnow” ; Encode(Memo, 2) ; cout<<Memo<<endl ; }

7 (e) Find the output of the following program : Delhi void Encode(char Info[ ], int N) { for (int I = 0 ; Info[I] != ‘\0’ ; 1++) if (1%2= =0) Info[I] = Info[I] –N ; else if (islower(Info[I])) Info[I] = toupper(Info[I]) ; else Info[I] = Info[I] +N ; }

Ans HuqTlOu (½ Mark for writing H, U as the first two characters) (½ Mark for writing q, T as the next two characters) (½ Mark for writing 1, O as the next two characters) (½ Mark for writing u as the last character)

8 (e) Find the output of the following program: OD #include void Secret (char Mig [ ], int N); void main ( ) { char SMS[ ] = “rEPorTmE” ; Secret{SMS,2); cout<<SMS<<end1; }

8 (e) Find the output of the following program: OD void Secret(char Msg[ ], int N) { for (int C=0; Msg[C] ! =’ \0' ;C++) if (C%2==0) Msg[C] = Msg[C]+N; else if (isupper(Msg[C])) Msg[C] = tolower(Msg[C]); else Msg[C] = Msg[C]-N; }

Ans teRmttoe (½ Mark for writing t,e as the first two characters) (½ Mark for writing R,m as the next two characters) (½ Mark for writing t,t as the next two characters) (½ Mark for writing o,e as the next two characters)

9 (e) Find the output of the following program : Delhi #include void ChangeIt(char Text[ ], char C) { for (int K=0;Text[K]!='\0';K++) { if (Text[K]>=’F’ && Text[K]<=’L’) Text[K]=tolower(Text[K]); else if (Text[K]=’E’ || Text[K]==’e’) Text[K]= =C;

9 (e) Find the output of the following program : Delhi else if (K%2==O) Text[K]=toupper(Text[K]); else Text[K]=Text[K-l]; }

9 (e) Find the output of the following program : Delhi void main ( ) { char OldText[ ]=”pOwERALone”; ChangeIt(OldText,’%’); cout<<“New TEXT:”<<OldText<<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 (e) Find the output of the following program: OD #include void MyCode (char Msg [], char CH) { for (int (Cnt=O;Msg[Cnt]!=’\0';Cnt++) { if (Msg[Cnt]>=’B’ && Msg[Cnt]<=’G’) Msg[Cnt]=tolower(Msg[Cnt]); else if (Msg[Cnt]==’A’|| Msg[Cnt]==’a’) Msg[Cnt]=CH;

10 (e) Find the output of the following program: OD else if (Cnt%2==0) Msg[Cnt]=toupper(Msg[Cnt]); else Msg[Cnt]=Msg[Cnt-l]; } void main () { char MyText [] =” ApEACeDriVE”; cout<<“NEW TEXT:”<<MyText<<endl; }

Ans. NEW TEXT (½ Mark for writing as the first three characters) (½ Mark for as the next three characters) (½ Mark for writing d,d, I as the next three characters) (½ Mark for writing I,e as the next two characters) Note: Deduct ½ Mark for not mentioning NEW TEXT:

11 (e) Find the output of the following program: Delhi #include void main ( ) { int Track [ ] = {10, 20, 30, 40}, *Striker ; Stxiker=Track : Track [1] += 30 ; cout "<<*Striker<<end1 ; Striker – =10 ; Striker++ ; ; Striker+=2 ; ; cout<< "Reset To" <<Track[0] <<end1 ; }

Ans Striker>10 Reset to 0 (½ for writing each line of output correctly) Note: Deduct ½ Mark if any/all special characters are missing Deduct ½ Mark if endl is not considered at the right positions

12 (e) Find the output of the following program: OD #include void main ( ) { int *Queen, Moves [ ] = {11, 22, 33, 44}; Queen = Moves; Moves [2] + = 22; cout<< *Queen - = 11; Queen + = 2; cout<< Queen++; cout<< cout<< "New }

Ans New (½ Mark for writing each line of output correctly) Note: Deduct ½ Mark if any/all missing or/and endl is not considered at the right positions

13 (e) Find the output of the following program: SAMPLE PAPER 2009 SET I2 #include void Encrypt(char T[]) { for (int i=0;T[i]!='\0';i+=2) if (T[i]=='A' || T[i]=='E') T[i]='#'; else if (islower(T[i])) T[i]=toupper(T[i]); else }

13 (e) Find the output of the following program: SAMPLE PAPER 2009 SET I2 void main() { char Text[]="SaVE EArtH";//The two words in the string Text //are separated by single space Encrypt(Text); cout<<Text<<endl; }

Answer: (1 Mark for writing all alphabets at correct positions) (1/2 Mark for at correct positions) (1/2 Mark for writing # at correct position)

14 (e) Find the output of the following program: SAMPLE PAPER 2009 SET II 2 #include struct Game { char Magic[20];int Score; }; void main() { Game M={“Tiger”,500}; char *Choice;

14 (e) Find the output of the following program: SAMPLE PAPER 2009 SET II 2 Choice=M.Magic; Choice[4]=’P’; Choice[2]=’L’; M.Score+=50; cout<<M.Magic<<M.Score<<endl; Game N=M; N.Magic[0]=’A’;N.Magic[3]=’J’; N.Score-=120; cout<<N.Magic<<N.Score<<endl; }

Answer: TiLeP550 AiLJP430 (1 Mark for each line of output)

15 (e) Find the output of the following program: SAMPLE PAPER 2010 SET I 2 #include void Secret(char Str[ ]) { for (int L=0;Str[L]!='\0';L++); for (int C=0;C<L/2;C++) if (Str[C]=='A' || Str[C]=='E') Str[C]='#'; else { char Temp=Str[C];

15 (e) Find the output of the following program: SAMPLE PAPER 2010 SET I 2 Str[C]=Str[L-C-1]; Str[L-C-1]=Temp; } void main() { char Message[ ]="ArabSagar"; Secret(Message); cout<<Message<<endl; }

ANS: #agaSbarr (2 Marks for correct line of output)

16 (e) Find the output of the following program: SAMPLE PAPER 2010 SET II2 #include struct Game { char Magic[20];int Score; }; void main() { Game M={"Tiger",500}; char *Choice;

16 (e) Find the output of the following program: SAMPLE PAPER 2010 SET II2 Choice=M.Magic; Choice[4]='P'; Choice[2]='L'; M.Score+=50; cout<<M.Magic<<M.Score<<endl; Game N=M; N.Magic[0]='A';N.Magic[3]='J'; N.Score-=120; cout<<N.Magic<<N.Score<<endl; }

ANS: TiLeP550 AiLJP430 (1 Mark for each line of output)

17 SAMPLE PAPER 2012 SET I

18 SAMPLE PAPER 2012 SET II

THANK YOU