Prep Udupi Paper PU II Year 2024
Prep Udupi Paper PU II Year 2024
Prep Udupi Paper PU II Year 2024
Prepared by:
Cs - Mahesh Arali
Page 1 of 16
CREATIVE PRE-UNIVERSITY COLLEGE, KARKALA
PREPARATORY EXAMINATION JANUARY - 2024
II PUC COMPUTER SCIENCE (41)
I. Select the correct answer from the choices given: (Repeated answers will not be
considered)
1. CD-ROM drives or hard disk drives are connected to the motherboard through
A) South bridge
B) IDE port
C) Disk controller
D) PS-2 port
3. What will be the input for three input XOR gate to get output 1?
A) 0,0,0
B) 1,0,0
C) 0,1,1
D) Both B and C
Page 2 of 16
A) Friend function
B) Member function
C) Non-member function
D) Inline function
9. int a=20,*p=&a,b=*p;
cout<<*p+20<<setw(5)<<b;
What will be displayed on output screen?
A) 40 20
B) 20 40
C) 40 40
D) Syntax Error
10. Candidate keys which are not currently selected as primary key is called ___
A) Super key
B) Alternate key
C) Composite key
D) Foreign key
Page 3 of 16
A) Open-source software
B) Freeware
C) Proprietary software
D) FLOSS
15. In which type of hosting the company rents an entire server from the hosting
company?
A) Free hosting
B) Virtual hosting
C) Dedicated hosting
D) Shared hosting
II. Fill in the blanks choosing the appropriate word from the brackets
(database, record, normalization, information, data mining)
16. A single entry in the table is called record
17. Data base is the collection of logically related data.
18. Normalization is the process of organizing the data in data base.
19. Information is a processed data.
20. Process of extracting knowledge from collected data is called data mining.
III. Answer any four questions. Each question carries two marks 4X2=8
21. State and prove complementary law.
Ans: This law states that when a variable is ANDed with its complement is equal to 0
and a variable is ORed with its complement is equal to 1”.
X + X’ = 1
Proof:
Page 4 of 16
If X = 0
Then LHS
= X+X’
= 0+1
=1
If X = 1
Then LHS
= X+X’
= 1+0
=1
X . X’ = 0
Proof:
If X = 0
Then LHS
= X.X’
=0.1
=0
If X = 1
Then LHS
= X.X’
=1.0
=0
(X + Y) . (X + Z) = X + YZ
Proof:
Then LHS
(X + Y) . (X + Z)
= XX + XZ +XY + YZ
=X + XZ + XY + YZ
Taking X as common in first two expression
= X (1 + Z) + XY + YZ
Page 5 of 16
= X + XY + YZ
Again taking X as common in first two term
= X (1 + Y) + YZ
= X + YZ
RHS
23. What are base class and derived class with reference to OOP?
Ans: Base class: It is the class whose properties are inherited by another class. It is
also called Super Class.
Derived class: It is the class that inherits properties from base class (es).It is also
called Sub Class.
24. What is a destructor? Which is the operator used with destructor function?
Ans: A destructor is a special member function that will be executed automatically
when an object is destroyed.
It will have, like constructor, the name same as that of the class but preceded by a
tilde (~).
25. Differentiate between read( ) and write( ) functions with reference to binary files.
Ans:
Read ( ) Write ( )
This function is used to read This function is used to write
data from a binary file data to a binary file
This function belongs to class This function belongs to class
ifstream. ofstream.
Page 6 of 16
28. Briefly explain circuit switching.
Ans: In this technique, first the complete physical connection between two computers
is established and then data are transmitted from the source computer to the
destination computer.
IV. Answer any four questions. Each question carries THREE marks 4X3=12
29. What is the function of UPS? Explain its types.
Ans: An UPS is a power supply that includes a battery to maintain power in the event
of a power failure. Typically, an UPS keeps a computer running for several minutes
to few hours after a power failure, enabling us to save data gracefully.
1. Online UPS – An online UPS avoids those momentary power lapses by continuously
providing power from its own inverter, even when the power line is functioning
properly.
2. Standby UPS – A Standby UPS (or off-line UPS) monitors the power line and
switches to battery power as soon as it detects a problem. The switch over to
battery, however, can require several milliseconds, during which time the computer
is not receiving any power.
30. Explain the working of NAND gate with circuit symbol and truth table.
Ans: The NAND Gate has two or more input signals but only one output signal. If all
of the inputs are 1 (high), then the output produced is 0 (low).
Page 7 of 16
A B Y=(A.B)’
0 0 1
0 1 1
1 0 1
1 1 0
2) Doubly linked list: It is a linked list in which each node is points both to the
next node and also to the previous node. In doubly linked list each node
contains three parts – FORW, BACK and INFO.
BACK: It is a pointer field containing the address of the previous node.
FORW: It is a pointer field that contains the address of the next node.
INFO: It contains the actual data.
3) Circular linked list: In circular lists, if the link field of the last node contains the
address of the first node, such a linked list is called as circular linked list.
32. Write the difference between static and dynamic memory allocation.
Ans:
Static Memory Dynamic Memory
Allocation Allocation
Memory space is allocated Memory space is allocated
before the execution of during the execution of
program programs
Memory space allocated is fixed Memory space is allocated is
not fixed
More memory space is required Less memory space is required
Memory allocation is from stack Memory allocation is from heap
area area
Page 8 of 16
Ans:
Get ( ): The get member function belongs to the class ifstream and reads a single
character from the associated stream.
Ifstream object.get(ch);
ch is character constant or char variable. The function reads ch from the
file represented by the ifstream_object into the variable ch.
Put ( ): The put member function belongs to the class ofstream and writes a single
character to the associated stream.
Ofstream object .put(ch);
ch is character constant or char variable. The function writes ch onto the
file represented by ofstream_object.
Page 9 of 16
Tag Description
<p>Some text </p> Adds a paragraph break after
the text.
<p align=”left”> Some Left justify text in paragraph.
text</p>
<p align=”centre”> Some Centre text in paragraph
text</p>
<nobr>Some text </nobr> Turns off automatic line breaks
even if text is wider than the
window.
V. Answer any four questions. Each question carries FIVE marks 4X5=20
37. Write an algorithm for deleting an element from the front end of queue.
Ans:
Step 1: If FRONT = NULL Then [Check whether QUEUE is empty]
PRINT “Underflow”
Exit
Step 2 : ITEM = QUEUE[FRONT]
Step 3: If FRONT = REAR Then [If QUEUE has only one element]
FRONT = NULL
REAR = NULL
Else
FRONT = FRONT + 1 [Increment FRONT pointer]
Step 4: Return
Page 10 of 16
J = J-1
While end
for end
Step 3: Exit
39. Give the differences between procedural oriented programming and object-
oriented programming.
Ans:
POP OOP
Large programs are divided into Programs are divided into objects
smaller programs known as functions
Data is not hidden and can be Data is hidden and cannot be
accessed by external functions accessed by external functions
Follow top-down approach in the Follows bottom-up approach in the
program design program design
Data may communicate with each Objects may communicate with each
other through functions other through functions.
Emphasize is on procedure rather Emphasize is on data rather than
than Data Procedure
It has no access specifier It has following access specifiers
Private, Public & Protected
It does not support inheritance Supports inheritance
41. Explain the features of default constructor. Write the syntax and example for
Page 11 of 16
default constructor.
Ans: Features of default constructor as follows:
Syntax:
Class classname
{
Private:
………..
Public:
Classname( )
{
……….
……….
}
Member functionname( );
};
Ex:
Class Queue
{
Private:
Int front, rear, count;
Public:
Queue( )
{
Front = -1;
Rear = -1;
Count = 0;
}
enqueue(item);
};
Page 12 of 16
42. What is inheritance? Write the advantages of inheritance in C++.
Ans: Inheritance is a process by which object of one class acquires the properties of
object of another class is called as inheritance.
Advantages of inheritance:
1) Reusing existing code
2) Faster development time
3) Easy to maintain Prepared by
4) Easy to extend Cs-Mahesh Arali
5) Memory Utilization
6) Testing and debugging is easy
43. Write the differences between Hierarchical data model and Network data model.
Ans:
Hierarchical data model Network data model
This data model organizes the data This data model organizes the data
in a tree like structure. in the form if graph.
All the nodes are linked to each All the nodes are linked to each
other with a definite hierarchy other without any hierarchy
This model is easy to design and It is powerful model, but database
simple. design is complicated.
This model represents the nodes as This model has many-to-many
one-to-one and one-to-many relationship on data.
relationships.
The data access is quite predictable It has one parent node and many
in the structure and hence the child nodes known as dependents,
process of retrieval and updates are hence the data access is easier.
optimized.
Page 13 of 16
4. Scalability: Networks need to be scalable to accommodate growth and increased
demand. A goal of computer networking is to design and implement networks that
can effectively handle expanding user base.
5. Security: Network security is a critical aspect of computer networking. Goals in this
area include protecting data and resources from unauthorized access, ensuring
privacy.
VI. Answer any TWO questions. Each question carries FIVE marks 2X5=10
2 quad, 2 pair
46. Write class clock has following members hours and minutes. Create member
functions to a) Initialize the data members b) Display time c) To convert hours and
minutes to minutes.
Page 14 of 16
Ans:
#include <iostream.h>
class Clock
{
Private:
int hour, minute;
public:
void initialize (int h, int m)
{
hour = h;
minute = m;
}
void display()
{
cout << "Time: " << hour << ":" << minute <<endl;
}
int convertToMinutes( )
{
return hour * 60 + minute;
}
};
void main( )
{
Clock c;
c.initialize(2, 30);
c.display();
int totalMinutes = c.convertToMinutes();
cout << "Total minutes: " << totalMinutes << std::endl;
}
47.
Emp_id Emp_name department Salary
E_101 Abhishek Marketing 45,000/-
E_102 Fanu IT 1,55,000/-
E_103 Karthik Account 65,000/-
E_104 Sharath IT 1,00,000/-
a) Write a SQL command to display all the record
b) Write a SQL command to count no of rows in a table
c) Write a SQL command to display maximum salary of an employee.
Page 15 of 16
d) Write a SQL command to display average salary.
e) Write a SQL command to display details of employee those who are working in
IT department.
Ans:
*****
Page 16 of 16