Exam Paper Print – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
Exam Paper: CBSE-Class 12th-Comp. Sc.-2017-Delhi (CPP) No. of Q.28
Q.01A 2

Write the type of C++ tokens (keywords and user defined identifiers) from the
following:
(i) For
(ii) delete
(iii) default
(iv) Value



Q.01B 1

Anil typed the following C++ code and during compilation he found four errors as follows:
(i) Function strlen should have a prototype
(ii) Undefined symbol cout
(iii) Undefined symbol endl
(iv) Function getchar should have a prototype
On asking his teacher told him to include necessary header files in the code.
Write the names of the header files, which Anil needs to include, for successful compilation and execution of the following code:

void main()
{
  char S[] = "Hello";
  for(int i = 0; i<strlen(S); i++)
  S[i] = S[i]+1;
    cout<<S<<endl;
  getchar();
}


Q.01C 2

Rewrite the following C++ code after removing any/all syntactical errors with each correction underlined.
Note: Assume all required header files are already being included in the program.

void main()
{
  cout<<"Enter an integer";
  cin>>N;
  switch(N%2)
  case 0 cout<<"Even"; Break;
  case 1 cout<<"Odd" ; Break;
}


Q.01D 2

Find and write the output of the following C++ program code:
Note: Assume all required header files are already included in the program.

#define Big(A,B) (A>B)?A+1:B+2
void main()
{
  char W[] = "Exam";
  int L=strlen(W);
  for(int i =0; i<L-1; i++)
     W[i] = Big(W[i],W[i+1]);
  cout<<W<<endl;
}


Q.01E 3

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program .

void main()
{
  int A[]={10,12,15,17,20,30};
  for(int i = 0; i<6; i++)
  {
    if(A[i]%2==0)
    A[i] /= 2;
    else if(A[i]%3==0)
    A[i] /= 3;
    if(A[i]%5==0)
    A[i] /= 5;
  }
  for(i = 0; i<6; i++)
  cout<<A[i]<<"#";
}


Q.01F 2

Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum values that can be assigned to each of the variables R and C.
Note:
– Assume all the required header files are already being included in the code.
– The function random(n) generates an integer between 0 and n-1

void main()
{
  randomize();
  int R=random(3),C=random(4);
  int MAT[3][3] = {{10,20,30},{20,30,40},{30,40,50}};
  for(int I=0; I<R; I++)
  {
    for(int J=0; J<C; J++)
      cout<<MAT[I][J]<<" ";
    cout<<endl;
  }
}



Q.02A 2

Differentiate between private and public members of a class in context of Object Oriented Programming. Also give a suitable example illustrating accessibility/non-accessibility of each using a class and an object in C++.



Q.02B 2

Observe the following C++ code and answer the questions (i) and (ii).
Note: Assume all necessary files are included.

class EXAM
{
  long Code;
  char EName[20];
  float Marks;
public:
  EXAM()           //Member Function 1
  {
    Code=100;strcpy(EName,"Noname");Marks=0;
  }
  EXAM(EXAM &E)    //Member Function 2
{
  Code=E.Code+1;
  strcpy(EName,E.EName);
  Marks=E.Marks;
}
};
void main()
{
  ___________________     //Statement 1
  ___________________     //Statement 2
}

(i) Which Object Oriented Programming feature is illustrated by the Member Function 1 and Member Function 2 together in the class EXAM?

(ii) Write Statement 1 and Statement 2 to execute Member Function 1 and Member Function 2 respectively.



Q.02C 4

Write the definition of a class RING in C++ with following description:
Private Members
- RingNumber   // data member of integer type
- Radius       // data member of float type
- Area         // data member of float type
- CalcArea()   // Member function to calculate and assign
               // Area as 3.14 * Radius*Radius
Public Members
- GetArea()    // A function to allow user to enter values of
               // RingNumber and Radius. Also, this
               // function should call CalcArea() to calculate
               // Area
- ShowArea()   // A function to display RingNumber, Radius
               // and Area


Q.02D 4

Answer the questions (i) to (iv) based on the following:

class One
{
  int A1;
protected:
  float A2;
public:
  One();
  void Get1(); void Show1();
};
class Two : private One
{
  int B1;
protected:
  float B2;
public:
  Two();
  void Get2();
  void Show();
};
class Three : public Two
{
  int C1;
public:
  Three();
  void Get3();
  void Show();
};
void main()
{
  Three T;     //Statement 1
  __________________;  //Statement 2
}

(i) Which type of Inheritance out of the following is illustrated in the above example?
-Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance

(ii) Write the names of all the member functions, which are directly accessible by the object T of class Three as declared in main() function.

(iii) Write Statement 2 to call function Show() of class Two from the object T of class Three.

(iv) What will be the order of execution of the constructors, when the object T of class Three is declared inside main()?



Q.03A 3

Write the definition of a function Reverse(int Arr[], int N) in C++, which should reverse the entire content of the array Arr having N elements, without using any other array.
Example: if the array Arr contains

13 10 15 20 5

Then the array should become

5 20 15 10 13

NOTE:
-The function should only rearrange the content of the array.
-The function should not copy the reversed content in another array.
-The function should not display the content of the array.



Q.03B 2

Write definition for a function ADDMIDROW(int MAT[][10],int R,int C) in C++, which finds sum of the middle row elements of the matrix MAT (Assuming C represents number of Columns and R represents number of rows, which is an odd integer). For example, if the content of array MAT having R as 3 and C as 5 is as follows:

1 2 3 4 5
2 1 3 4 5
3 4 1 2 5

The function should calculate the sum and display the following:
Sum of Middle Row: 15



Q.03C 3

T[25][30] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 2 bytes, find the address of the element T[10][15], if the element T[5][10] is stored at the memory location 25000.



Q.03D 4

Write the definition of a member function ADDMEM() for a class QUEUE in C++, to add a MEMBER in a dynamically allocated Queue of Members considering the following code is already written as a part of the program.

struct Member
{
  int MNO;
  char MNAME[20];
  Member *Next;
};
class QUEUE
{
  Member *Rear,*Front;
public:
  QUEUE(){Rear=NULL;Front=NULL;}
  void ADDMEM();
  void REMOVEMEM();
  ~QUEUE();
};


Q.03E 2

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
P + ( Q – R ) * S / T



Q.04A 3

Aditi has used a text editing software to type some text. After saving the article as WORDS.TXT , she realised that she has wrongly typed alphabet J in place of alphabet I everywhere in the article.
Write a function definition for JTOI() in C++ that would display the corrected version of entire content of the file WORDS.TXT with all the alphabets “J” to be displayed as an alphabet “I” on screen .
Note: Assuming that WORD.TXT does not contain any J alphabet otherwise.
Example: If Aditi has stored the following content in the file WORDS.TXT :

WELL, THJS JS A WORD BY JTSELF. YOU COULD STRETCH THJS TO BE A SENTENCE

The function JTOI() should display the following content:

WELL, THIS IS A WORD BY ITSELF. YOU COULD STRETCH THIS TO BE A SENTENCE



Q.04B 2

Write a definition for function COUNTDEPT( ) in C++ to read each object of a binary file TEACHERS.DAT, find and display the total number of teachers in the department MATHS. Assume that the file TEACHERS.DAT is created with the help of objects of class TEACHERS, which is defined below:

class TEACHERS
{
  int TID; char DEPT[20];
public:
  void GET()
  {
    cin>>TID;gets(DEPT);
  }
  void SHOW()
  {
    cout<<TID<<":"<<DEPT<<endl;
  }
  char *RDEPT(){return DEPT;}
};


Q.04C 1

Find the output of the following C++ code considering that the binary file BOOK.DAT exists on the hard disk with a data of 200 books.

class BOOK
{
  int BID;char BName[20];
public:
  void Enter();void Display();
};
void main()
{
  fstream InFile;
  InFile.open("BOOK.DAT",ios::binary|ios::in);
BOOK B;
  InFile.seekg(5*sizeof(B));
  InFile.read((char*)&B, sizeof(B));
  cout<<"Book Number:"<<InFile.tellg()/sizeof(B) + 1;
  InFile.seekg(0,ios::end);
  cout<<" of "<<InFile.tellg()/sizeof(B)<<endl;
  InFile.close();
}


Section-C

Q. 05A 2

Observe the following table CANDIDATE carefully and write the name of the RDBMS operation out of (i) SELECTION (ii) PROJECTION (iii) UNION (iv) CARTESIAN PRODUCT, which has been used to produce the output as shown in RESULT ? Also, find the Degree and Cardinality of the RESULT.

TABLE: CANDIDATE

NO NAME STREAM
C1 AJAY LAW
C2 ADITI MEDICAL
C3 ROHAN EDUCATION
C4 RISHAB ENGINEERING

RESULT

NO NAME
C3 ROHAN


Q. 05B 6

Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables
TABLE : BOOK

Code BNAME TYPE
F101 The priest Fiction
L102 German easy Literature
C101 Tarzan in the lost world Comic
F102 Untold Story Fiction
C102 War Heroes Comic

TABLE: MEMBER

MNO MNANE CODE ISSUEDATE
M101 RAGHAV SINHA L102 2016-10-13
M103 SARTHAK JOHN F102 2017-02-23
M102 ANISHA KHAN C101 2016-06-12

(i) To display all details from table MEMBER in descending order of ISSUEDATE.

(ii) To display the BNO and BNAME of all Fiction Type books from the table BOOK

(iii) To display the TYPE and number of books in each TYPE from the table BOOK

(iv) To display all MNAME and ISSUEDATE of those members from table MEMBER who have books issued (i.e ISSUEDATE) in the year 2017.

(v) SELECT MAX(ISSUEDATE) FROM MEMBER;

(vi) SELECT DISTINCT TYPE FROM BOOK;

(vii) SELECT A.CODE,BNAME,MNO,MNAME FROM BOOK A, MEMBER B
WHERE A.CODE=B.CODE ;

(viii) SELECT BNAME FROM BOOK
WHERE TYPE NOT IN (“FICTION”, “COMIC”);



Q. 06A 2

State Distributive Laws of Boolean Algebra and verify them using truth table.



Q. 06B 2

Draw the Logic Circuit of the following Boolean Expression using only NAND Gates:
X.Y + Y.Z



Q. 06C 1

Derive a Canonical SOP expression for a Boolean function F, represented by the following truth table:

U V W F(U,V,W)
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0


Q. 06D 3

Reduce the following Boolean Expression to its simplest form using K-Map:
F(X,Y,Z,W)= Σ (0,1,2,3,4,5,10,11,14)



Q. 07A 2

Differentiate between Radio Link and Microwave in context of wireless communication technologies.



Q. 07B 2

Amit used a pen drive to copy files from his friend’s laptop to his office computer. Soon his office computer started abnormal functioning. Sometimes it would restart by itself and sometimes it would stop functioning totally. Which of the following options out of (i) to (iv), would have caused the malfunctioning of the computer.
Justify the reason for your chosen option:
(i) Computer Worm
(ii) Computer Virus
(iii) Computer Bacteria
(iv) Trojan Horse



Q. 07C 2

Jai is an IT expert and a freelancer. He recently used his skills to access the Administrator password for the network server of Megatech Corpn Ltd. and provided confidential data of the organization to its Director, informing him about the vulnerability of their network security. Out of the following options (i) to (iv), which one most appropriately defines Jai.
Justify the reason for your chosen option:
(i) Hacker
(ii) Cracker
(iii) Operator
(iv) Network Admin



Q. 07D 4

Hi Speed Technologies Ltd is a Delhi based organization which is expanding its office setup to Chandigarh. At Chandigarh office campus, they are planning to have 3 different blocks for HR, Accounts and Logistics related work. Each block has number of computers, which are required to be connected in a network for communication, data and resource sharing. As a network consultant, you have to suggest the best network related solutions for them for issues/problems raised in (i) to (iv), keeping in mind the distances between various blocks/locations and other given parameters.

Shortest distances between various blocks/locations:

HR Block to Accounts Block 400 Metres
Accounts Block to Logistics Block 200 Metres
Logistics Block to HR Block 150 Metres
DELHI Head Office to CHANDIGARH Office 270 Km

Number of Computers installed at various blocks are as follows:

HR Block 70
Account Block 50
Logistics Block 40

 

(i) Suggest the most appropriate block/location to house the SERVER in the CHANDIGARH Office (out of the 3 Blocks) to get the best and effective connectivity. Justify your answer.

(ii) Suggest the best wired medium and draw the cable layout (Block to Block) to efficiently connect various Blocks within the CHANDIGARH office compound.

(iii) Suggest a device/software and its placement that would provide data security for the entire network of CHANDIGARH office.

(iv) Which of the following kind of network, would it be
(a) PAN
(b) WAN
(c) MAN
(d) LAN