XII CBSE Previous Year Question Paper QUESTION NO 1 (b) 1 OR 2 Marks.

Slides:



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

Pemrograman C Risanuri Hidayat. Why C  Compact, fast, and powerful  “Mid-level” Language  Standard for program development (wide acceptance)  It is.
CSE202: Lecture 1The Ohio State University1 Introduction to C++
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 17 - The Preprocessor Outline 17.1Introduction 17.2The #include Preprocessor Directive 17.3The.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction.
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
CS 117 Spring 2002 Review for Exam 3 arrays strings files classes.
Inline Function. 2 Expanded in a line when it is invoked Ie compiler replace the function call with function code To make a function inline the function.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 19 - The Preprocessor Outline 19.1 Introduction 19.2 The #include Preprocessor Directive 19.3.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 12 - The Preprocessor Directives (Macros)
XII CBSE Previous Year Question Paper QUESTION NO 2 (b) 2 Marks.
A First Book of C++: From Here To There, Third Edition2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single.
Macros. There are three basic phases for C programming. preprocessing, compiling, and linking. C input file is first passed to a preprocessing program.
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.
XII CBSE Previous Year Question Paper QUESTION NO 1 (E) 2 or 3 Marks.
C Hints and Tips The preprocessor and other fun toys.
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
Fundamentals of C and C++ Programming. EEL 3801 – Lotzi Bölöni Sub-Topics  Basic Program Structure  Variables - Types and Declarations  Basic Program.
Functions Modules in C++ are called functions and classes Functions are block of code separated from main() which do a certain task every C++ program must.
Chapter 4: Subprograms Functions for Problem Solving Mr. Dave Clausen La Cañada High School.
CSCI 171 Presentation 8 Built-in Functions, Preprocessor Directives, and Macros.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessing Lecture 12 April 7, 2005.
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessor Midterm Review Lecture 7 Feb 17, 2004.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
EEL 3801 C++ as an Enhancement of C. EEL 3801 – Lotzi Bölöni Comments  Can be done with // at the start of the commented line.  The end-of-line terminates.
THE PREPROCESSOR
Introduction to C++.  Computers: CPU, Memory & Input / Output (IO)  Program: Sequence of instructions for the computer.  Operating system: Program.
The Preprocessor Directives Introduction Preprocessing – Occurs before program compiled Inclusion of external files Definition of symbolic constants.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
1 Object-Oriented Programming -- Using C++ Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
CSE1222: Lecture 1The Ohio State University1. Computing Basics  Computers CPU, Memory & Input/Output (IO)  Program Sequence of instructions for the.
Lecturer: Nguyen Thi Hien Software Engineering Department Home page: hienngong.wordpress.com Chapter 2: Language C++
CSC1201: Programming Language 2 1 Functions. 2 Function declaration: return_type FuncName( Type arg1, Type arg2,….. Type argN) { function body } A program.
Unary, Binary, logical Operations, Explicit type conversion Lecture 6 Instructor: Haya Sammaneh.
Functions Modules in C++ are called functions and classes. Main reason to use functions is : – get aid in conceptual organization.
XII CBSE Previous Year Question Paper QUESTION NO 1 (D) 2 or 3 Marks.
Chapter 1.2 Introduction to C++ Programming
‘C’ Programming Structures and Commands
Chapter 1.2 Introduction to C++ Programming
Introduction to Programming
Chapter 1.2 Introduction to C++ Programming
Topic Pre-processor cout To output a message.
Chapter 1.2 Introduction to C++ Programming
Chapter 2: Introduction to C++
Functions, Part 2 of 2 Topics Functions That Return a Value
Chapter 13 - The Preprocessor
BASIC ELEMENTS OF A COMPUTER PROGRAM
Functions Separate Compilation
14. THE PREPROCESSOR.
C Short Overview Lembit Jürimägi.
Programming Fundamentals Lecture #7 Functions
Pre-processor Directives
2008/11/10: Lecture 16 CMSC 104, Section 0101 John Y. Park
جامعة البحر الاحمر كلية العلوم التطبيقية قسم الفيزياء التطبيقية الفصل الداسي الثاني IIالمقرر: حاسوب د. خالد عثمان العالم.
Introduction to Programming
CSC1201: Programming Language 2
جامعة البحر الاحمر كلية العلوم التطبيقية قسمي الحاسوب وتقنية المعلومات الفصل الداسي الثاني المقرر: اساليب برمجة 1 محاضرة رقم 1 د. خالد عثمان العالم.
Functions, Part 2 of 3 Topics Functions That Return a Value
C Preprocessor Seema Chandak.
A First Program.
CSC1201: Programming Language 2
Functions, Part 2 of 3 Topics Functions That Return a Value
Functions, Part 2 of 3 Topics Functions That Return a Value
Presentation transcript:

XII CBSE Previous Year Question Paper QUESTION NO 1 (b) 1 OR 2 Marks

1 (b) Illustrate the use of #define in C++ to define a macro Delhi ANS: #define is a preprocessor directive that is used to define a symbolic constant. The symbolic constant defined, replaces the word / statement wherever it appears in the program as a macro substitution. Syntax : #define symbolic_name value Example: #define Pi 3.14 #define WELCOME cout<<”Hello World !\n”; (Full 2 marks for illustrating the concept of #define using example) OR (1 mark if only definition is written)

2 1( b) Illustrate the use of inline function in C++ with the help of an example Outside Delhi The inline functions are a C++ enhancement designed to speed up the program. The coding of normal function and inline functions is similar except that inline functions definition starts with keyword inline. The compiler replaces the function call statement with the function code itself this process is called as expansion and then compiles the entire code. For example: void main() { …..……. square(3); code copied here{ cout<<3 *3 } ……………. square(5); code copied here {cout<<5 * 5; }}

3 1(b) Name the header file(s) that shall be needed for successful compilation of the following C++ code : Delhi void main( ) { char Text[40]; strcpy(Text, ”AISSCE”); puts(Text); }

3 1(b)2007 D ANS: (b) string.h stdio.h (½ Mark for identifying each correct header file) Note: Marks are not to be deducted if any additional header file is mentioned

4 1(b)Name the header file(s) that shall be needed for successful compilation of the following C++ code.2007 Outside Delhi void main ( ) { char String [20]; gets (String); strcat (String, “CBSE”); puts (String); }

4 1(b) 2007 Outside Delhi ANS: (b) string.h stdio.h (½ Mark for identifying each correct header file) Note: Marks are not to be deducted if any additional header file is mentioned

5 1(b) Name the header files that shall be needed for the following code Delhi void main ( ) { char String [ ] = “Peace”; cout<<setw (20) << String; } Ans: iostream.h iomanip.h (½ Mark for identifying each correct header file) Note: Ignore any other header files, if mentioned

6 1 (b) Name the header files that shall be needed for the following code: Out side Delhi void main ( ) { char Word [ ] =”Exam”; cout<<setw(20)<<Word; } Ans: iostream.h iomanip.h (½ Mark for identifying each correct header file) Note: Ignore any other header files, if mentioned

7 1 (b) Write the names of the header files to which the following belong: Delhi (i) puts( ) (ii) sin( ) Ans (i) stdio.h (ii) math. h (½ Mark for writing each correct header file)

8 1 (b) Write the names of the header files to which the following belong: Outside Delhi (i) setw( ) (ii) sqrt( ) Ans (i) iomanip.h (ii) math.h (½ Mark for writing each correct header file)

9 1 (b) Which C++ header file(s) will be essentially required to be included to run/execute the following C++ code? Delhi void main( ) { int Eno=123, char Ename[ ]=”Rehan Swamp”; cout<<setw(5)<<Eno<<setw(25)<<EName<<endl; Ans. (i) iostream.h (ii) iomanip.h OR iomanip.h - (As iostream.h is included in iomanip.h) (½ Mark for writing each correct header file) OR (Full 1 Mark for mentioning only iomanip.h ) Note: Ignore any other header files, if mentioned.

10 1(b) Which C++ header file(s) will be essentially required to be included to run/ execute the following C++ code: Outside Delhi void main() { int Rno=24; char Name[] =”Amen Singhania”; cout<<setw(lO)<<Rno<<setw(20)<<Name<<endl; } Ans. (i) iostream.h (ii) iomanip.h OR iomanip.h - (As iostream.h is included in iomanip.h) (½ Mark for writing each correct header file) OR (Full 1 Mark for mentioning only iomanip.h ) Note: Ignore any other header files, if mentioned.

11 1(b) Write the names of the header files, which is/are essentially required to run/ execute the following C++ code: Delhi void main ( ) { char C, String [ ] = "Excellence Overload"; for (int I=0; String [ I ] ! = '\ 0'; I ++ ) if (String [I] ==' ') cout<<end1; else { C=toupper(String[I]); cout<<C ; }

11 1(b)2011 Delhi Ans iostream.h ctype.h (½ Mark for writing each correct header file)

12 (b) Write the names of the header files, which is/are essentially required to run/ execute the following c++ code: Outside Delhi void main ( ) { char CH,Text[ ] ="+ve Attitude"; for (int I=0 ; Text[I] ! ='\0' ;I++) if (Text[I]== ' ') cout<<end1; else { CH=toupper (Text [I]) ; cout<<CH; }

12 (b) Write the names of the header files, which is/are essentially required to run/ execute the following c++ code: Outside Delhi Ans iostream.h ctype.h (½ Mark for writing each correct header file)

13 1(b) Write the names of the header files to which the following belong: 1 Sample paper 2009 Set I (i)strcmp() (ii)fabs() ANS (b) (i) string.h (ii) math.h ( ½ Mark for mentioning each correct header filename)

14 1(b) Write the names of the header files to which the following belong: 1 Sample paper 2009 Set II (i)frexp() (ii)isalnum() ANS (b) (i) math.h (ii) ctype.h ( ½ Mark for mentioning each correct header filename)

15 (b) Which C++ header file(s) will be essentially required to be included to run /execute the following C++ code: Sample Paper Set I void main() { char Msg[ ]="Sunset Gardens"; for (int I=5;I<strlen(Msg);I++) puts(Msg); } ANS (b) (i) string.h (ii) stdio.h ( ½ Mark for mentioning each correct header filename)

16 (b) Write the names of the header files to which the following belong: Sample Paper Set II (i) frexp() (ii) isalnum() ANS : (b) (i) math.h (ii) ctype.h ( ½ Mark for mentioning each correct header filename)

17 (b) Which C++ header file(s) are essentially required to be included to run/execute the following C++ code: 1 Sample paper 2012 Set I void main ( ) { int Last =25 ; for ( int C=9 ; C <= Last ; C ++ ) cout<< C << “ : “ <<sqrt ( C ) <<endl; } ANS : (b) (i) iostream.h ( for cout ) (ii) math.h (for sqrt) ( ½ Mark for mentioning each correct header filename)

18 (b) Write the names of the header files to which the following belong: Sample Paper Set II (i) exp() (ii) strcmpi() ANS : (b) (i) math.h (ii) string.h ( ½ Mark for mentioning each correct header filename)

19 (b) Which of the header file(s) are essentially required to be included to run / execute the following C++ source code. (Note: Do not include any header file which is / are not required ) Outside Delhi void main ( ) { char TEXT [ ] = “Something” ; cout<< “Remaining SMS Chars : “ << 160-strlen(TEXT)<<endl; ANS : (b) (i) iostream.h (for cout)(ii) string.h (for strlen ( ) ) ( ½ Mark for mentioning each correct header filename)

THANK YOU