Page 1
2025 II 13 0930 Seat No.
Time : 3 Hours COMPUTER SCIENCE
Subject Code
H 4 7 0 5
Total No. of Questions : 35 (Printed Pages : 15) Maximum Marks : 70
INSTRUCTIONS : (i) All questions are compulsory, however there is an
internal choice for question number 31, 32, 34 and 35.
(ii) Question number 1 to 7 should be attempted only once.
(iii) Programs should be written in C++ only.
(iv) State your assumptions clearly :
Section A : Consists of 14 questions of 1 mark each.
Section B : Consists of 10 questions of 2 marks each.
Section C : Consists of 8 questions of 3 marks each.
Section D : Consists of 3 questions of 4 marks each.
SECTION – ‘A’
1. Write the CORRECT alternative from those given below : 1
What will be the output of the following program segment :
int k = 8;
int m = 7;
int z = k <=++m ? ++k : m++;
cout<<z;
• 8
• 9
• 7
• 1
H-4705 1 P.T.O.
Page 2
2. Write the CORRECT alternative from those given below : 1
If the characters ‘D’, ‘C’, ‘B’, ‘A’ are removed in the same order from a queue
one at a time and pushed on an empty stack, in what order the elements
from the stack will be removed ?
• A B C D
• A B D C
• D C A B
• D C B A
3. Write the CORRECT alternative from those given below : 1
A linked list in which each node contains a pointer to the previous node as
well as the next node is called as ............................. .
• Singly Linked List
• Circular Linked List
• Doubly Linked List
• Both Doubly Linked List and Circular Linked List
4. Write the CORRECT alternative from those given below : 1
Consider the following :
ifstream obj;
obj.open (‘‘TEST.DAT’’,ios::in|ios::binary);
obj.seekg(0,ios::end);
Write the statement to move the position of the get pointer 25 bytes
backward from the current position.
• obj.tellg(–25,ios::end);
• obj.seekg(25,ios::cur);
• obj.seekg(–25,ios::cur);
• obj.tellg(–25,ios::cur);
H-4705 2
Page 3
5. Write the CORRECT alternative from those given below : 1
For 2 input variables P and Q, the XNOR output expression in standard POS
form is ........................
• P’Q’ + PQ
• (P + Q).(P’ + Q’)
• (P + Q’).(P’ + Q)
• P’Q + PQ’
6. Write the CORRECT alternative from those given below : 1
What is the collection of the hyperlinked documents on the internet known
as ?
• HTML
• EMAIL
• WWW
• HTTP
7. Write the CORRECT alternative from those given below : 1
A device that amplifies and regenerates the weakened signal is ...................
• ROUTER
• GATEWAY
• REPEATER
• BRIDGE
8. What is inheritance in context of OOPS ? 1
9. What is Data Abstraction in context of OOPS ? 1
10. What is a stack ? 1
11. What is the use of function tellp() in file handling ? 1
12. Write the expression for SUM and CARRY of Half Adder. 1
H-4705 3 P.T.O.
Page 4
13. What is a Web Browser ? 1
14. Define the term Protocol with respect to computer networks. 1
SECTION – ‘B’
15. Consider the following class declaration and answer the following questions : 2
class ITEM
{
int ItemNo;
public:ITEM() //function 1
{
ItemNo=101;
}
ITEM(ITEM & O) //function 2
{
//missing code
}
~ITEM() //function 3
{
cout<<‘‘object Destroyed’’;
}
};
void main()
{
ITEM O1;
ITEM 02(O1); }
H-4705 4
Page 5
(i) Which category of constructor–Function 1 belongs to ?
(ii) Which category of constructor–Function 2 belongs to ? Write the
missing code that defines copy constructor for class ITEM.
(iii) What is Function 3 called ?
16. Determine the output of the following program : 2
#include<iostream.h>
int g=2;
void create(int &x, int y=2)
{ x=x+g;
y=x–g;
}
int main()
{ int g=2;
create(::g,g);
cout<<"\n"<<g<<" "<<::g;
create(g);
cout<<"\n"<<g<<" "<<::g;
}
17. State ANY TWO points of difference between an 1-D Array and a linear
linked list. 2
18. Identify and write the sorting algorithm applied on the following array of
integers and write the content of the array in the MISSING iterations : 2
Array before Sorting :
Array after pass 1 :
Array after pass 2 :
H-4705 5 P.T.O.
Page 6
Array after pass 3 :
Array after pass 4 :
Array after sorting :
19. Name ANY FOUR file modes used while opening a file. 2
20. Write a function Count() to read a text file ‘‘Input.txt’’ and return the count
of words starting with capital letter ‘I’. 2
Example : If value in text file is : INDIA IS MY COUNTRY then the
function should return 2.
21. Consider the following logic circuit diagram, obtain expression F and
simplify. 2
22. Write a short note on Ring Topology. 2
23. State ANY TWO points of difference between Circuit Switching and Packet
Switching. 2
24. State ANY TWO advantages of using Fiber Optic cable. 2
SECTION – ‘C’
25. Obtain the simplified SOP expression from the given Boolean expression. Also
draw the logic circuit diagram using NAND gates : 3
F(A, B, C) = (1, 3, 5, 6, 7)
H-4705 6
Page 7
26. Define a class ELECTION in C++ with the following description : 3
Private members :
Name – character array size 25
Age – integer
Address – character array size 35
Symbol – single character
AssignSymbol() – A function which assigns the value of symbol as per the
following conditions and calls function ShowElection().
Show Election() – A function to display all data members on the screen.
Public members :
NewContestant() – A function to allow the user to enter Name, Age, Address
and call the function AssignSymbol().
27. Answer the questions (i) to (iv) based on the following : 3
class Student
{
int Rollno;
char SName[20];
float Marks;
H-4705 7 P.T.O.
Page 8
protected:
void Result();
public:
Student();
void Enroll(); void Display();
};
class Teacher
{
long TCode;
char TName[20];
protected:
float Salary;
public:
Teacher();
void Enter();
void Show();
};
class Course: public Student, private Teacher
{ long CCode[10];
char CourseName[50];
char StartDate[8],EndDate[8];
public:
H-4705 8
Page 9
Course();
void Commence();
void CDetail();
};
(i) Which type of Inheritance is illustrated in the above C++ code ?
(ii) Write the names of member functions, which are accessible from
objects of class Course.
(iii) Write the names of all the data members, which are accessible from
member function Commence of class Course.
(iv) Is data member Salary accessible from the object of class teacher ?
28. Convert the following Infix expression into postfix form showing stack status
after every step : 3
A + (B * C – (D/E))* F
29. Obtain the simplified SOP expression from the given Boolean expression
using K-map and draw the logic circuit diagram using basic gates : 3
F(P, Q, R, S) R S RS PQR PQ PQS
30. Write a user defined function CHECK() which accepts 2 D array, its size
(N X N) as arguments and displays if the matrix is an IDENTITY matrix
or not.
Note : A matrix is said to be the identity matrix in which the elements of
principle diagonal are ones, and the rest of the elements are zeroes.
EXAMPLE : A = 1 0 0 is an IDENTITY Matrix of order 3 X 3.
0 1 0
0 0 1 3
H-4705 9 P.T.O.
Page 10
31. Write a complete procedural C++ program to generate the following pattern
for N lines where N is an odd number entered by the user : 3
If N=5
* *
* *
* * * * *
* *
* *
OR
Write a complete procedural C++ program to check if a number entered is
Magic or not :
A number is said to be Magic if and only if the repeated sum of its digits
is equal to 1.
Example :
1. 7642 is a Magic number because the repeated sum is 1
Sum of the digits of 7642 = 7 + 6 + 4 + 2 = 19
Sum of the digits of 19 = 1 + 9 = 10
Sum of the digits of 10 = 1 + 0 = 1
2. 846 is not a magic number because the repeated sum is not 1
Sum of the digits of 846 = 8 + 4 + 6 = 18
Sum of the digits 18 = 1 + 8 = 9
32. Write a user defined function COUNT() which accepts 1 D array and its size
as arguments and returns the count of PRIME numbers present in an array.
If an array A[] contains 5, 7, 4, 2, 11, 9, the function returns the count of
prime numbers as 4. 3
H-4705 10
Page 11
OR
Write a user defined function ADD() which accepts 1 D array and its size
as arguments and returns the sum of all the Palindrome numbers present
in the array.
Note : A palindromic number is a number that remains the same when its
digits are reversed. Eg 121, 55.
For example if the content of array is :
Then the function ADD() will return the sum as 55 + 11 + 121 = 187.
SECTION – ‘D’
33. Declare an abstract class named STUDENT with the following members :
Roll of type integer under private visibility label.
Constructor to initialise data member Roll.
Display() – A function under public visibility label to display the data
member roll.
Declare an abstract class named MARKS with the following members
Percent of type float under private visibility label.
Constructor to initialise data member percent.
Display() – A function under public visibility label to display the data
member percent.
Declare a class named SCHOOL with the following members.
H-4705 11 P.T.O.
Page 12
Name–a character array of size 30 under private visibility label.
a-of type of STUDENT under private visibility label.
b-of type MARKS under private visibility label.
Constructor to initialise data member Name.
Display()– A function under public visibility label to display the data member
name.
Write function main() to create an object by passing the following values for
data members Roll=14, percent=72.56 and name=’’John’’, .Display the data
member of all the classes. 4
34. Consider a binary file ‘‘CLUB.dat’’ already exists containing the objects of
the class CLUB : 4
class CLUB
{
int MemberNo;
char MemberName[20];
char MembershipType;
public:
void Input();
void Display();
H-4705 12
Page 13
char WhatType()
{ return MembershipType;}
};
Write a function Select () in C++ to read the file ‘‘CLUB.dat’’ and copy all
objects from ‘‘CLUB.DAT’’ whose MembershipType is ‘L’ or ‘M’ to a new
binary file ‘‘NEWCLUB.DAT’’.
OR
Consider binary files ‘‘CLASS_A.DAT’’ and ‘‘CLASS_B.DAT’’ already exists,
containing the objects of the class SCHOOL.
class SCHOOL
{
int RollNo;
float Percent;
char Name[20];
public:
void Input();
float ReturnPercent()
{
return Percent;
H-4705 13 P.T.O.
Page 14
}
void Display();
};
Write a function Combine () in C++ to read the files ‘‘CLASS_A.DAT’’ and
‘‘CLASS_B.DAT and copy all the records having percent>=90 into a new file
‘‘LIST.DAT.’’
35. Consider the following class declaration : 4
class list
{
struct node
{ int data;
node * next;
} * first;
public: list()
{
first=NULL;
}
void Create(); // creates linked list of n nodes
void Insert();
};
Define the member function Insert() which inserts a node at position POS
H-4705 14
Page 15
in the linear linked list where 1<=POS<=n+1.
OR
Consider the following class declaration :
class list
{
struct node
{ int data;
node * next;
} * first;
public: list()
{
first=NULL;
}
void Create(); // creates linked list of n nodes
void Deletion();
};
Define the member function Deletion() which deletes a node present at
position POS from the linear linked list where 1<=POS<=n.
H-4705 15 P.T.O.