CBSE eBooks CBSE Guess > eBooks > Class XII > Computer Science By . Mr. MRK
Chapter – 1 C++ Revision Tour 2004 Annual Paper: 1.b. Write the names of the header files to which the following belong: (i) gets( ) (ii) strcmp( ) (iii)abs( ) (iv)isalnum( ) Ans:
1.e. What will be the output of the following program #include<iostream.h> Ans: Output:
1. f. Write definition for a function SumSequence( ) in C++ with two arguments/ parameters – double X and int n. The function should return a value of type double and it should perform sum of the following series. 1/x- 3!/x + 5!/x – 7!/x + 9!/x - ------upto n terms. 2 3 4 5 #include<iostream.h> #include<conio.h> 2003 Annual Paper: 1.a. What is the difference between global variables and local variables? Give an example to illustrate the same. 2 Ans: The local variables are the variables defined within any function (or block) and are hence accessible only within the block in which they are declared. In contrast to local variables, variables declared outside of all the functions in a program are called global variables. These variables are defined outside of any function, so they are accessible to all functions. These functions perform various operations on the data. They are also known as External Variables. Eg: 1.b. Name the header file, to which the following built-in function belongs: (i) strcmp( ) (ii)getc( ) 1 Ans: (i) strcmp( ) - string.h (ii)getc( ) - stdio.h 1.c. Rewrite the following program after removing all the syntax error(s) if any. 2 #include<iostream.h> Ans: # include<iostream.h> 1.e. Write the output of the following program: #include<iostream.h> Ans:
|