PREBOARD – I 2011-12 KENDRIYA VIDYALAYA NO. 1, RAIPUR CLASS - XII (COMPUTER Sc.) Time Allowed : 3 hours Maximum Marks : 70 Note : (i) All questions are compulsory. (ii) Programming Language : C++ 1. (a) What do you understan d by actual arguments and formal arguments? Give one example to illustrate the both. 2 (b) Read The following code and answer the questions (i) & (ii) 1 void main() { char Name[20]; int RollNo = 20; cin>>Name; puts(Name); cout<<RollNo; } (i)What are the header files to be included? (ii)If the value of Name to be given during program execution is Good One, What is the output? (c) Rewrite the following program after removi ng the syntactical errors (if any). Underline each correction. 2 #include[iostream.h] typedef char Text(80) ; void main ( ) { Text T= "Indian"; int Count=strlen(T) ; cout<<T<<'has'<<Count<< 'characters' <<end1; } (d) Find the output of the following program: 3 #include<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; } 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}; ChangeArra y (3, Array, 6) ; Show (Array, 6) ; }
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
(i) Which type of inheritance is illustrated in the above C++ code?
(ii) Write the names of the all data members, which is/are accessible from member function
Commence of class Course.
(iii) Write the names of member functions, which are accessible from objects of class Course.
(iv) Write the name of all the members, which are accessible from objects of class Faculty.
3.(a) Write a function in C++ that takes an array of 12 numbers as arguments and interchange
each two numbers with next two number as given in example:
eg if the initial array is as follows : 3
3 23 5 8 50 43 78 32 11 22 51 33
then after rearrangement array should be
5 8 3 23 78 32 50 43 51 33 11 22
(b) An array P[20] [50] is stored in the memory along the column with each of its element
occupying 4 bytes, find out the 1ocation of P[15][10], if P[0][0] is stored at 5200. 3(c) Write a function in c++ to insert a new element in a dynamically allocated Stack
containing names of Countries. 4
(d) Define a function SUM2COL ( ) in C++ to return sum the first and last column
elements for a two dimensional integer array passed as the argument of the function. 2
(e) Evaluate the following postfix notation of expression: 2
(Show status of Stack after each operation)
False, True, NOT, OR, True, False, AND, OR
4. (a) Observe the program segment given below carefully and fill the blanks in Statement 1
and Statement 2 using seekg() and tellg() functions for performing the required task. 1
#include <fstream.h>class Employee
{ int Eno;char Ename[20];
public:
//Function to count the total number of records
int Countrec();
} ;
int Item::Countrec()
{ fstream File;
File.open(“EMP.DAT”,ios::binary|ios::in);
______________________ //Statement 1 (Places the pointer at end-of-file)
int Bytes = ____________________ //Statement 2 (Returns current position of pointer)
int Count = Bytes / sizeof(Item);
File.close();
return Count;
}
(b) Write a function in C++ to count the no. of "Me" or "My" words present in a text file