Anda di halaman 1dari 33

ककेन्दद्रीय वविद्ययालय-ससंगठन

KENDRIYA VIDYALAYA SANGATHAN

जयपरप -ससंभभाग
Jaipur REGION
Question Bank 2016-17

ककभा: 12
CLASS: 12

कसंप्ययटर सभाइसंस(०८६)
COMPUTER SCIENCE (086)
Question bank
FOR CLASS XII
COMPUTER SCIENCE
(2016-17)

PATRON
DR. JAIDEEP DAS
Deputy Commissioner
KVS Jaipur Region

COORDINATOR
Shri R C BHURIA
Principal
KV No. 5 Jaipur

Prepared Reviewed and Updated by


Harjeet Raj Sama
PGT(CS)
K V NO 5(I Shift) Jaipur
PREFACE

It gives me immense pleasure to present the question bank of Class XII

Computer Science for session 2016-17 by KVS Jaipur Region.

This question bank is prepared strictly as per the question pattern framed by

the CBSE of Computer Science for Class XII.

I am confident that the question bank for Class XII Computer Science will

help the students immensely to understand the board based questions pattern and

will improve the quality performance of the students.

Wish you all the best.

(Dr. Jaideep Das)

Deputy Commissioner

KVS RO, Jaipur


This question bank is prepared reviewed under the patronage of

Dr. Jaideep Das, Deputy Commissioner, KVS (RO) JAIPUR


Smt. V. Gowri - Asst. Commissioner, KVS (RO) JAIPUR
Sh. Jyothy Kumar - Asst. Commissioner, KVS (RO) JAIPUR
Smt. Sukriti Raiwani - Asst. Commissioner, KVS (RO) JAIPUR

Under the guidance of

Sh. R C BHURIA
Principal, K V 5 JAIPUR

Prepared Reviewed and Updated by

Harjeet Raj Sama, PGT (COMP. SC.), KV No.5 (I Shift) JAIPUR


And the team of PGT (Comp. Sc.) who attended the inservice course held at Dehradun in 2016
Chapter Wise Questions XII-COMPUTER SCIENCE

Introduction to OOP using C++

Object Oriented Programming Concepts


Short Answer Questions

Q1. Define object.


Q2. Define class.
Q3. Define data abstraction.
Q4. What is inheritance?
Q5. Define modularity.
Q6. Define encapsulation.
Q7. What is polymorphism?
Q8. How polymorphism is implemented in C++?
Q9. How inheritance is implemented in C++?
Q10. What is data hiding? How it is implemented in C++?
Q11. How data abstraction can be implemented in C++?
Q12. What is programming paradigm?
Q13. What is procedural programming paradigm?
Q14. What are the advantages of OOP?
Q15. What do you understand by functional overloading? Give an example illustrating its use in a C++
program.

CLASSES AND OBJECTS

SOME MPORTANT QUESTIONS TO REFRESH THE CONCEPT


Q1. Write four attributes associated with declaration of classes.
Q2. Define data members and member functions.
Q3. Write the scope rules of members of a class.
Q4. How many types of functions are used in a class?
Q5. When will you make a function inline?
Q6. What is scope resolution operator?
Q7. Define static data members.
Q8. How is memory allocated to a class and its objects?
BOARD PATTERN QUESTIONS:
Long Answer Questions (4 marks)

Q1. Define a class employee with the following specifications;

Private members of class employee :


empno integer
ename 20 characters
basic,hra,da float
netpay float
calculate( ) A function to calculate basic + hra + da with float return type
Public member functions of class employee :
havedata( ) function to accept values for empno, sname, basic , hra ,da and invoke
calculate( ) to calculate netpay
dispdata( ) function to display all the data members on the screen .
Q2. Define a class Student for the following specifications :
Private members of the Student are :
roll _ no integer
name array of characters of size 20
class _ st array of characters of size 8
marks array of integers of size 5
percentage float
calculate that calculates the percentage marks
Public members of the Student are :
readmarks reads mark and invoke the calculate function
displaymarks prints the data.

Q3. Define a class DONOR with the following specifications :


Private :
Donor number integer
Name 20 characters
Blood group 2 characters
Public :
Input( ) A function to accept all the information
Output( ) A function to display all the information
Checkgroup( ) A function with char * return to return Blood Group
Define both the number functions with their given description.
Q4. Define a class TEST in C++ with following description:
Private Members
 TestCode of type integer
 Description of type string
 NoCandidate of type integer
 CenterReqd (number of centers required) of type integer
 A member function CALCNTR() to calculate and return the number of centers as
(NoCandidates/100+1)
Public Members
• A function SCHEDULE() to allow user to enter values for TestCode, Description,
NoCandidate & call function CALCNTR() to calculate the number of Centres
• A function DISPTEST() to allow user to view the content of all the data members

Q5. Define a class in C++ with following description:


Private Members
• A data member Flight number of type integer
• A data member Destination of type string
• A data member Distance of type float
• A data member Fuel of type float
• A member function CALFUEL() to calculate the value of Fuel as per the following criteria
Distance Fuel
<=1000 500
more than 1000 and <=2000 1100
more than 2000 2200

Public Members
• A function FEEDINFO() to allow user to enter values for Flight Number, Destination,
Distance & call function CALFUEL() to calculate the quantity of Fuel
• A function SHOWINFO() to allow user to view the content of all the data members
CONSTRUCTOR AND DESTRUCTOR

SOME MPORTANT QUESTIONS TO REFRESH THE CONCEPT

Q1. What is constructor?


Q2. What is destructor?
Q3. What are different types of constructors?
Q4. What is default constructor?
Q5. What is parameterized constructor?
Q6. What is copy constructor?

BOARD PATTERN QUESTIONS -


Short Answer Questions ( 2 marks)

Note : Two options with the following pattern are generally asked in the Board Exam. Various optional
questions are given below.

Q7. Answer the following questions after going through the following class:
class Seminar
{
int Time;
public:
Seminar(); //Function 1
void Lecture() //Function 2
{cout<<”Lectures in the seminar on”<<end1;}
Seminar(int); //Function 3
Seminar(Seminar &abc); //Function 4
~Seminar() //Function 5
{ cout<<”Vote of thanks”<<end1;}
};

(i) In Object Oriented Programming, what is Function 5 referred as and when does it get
invoked/called?
(ii) In Object Oriented Programming, which concept is illustrated by Function 1, Function 3 and
Function 4 all together?
(iii) Which category of constructor - Function 1 belongs to? Write an example illustrating the calls
for Function 1.
(iv) Which category of constructor - Function 3 belongs to? Write an example illustrating the calls
for Function 3.
(v) Which category of constructor - Function 4 belongs to? Write an example illustrating the calls
for Function 4.
(vi) Write an example illustrating the calls for Function 3 explicitly.
(vii) Write an example illustrating the calls for Function 4 explicitly.
(viii) Write the complete definition for Function 1 to initialize Time as 30.
(ix) Write the complete definition for Function 3 to initialize Time with Mytime as parameter to
the Function 3.
(x) Write the complete definition for Function 4.

Q8. Answer the following questions after going through the following class:
class Complex
{
int x;
int y;
public:
Complex(); //Function 1
void disp() //Function 2
{cout<<”The Complex number is : “<<x<<” + “<<y<<”i”<<end1;}
Complex(int, int); //Function 3
Complex(Complex &abc); //Function 4
};

(i) Which category of constructor - Function 1 belongs to? Write an example illustrating the calls
for Function 1.
(ii) Which category of constructor - Function 3 belongs to? Write an example illustrating the calls
for Function 3.
(iii) Which category of constructor - Function 4 belongs to? Write an example illustrating the calls
for Function 4.
(iv) Write an example illustrating the calls for Function 3 explicitly.
(v) Write an example illustrating the calls for Function 4 explicitly.
(vi) Write the complete definition for Function 1 to initialize x as 10 and y as 20.
(vii) Write the complete definition for Function 3 to initialize the data members with p and q as
parameters to the Function 3.
(viii) Write the complete definition for Function 4.

Inheritance

SOME MPORTANT QUESTIONS TO REFRESH THE CONCEPT


Q1. Write the reasons behind the introduction of inheritance in OOP.
Q2. What are the different forms of inheritance?
Q3. How does the access of inherited members depend upon their access specifiers and the visibility
modes of the base class?
Q4. Write the different ways of accessibility of base class members.
Q5. How is the size of a derived class object calculated?
Q6. In what order are class constructors and class destructors called when a derived class object is created
or destroyed?

BOARD PATTERN QUESTIONS


Long Answer Questions (4 Marks)

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


class bus : private heavyvehicle
class heavyvehicle : protected vehicle {
class vehicle
{ char make[20];
{
int diesel_petrol; public:
int wheels;
protected: void fetchdata( );
protected:
int load; void displaydata( );
int passenger;
public: };
public:
void readdata(int, int);
void inputdata( );
void writedata( );
void outputdata( );
};
};

i) Write the member(s) that can be accessed from the object of bus.
ii) Write the data member(s) that can be accessed from the function displaydata( ).
iii) How many bytes are required by an object of bus and heavyvehicle classes respectively?
iv) Is the member function outputdata( ) accessible to the objects of the class heavyvehicle?

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


class ape : private livingbeing class human : public ape
class livingbeing { {
{ int no_of_organs; char race[20];
char specification[20]; int no_of_bones; char habitation[30];
int averageage; protected: public:
public: int iq_level; void readhuman();
void read(); public: void showhuman();
void show(); void readape(); };
}; void showape();
};

(i) Write the members which can be accessed from the member functions of class human.
(ii) Write the members, which can be accessed by an object of class human.
(iii) What is the size of an object (in bytes) of class human?
(iv) Write the class(es) which objects can access read() declared in livingbeing class.

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


class parent class father : protected parent class mother : public father
{ { {
char name[20]; int daughter; int child;
protected: protected: public:
int son; int baby; void fetchdata();
public: public: void dispdata();
void inputdata(); void readdata(); };
void outputdata(); void writedata();
}; };
(i) In case of the class father, what is the base class of father and what is the derived class of father?
(ii) Write the data member(s) that can be accessed from function dispdata().
(iii) Write the member function(s), which can be accessed by an object of mother class.
(iv) Is the member function outputdata() accessible to the objects of father class?

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


class person class client : private person class doctor : public person
{ { {
char name[20], address[20]; int resource; char speciality[20];
protected: public: public:
int x; int get_resource(); void input();
public: void free_resource(); void disp();
void enter_person(); }; };
void disp_person();
};

(i) What type of inheritance is depicted by the above example?


(ii) Write the member functions, which can be called by the object of class client.
(iii) What is the size in bytes of the object of class doctor and client respectively?
(iv)Write the data members, which can be used by the member functions of the class doctor.

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


class author
{ class person class employee : private author, public person
char name[12]; { {
double royalty; char address[20]; int ecode;
protected: protected: char dept[30];
void register(); float salary; public:
public: public: employee(){};
author(){}; person(){}; void start();
void enter(); void havelt(); void show();
void display(); void givelt(); };
}; };

(i) Write the names of data members, which are accessible from object of class employee.
(ii) Write the names of all the member functions which are accessible from object of class person.
(iii) Write the data members which are accessible from member functions of class employee.
(iv) How many bytes are required by an object belonging to class employee?

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


class PUBLISHER class BRANCH class AUTHOR: private BRANCH, public PUBLISHER
{ char Pub[12]; { char CITY[20]; { int Acode;
double Turnover; protected: char Aname[20];
protected: float Employees; float Amount;
void Register(); public: public:
public: BRANCH(); AUTHOR();
PUBLISHER(); void Haveit(); void Start();
void Enter(); void Giveit(); void Show();
void Display(); }; };
};
(i) Write the names of data members, which are accessible from objects belonging to class AUTHOR.
(ii) Write the names of all the members which are accessible from member functions of class AUTHOR.
(iii) How many bytes are required by an object belonging to class AUTHOR?
(v) Write the sequence of the constructors’ invocation when the object of author is created.

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


class CUSTOMER class SALESMAN class SHOP : private CUSTOMER , public SALESMAN
{ { {
int Cust_no; int Salesman_no; char Voucher_No[10];
char Cust_Name[20]; char Salesman_Name[20]; char Sales_Date[8];
protected: protected: public:
void Register(); float Salary; SHOP();
public: public: void Sales_Entry();
CUSTOMER(); SALESMAN(); void Sales_Detail();
void Status(); void Enter(); };
}; void Show();
};

(i) Write the names of data members which are accessible from objects belonging to class
CUSTOMER.
(ii) Write the member functions that are accessible from objects belonging to class SALESMAN.
(iii) Write the names of all the members which are accessible from member functions of class SHOP.
(iv) How many bytes will be required by an object belonging to class SHOP?

Data Structure & Pointers

Address Calculation
Short Answer Questions ( 3 marks)
Formulae of Row Major & Column Major are used in the given questions. Kindly go through it.

Q1. An array x[30][10] is stored in the memory with each element requiring 4 bytes of storage. If the base
address of x is 4500, find out memory locations of x[12][8] and x[2][4], if the content is stored along
the row.

Q2. An array P[20][30] is stored in the memory along the column with each of the element occupying 4
bytes, find out the Base Address of the array, if an element P[2][20] is stored at the memory location
5000.

Q3. An array ARR[5][25] is stored in the memory with each element occupying 4 bytes of space.
Assuming the base address of ARR to be 1000, compute the address of ARR[5][7], when the array is
stored as : (i) Row wise (ii) Column wise.
Q4. An array S[40][30] is stored in the memory along the row with each of the element occupying 2
bytes, find out the memory location for the element S[20][10], if an element S[15][5] is stored at the
memory location 5500.

Q5. An array P[20][30] is stored in the memory along the column with each of the element occupying 4
bytes, find out the memory location for the element P[5][15], if an element P[2][20] is stored at the
memory location 5000.

Static Allocation of Objects


Short Answer Questions ( 2 marks)
Note : Practice the way to write the function definition where array and its size are passed as arguments.
Practice with the concepts of accessing the elements of the one / two dimensional array. Apply the
suitable logic to solve the given problem and write the coding of it.
Q1. Write a function in C++ to find sum of rows from a two dimensional array.
Q2. Write a function in C++ to find the sum of both left and right diagonal elements from a two
dimensional array (matrix).
Q3. Write a function in C++ which accepts an integer array and its size as arguments and replaces
elements having even values with its half and elements having odd values with twice its value. eg:
if the array contains : 3, 4, 5, 16, 9
then the function should be rearranged as 6, 2,10,8, 18
Q4. Write a user defined function in C++ which intakes one dimensional array and size of array as
argument and display the elements which are prime.
If 1D array is 10 , 2 , 3 , 4 , 5 , 16 , 17 , 23
Then prime numbers in above array are: 2 , 3 , 5, 17, 23
Q5. Write a function in C++ which accepts an integer array and its size as arguments/parameters and
exchanges the values at alternate locations.
example : if the array is 8,10,1,3,17,90,13,60 then rearrange the array as 10,8,3,1,90,17,60,13
Short Answer Questions ( 3 marks)
Q1. Write a function in C++ to merge the contents of two sorted arrays A & B into third array C.
Assuming array A is sorted in ascending order, B is sorted in descending order, the resultant array is
required to be in ascending order.
Q2. Given two arrays of integers x and y of sizes m and n respectively. Third array of integers z has m+n
size. These are passed as the arguments to the function EXCHANGE(). Write a function named
EXCHANGE() which will produce the elements to the third array named z, such that the following
sequence is followed:
(i) All odds numbers of x from left to right are copied into z from left to right.
(ii) All even number of x from left to right are copied into z from right to left.
(iii) All odd numbers of y from left to right are copied into z from left to right.
(iv) All even number of y from left to right are copied into z from right to left.
e.g.: x is {3,2,1,7,6,3}
and y is {9,3,5,6,2,8,10}
then z = {3,1,7,3,9,3,5,10,8,2,6,6,2}
Q3. Write function SORTPOINTS() in c++ to sort an array of structure Game in descending order of
points using Bubble Sort
Note: Assume the following definition of structure Game
struct Game
{
long PNo; // Player Number
char PName[20];
long points;
};
Q4. Write a function in C++ which accepts an integer array and its size as arguments and assign the
elements into a two dimensional array of integers in the following format
If the array is 1,2,3,4,5,6 if the array is 1,2,3
The resultant 2D array is The resultant 2D array is
123456 123
012345 012
001234 001
000123
000012
000001

Q5. Write a function in C++ which accepts an integer array of double dimensional with its size as
arguments and displays the total numbers of odd, even and prime numbers in the array. Example : if
the following integer array will be passed to the function, i.e.
6 4 13 19 5
7 3 8 11 51
9 12 23 4 6
21 29 18 9 10
28 5 12 2 6
Then the output should be : The total odd numbers are : 13
The total odd numbers are : 12
The total odd numbers are : 10

Dynamic Allocation of Objects


Long Answer Questions ( 4 marks )
Note : Insertion at the beginning of Linked List (Push operation in Stack), Insertion at the end of Linked
List (Insertion in a Queue), Deletion from the beginning of Linked List (Pop operation in Stack as
well as Deletion of node in a Queue) are in the syllabus. So, only the logic of these three functions
should be practiced. The logic and the way to solve these functions are given below. Practice them.
Q1. Write a function in C++ to delete a node containing customer’s information, from a dynamically
allocated Queue of Customers implemented with the help of the following structure:
struct Customer
{
int CNo;
char CName[20];
Customer *Link;
};

Q2. Write a function in C++ to delete a node containing Book’s information, from a dynamically allocated
Stack of Books implemented with the help of the following structure.
struct Book
{
int BNo;
char BName[20];
Book *Next;
};

Q3. Write a function in C++ to perform a PUSH operation in a dynamically allocated stack considering
the following:
struct node
{ int x,y;
node *Link;
};

Q4. Write a function in C++ to perform Insert operation in a dynamically allocated Queue containing
names of students.
struct stud
{
char Name[20];
stud *Link;
};

Q5. Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real
numbers. struct NODE
{
float Data; NODE *Link;
};

Infix & Postfix Expressions


Short Answer Questions ( 2 marks)
(Postfix to Infix)
Q1. Evaluate the following postfix notation of expression:
15 3 2 + / 7 + 2 *
Q2. Evaluate the following postfix notation of expression:
True, False, AND, True, True, NOT, OR, AND

Q3. Evaluate the following postfix notation of expression:


25 8 3 – / 6 * 10 +

(Infix to Postfix)
Q4. Convert A + ( B * C – ( D / E )) * F into postfix form showing stack status after every step.

Q5. Convert NOT A OR NOT B AND NOT C into postfix form.

DATA FILE HANDLING

Very Short Answer Questions ( 1 mark)

Q1. Observe the program segment given below carefully and fill the blanks marked as Statement 1 and
Statement 2 using seekg()/seekp() functions for performing the required task.

#include <fstream.h>
class Item
{
int Ino;char Item[20];
public:
//Function to search and display the content of a particular record
void Search(int );
//Function to modify the content of a particular record number
void Modify(int);
};
void Item::Search(int RecNo)
{
fstream File;
File.open(“STOCK.DAT”,ios::binary|ios::in);
______________________ //Statement 1
File.read((char*)this,sizeof(Item));
cout<<Ino<<”==>”<<Item<<endl;
File.close();
}
void Item::Modify(int RecNo)
{
fstream File;
File.open(“STOCK.DAT”,ios::binary|ios::in|ios::out);
cout>>Ino;cin.getline(Item,20);
______________________ //Statement 2
File.write((char*)this,sizeof(Item));
File.close();
}
Q2. Observe the program segment given below carefully and fill the blanks marked as Statement 1
and Statement 2 using seekg() and tellg() functions for performing the required task.

#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

int Bytes = ______________________ //Statement 2

int Count = Bytes / sizeof(Item);


File.close();
return Count;
}

Q3. Observe the program segment given below carefully and answer the following:-

#include <fstream.h>
class stud
{
int rno; char name[20];
public:
void enroll();
void disp();
long rrno()
{return rno;}
};
void update(long i)
{
fstream File;
File.open(“STOCK.DAT”,ios::binary|ios::in);
Stud s1;
int record=0,found=0;
while(File.read((char*)&s1,sizeof(stud)))
{ if(i == s1.rrno())
{ cout<<”enter new score”;
S1.enroll();
______________________ //Statement 1
______________________ //Statement 2

Found=1;
}
Record++;
}
If(found==1)
Cout<<”record update”;
File.close();
}
Write the statement 1 to position the file pointer at the beginning of the record & statement 2 to
write the record.

Q4. A file named as “STUDENT.DAT” contains the student records, i.e. objects of class student.
Assuming that the file is just opened through the object FILE of fstream class, in the required file
mode, write the command to position the put pointer to point to the beginning of the second record
from the last record.

Q5. A file named as “EMPLOYEE.DAT” contains the student records, i.e. objects of class employee.
Assuming that the file is just opened through the object FILE of fstream class, in the required File
mode, write the command to position the get pointer to point to eighth record from the beginning.

Short Answer Questions ( 2 marks)


Q1. Write a function in C++ to count the number of lowercase alphabets present in a text file
“BOOK.TXT”;
Q2. Write a function in C++ to count the number of alphabets present in a text file “DATA.TXT”.
Q3. Write a function in C++ to count the number of vowels present in a text file “STORY.TXT”.
Q4. Write a function in C++ to count the number of words in a text file NOTES.TXT.
Q5. Write a function in C++ to count the number of lines present in a text file “STORY.TXT”.
Short Answer Questions ( 3 marks)
Q1. Write a function in C++ to add more new objects at the bottom of a binary file STUDENT.DAT”,
assuming the binary file is containing the objects of the following class.
class STUD
{
int Rno;
char Name[20];
public:
void Enter(){cin>>Rno;gets(Name);}
void Display(){cout<<Rno<<Name<<endl;}
};
Q2. Write a function in C++ to read & display the details of all the members whose membership type is
‘L’ or ‘M’ from a binary file “CLUB.DAT”. Assume the binary file contains object of class CLUB.
class CLUB
{
int mno;
char mname[20];
char type;
public:
void register ( );
void dis();
char whattype( )
{ return type;}
};
Q3. Given a binary file PHONE.DAT containing records of the following structure type.
class Phonlist
{
char add;
char Name[20];
char area[5];
public:
void register();
void show();
int check(char ac[ ])
{
return strcmp(area,ac)
}
};
Write a function TRANSFER( ) in C++, that would copy all records which are having area as ”DEL”
from PHONE.DAT to PHONBACK.DAT.
Q4. Write a function in C++ to modify the name of a student whose roll number is entered during the
execution of the program. Search the accepted roll number from a binary file “STUDENT.DAT”
and modify the name, assuming the binary file is containing the objects of the following class.
class STUD
{
int Rno;
char Name[20];
public:
int srno(){ return Rno;}
void Enter(){gets(Name);}
void Display(){cout<<Rno<<Name<<endl;}
};
Q5. Given a binary file PHONE.DAT, containing records of the following structure type
class Phonlist
{
char Name[20];
char Address[30];
char AreaCode[5];
char PhoneNo[15];
public:
void Register();
void Show();
int CheckCode(char AC[])
{ return strcmp(AreaCode,AC); }
};
Write a function TRANSFER ( ) in C++, that would copy all those records which are having
AreaCode as “DEL” from PHONE.DAT to PHONBACK.DAT.

Databases and SQL


Short Answer Questions

Q1. What is a database system? What are the advantages provided by a database system?

Q2. What are the various levels of database abstraction in a database system?

Q3. What is Data Independence? What are the levels of Data Independence?

Q4. What is a view? How is it useful?

Q5. What is relation? Define the relational data model?

Q6. Define : (i) Tuple (ii) Attribute (iii) Degree (iv) Cardinality.

Q7. What do you understand by Primary Key & Candidate Keys?


Q8. Define alternate key. What do you understand by foreign key?

Q9. What is Data Definition Language? Give examples of some DDL commands.

Q10. What is Data Manipulation Language? Give examples of some DML commands.

Q11. What is SQL? Write the various processing capabilities of SQL.

SYNTAX of some SQL COMMANDS :


1. SELECT column list FROM <table name> WHERE <condition> GROUP BY <column name(s)>
HAVING <search condition> ORDER BY column name;
2. INSERT INTO <table name> [<column list>] VALUES ( <value>, <value>, ...);
3. DELETE FROM <table name> [WHERE <predicate>];
4. UPDATE <table name> SET <column name> = <new value> [WHERE <predicate>];
5. CREATE TABLE <table name> (<column name> <data type> [(size)] <column constraint>,
<column name> <data type> [(size)] <column constraint>, ... <table constraint> (<column name>
[<column name> ...]) ...);
6. CREATE VIEW <view name> [(<column name>, <column name>,...)] AS <SELECT command>;
7. ALTER TABLE <table name> ADD / MODIFY <column name> <data type> <size>;
8. DROP TABLE <table name>;
9. DROP VIEW <view name>;
Long Answer Questions

Q1. Consider the following tables ACTIVITY and COACH. Write SQL commands for the statements
(i) to (iv) and give outputs for SQL queries (v) to (viii).
Table: ACTIVITY
ACode ActivityName ParticipantsNum PrizeMoney ScheduleDate

1001 Relay 100x4 16 10000 23-Jan-2004


1002 High jump 10 12000 12-Dec-2003
1003 Shot Put 12 8000 14-Feb-2004
1005 Long Jump 12 9000 01-Jan-2004
1008 Discuss Throw 10 15000 19-Mar-2004

Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003

(i) To display the name of all activities with their Acodes in descending order.
(ii) To display sum of PrizeMoney for each of the Number of participants groupings (as shown in
column ParticipantsNum 10,12,16).
(iii) To display the coach’s name and ACodes in ascending order of ACode from the table
COACH.
(iv) To display the content of the GAMES table whose ScheduleDate earlier than 01/01/2004 in
ascending order of ParticipantNum.
(v) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY;
(vi) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY;
(vii) SELECT SUM(PrizeMoney) FROM ACTIVITY;
(viii) SELECT DISTINCT ParticipantNum FROM COACH;

Q2. Consider the following tables GAMES and PLAYER. Write SQL commands for the statements (i) to
(iv) and give outputs for SQL queries (v) to (viii).
Table: GAMES
GCode GameName Number PrizeMoney ScheduleDate
101 Carom Board 2 5000 23-Jan-2004
102 Badminton 2 12000 12-Dec-2003
103 Table Tennis 4 8000 14-Feb-2004
105 Chess 2 9000 01-Jan-2004
108 Lawn Tennis 4 25000 19-Mar-2004
Table: PLAYER
PCode Name Gcode
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103

(i) To display the name of all Games with their Gcodes.


(ii) To display details of those games which are having PrizeMoney more than 7000.
(iii) To display the content of the GAMES table in ascending order of ScheduleDate.
(iv) To display sum of PrizeMoney for each of the Number of participation groupings (as shown in
column Number 2 or 4).
(v) SELECT COUNT(DISTINCT Number) FROM GAMES;
(vi) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;
(vii) SELECT SUM(PrizeMoney) FROM GAMES;
(viii) SELECT DISTINCT Gcode FROM PLAYER;
Q3. Consider the following tables HOSPITAL. Give outputs for SQL queries (i) to (iv) and write SQL
commands for the statements (v) to (viii).
No Name Age Department Dateofadmin Charge Sex
1 Arpit 62 Surgery 21/01/06 300 M
2 Zayana 18 ENT 12/12/05 250 F
3 Kareem 68 Orthopedic 19/02/06 450 M
4 Abhilash 26 Surgery 24/11/06 300 M
5 Dhanya 24 ENT 20/10/06 350 F
6 Siju 23 Cardiology 10/10/06 800 M
7 Ankita 16 ENT 13/04/06 100 F
8 Divya 20 Cardiology 10/11/06 500 F
9 Nidhin 25 Orthopedic 12/05/06 700 M
10 Hari 28 Surgery 19/03/06 450 M

(i) Select SUM(Charge) from HOSPITAL where Sex=’F’;


(ii) Select COUNT(DISTINCT Department ) from HOSPITAL;
(iii) Select SUM(Charge) from HOSPITAL group by Department;
(iv) Select Name from HOSPITAL where Sex=’F’ AND Age > 20;
(v) To show all information about the patients whose names are having four characters only.
(vi) To reduce Rs 200 from the charge of female patients who are in Cardiology department.
(vii) To insert a new row in the above table with the following data :
11, ‘Rakesh’, 45, ‘ENT’, {08/08/08}, 1200, ‘M’
(viii) To remove the rows from the above table where age of the patient > 60.

Q4. Consider the following tables BOOKS. Write SQL commands for the statements (i) to (iv) and give
outputs for SQL queries (v) to (viii).
Table : BOOKS
B_Id Book_Name Author_Name Publisher Price Type Quantity
C01 Fast Cook Lata Kapoor EPB 355 Cookery 5
F01 The Tears William Hopkins First 650 Fiction 20
T01 My C++ Brain & Brooke FPB 350 Text 10
T02 C++ Brain A.W.Rossaine TDH 350 Text 15
F02 Thuderbolts Anna Roberts First 750 Fiction 50
i). To list the names from books of Text type.
ii). To display the names and price from books in ascending order of their price.
iii). To increase the price of all books of EPB publishers by 50.
iv). To display the Book_Name, Quantity and Price for all C++ books.
v). Select max(price) from books;
vi). Select count(DISTINCT Publishers) from books where Price >=400;
vii). Select Book_Name, Author_Name from books where Publishers = ‘First’;
viii). Select min(Price) from books where type = ‘Text’;

Q5. Consider the tables ITEMS & COMPANY. Write SQL commands for the statements (i) to (iv) and
give the outputs for SQL queries (v) to (viii).
Table : ITEMS
ID PNAME PRICE MDATE QTY
T001 Soap 12.00 11/03/2007 200
T002 Paste 39.50 23/12/2006 55
T003 Deodorant 125.00 12/06/2007 46
T004 Hair Oil 28.75 25/09/2007 325
T005 Cold Cream 66.00 09/10/2007 144
T006 Tooth Brush 25.00 17/02/2006 455

Table : COMPANY
ID COMP City
T001 HLL Mumbai
T008 Colgate Delhi
T003 HLL Mumbai
T004 Paras Haryana
T009 Ponds Noida
T006 Wipro Ahmedabad

i). To display PNAME, PRICE * QTY only for the city Mumbai.
ii). To display product name, company name & price for those items which IDs are equal to the IDs of
company.
iii). To delete the items produced before 2007.
iv). To increase the quantity by 20 for soap and paste.
v). SELECT COUNT(*) FROM ITEMS WHERE ITEMS.ID=COMPANY.ID;
vi). SELECT PNAME FROM ITEMS WHERE PRICE=SELECT MIN(PRICE) FROM ITEMS;
vii). SELECT COUNT(*) FROM COMPANY WHERE COMP LIKE “P_ _ _ _”;
viii). SELECT PNAME FROM ITEMS WHERE QTY<100;
Q6. In a database there are two tables ‘GARDEN’ and ‘CUSTOMER’ shown below-
TABLE :GARDEN
Vcode VehicleName Make Color Capacity Charges
501 A-Star Suzuki RED 3 14
503 Indigo Tata SILVER 3 12
502 Innova Toyota WHITE 7 15
509 SX4 Suzuki SILVER 4 14
510 C Class Mercedes RED 4 35
TABLE : CUSTOMER
Ccode CName Vcode
1001 HemantSahu 501
1002 Raj Lal 509
1003 Feroza Shah 503
1004 Ketan Dhal 502
a) Name the columns which can be made ‘Foreign Key’ in both the tables.
b) To display all details of vehicle “Innova”.
c) Mrs. Renu has created a Database “Teachers” in MySQL. She has created many tables in this database.
Now she wants to show the name of the existing table from the database. Which command she will use
for the same.

Q7. Write the SQL commands for a-f and output of g-h commands on the basis of given table:
TRAVEL
SCODE SNAME DISTANCE CITYTO CITYFRO
101 LAL QUILLA 450 DELHI JAIPUR
102 TAJ 300 AGRA JAIPUR
103 HILL 350 PATNITOP DELHI
RESORT
104 HAWA 320 JAIPUR AGRA
MAHAL
105 BAHU FORT 300 JAMMU DELHI
a). To view the Stations in descending order of distance.
b). To count the distinct CITYTO.
c). Tofind out the maximum distance.
d). To count the distinct CITYFRO where distance is more than 300.
e). To view the name of stations starts with letter ‘H’.
f). Toget the average distance of scode greater than 104.
g) SELECT SUM(DISTANCE) FROM TRAVEL;
h) SELECT CITYTO FROM TRAVEL ORDER BY DISTANCE;
Q8. Consider the table TEACHER given below. Write the commands in SQL for (i) to (iv) and
output for (v) to (viii) Table: TEACHER
ID Name Department HireDate Category Gender Salary
1 Tarun Nanda Hindi 17-03-94 TGT M 25000
2 Sanajy Sharma English 12-02-90 PRT M 20000
3 Nikhil Arora Arts 16-05-80 PGT M 30000
4 James Kaur Science 16-10-89 TGT M 25000
5 JaspreetSehgal Science 01-08-90 PGT F 22000
6 SiddhartKapoor English 10-02-80 PRT M 21000
7 SonaliKhanna Arts 02-09-94 TGT F 27000
8 Mukul Roy Computer 14-11-80 TGT M 30000

(i) To display all information about teachers of PGT category.


(ii) To list the names of female teachers of Hindi department.
(iii) To list names, hiring dates of all the teachers in ascending order of hiring date.
(iv) To count the number of teachers in English department.
(v) SELECT MAX(HireDate) FROM TEACHER;
(vi) SELECT DISTINCT(Category) FROM TEACHER;
(vii) SELECT COUNT(*) FROM TEACHER WHERE Category=’PGT’;
viii) SELECT AVG(Salary) FROM TEACHER GROUP BY Gender;

Short Answer Questions ( 2 marks)

Q1. State and verify Demorgan's Laws algebraically.


Q2. State and algebraically verify Absorption Laws.
Q3. State Distributive Laws. Write the dual of : X + X Y = X + Y
Q4. State any one form of Associative law and verify it using truth table.
Q5. State the principle of duality in boolean algebra and give the dual of the following:
X.Y.Z + X.Y.Z + X.Y.Z
Q6. Explain about tautology and fallacy.

SOP & POS


Very Short Answer Questions ( 1 Mark)

Q1. Write the POS form of a Boolean function F, which is represented in a truth table as follows:
U V W F
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1
Q2. Write the SOP form of a Boolean function G, which is represented in a truth table as follows:
X Y Z G
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0

Q3. Convert the following function into canonical SOP form.


F( A , B, C, D ) =  ( 1, 4, 6, 8, 11, 13)

Q4. Convert the following function into canonical SOP form.


F( A , B, C, D ) =  ( 0, 3, 7, 9, 10, 14)

Q5. Convert the following function to its equivalent SOP shorthand notation.
F( A , B, C, D ) =  ( 0, 3, 7, 9, 10, 14)

Q6. Convert the following function to its equivalent POS shorthand notation.
F( A , B, C, D ) =  ( 1, 4, 6, 8, 11, 13)

Karnaugh Map
Short Answer Questions ( 3 marks)

Q1. Reduce the following Boolean Expression using K-Map:


F( A, B, C, D ) =  ( 0, 2, 3, 4, 6, 7, 8, 9, 10, 12, 13, 14 )
Q2. Reduce the following Boolean Expression using K-Map:
F( A, B, C, D ) =  ( 0, 3, 5, 6, 7, 8, 11, 15 )
Q3. Reduce the following Boolean Expression using K-Map:
F( A, B, C, D ) =  ( 2, 3, 4, 5, 10, 11, 13, 14, 15 )
Q4. Reduce the following Boolean Expression using K-Map: F(A,B,C,D)=(0,1,2,4,5,6,8,10)
Q5. reduce the following Boolean Expression using K-Map: F(A,B,C,D)=(0,1,4,5,7,10,13,15)
Basic Logic Gates

Short Answer Questions ( 2 marks)


Q1. Write the equivalent Boolean Expression for the following Logic Circuit.

Q2. Write the equivalent Boolean Expression for the following Logic Circuit.

U
V

Q3. Draw the Logic Circuit Diagram for the following Boolean Expression :
F = ( A . C ) + ( A . B ) + ( B . C )

Q4. Draw the diagram of digital circuit for


F(A, B, C) = AB + BC + AC using NAND-to-NAND logic.

Q5. Draw the diagram of digital circuit for


F(X, Y, Z) = (X + Y) (Y + Z) (X + Z) using NOR-to-NOR logic.
Communication & Open Source Concepts
Very Short Answer Questions

Q1. What is a network?


Q2. Mention the advantages of networking.
Q3. Define server. Mention the types of servers.
Q4. What is NIU? What does the MAC address refer to?
Q5. What are the different types of switching techniques?
Q6. What is a communication channel? Give examples of guided media & unguided media.
Q7. Define the term Bandwidth. Give any one unit of Bandwidth.
Q8. Expand : HTTP, FTP, TCP/IP, SLIP, PPP, NCP, GSM, TDMA, CDMA, WLL, PSTN.
Q9. What are the different types of networks?
Q10. What do you mean by network topology? What are the most popular topologies?
Q11. What are the advantages of E-mail?
Q12. What is WWW? What are the WWW attributes?
Q13. What is web browser? Give any two examples of web browsers.
Q14. Define the terms: Web site, Web page, Home page, Web portal.
Q15. When do you prefer XML over HTML and why?
Q16. Compare authorisation with authentication.
Q17. What is Firewall? How firewall protects our network?
Q18. What are cookies?
Q19. How is a cracker different from a hacker? If someone has hacked your Website, to whom you lodge
the Complain?
Q20. What is Cyberlaw?
Q21. Expand : (i) FLOSS (ii) FSF (iii) OSI (iv) W3C
Q22. What is a computer virus? Write the basic types of viruses.
Q23. Define the terms : Trojan Horses, Worm, Spam.

Long Answer Questions


Q1. Knowledge Supplement Organisation has set up its new centre at Mangalore for its office and web
based activities. It has 4 blocks of buildings as shown in the diagram below:
Block
Block C
Block
A
D
Block
B

Centre to centre distances between various blocks Number of Computers


Black A to Block B 50 m Black A 25
Block B to Block C 150 m Block B 50
Block C to Block D 25 m Block C 125
Block A to Block D 170 m Block D 10
Block B to Block D 125 m
Block A to Block C 90 m
(a) Suggest a cable layout of connections between the blocks.
(b) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable
reason.
(c) Suggest the placement of the following devices with justification
(i) Repeater (ii) Hub/Switch
Q2. Ravya Industries has set up its new center at Kaka Nagar for its office and web based activities. The
company compound has 4 buildings as shown in the diagram below:
Fazz
Raj
Building
Building

Jazz
Harsh Building
Building

Centre to centre distances between various buildings Number of Computers


Harsh Building to Raj Building 50 m Harsh Building 15
Raz Building to Fazz Building 60 m Raj Building 150
Fazz Building to Jazz Building 25 m Fazz Building 15
Jazz Building to Harsh Building 170 m Jazz Bulding 25
Harsh Building to Fazz Building 125 m
Raj Building to Jazz Building 90 m

(a) Suggest a cable layout of connections between the buildings.


(b) Suggest the most suitable place (i.e. building) to house the server of this organisation with a
suitable reason.
(c) Suggest the placement of the following devices with justification:
(i) Internet Connecting Device/Modem
(ii) Switch
(a) The organisation is planning to link its sale counter situated in various parts of the same city,
which type of network out of LAN, MAN or WAN will be formed? Justify your answer.

Q3. Nootan Vidya Mandir in OOTY is setting up the network between its different wings. There are 4
wings named as SENIOR(S), MIDDLE(M), JUNIOR(J) and OFFICE(O).
Distance between the various wings are given below: Number of Computers
Wing O to Wing S 100m Wing O 10
Wing O to Wing M 200m Wing S 200
Wing O to Wing J 400m Wing M 100
Wing S to Wing M 300m Wing J 50
Wing S to Wing J 100m
Wing J to Wing M 450m

(i) Suggest a suitable Topology for networking the computer of all wings.
(ii) Name the wing where the server to be installed. Justify your answer.
(iii) Suggest the placement of Hub/Switch in the network.
(iv) Mention an economic technology to provide internet accessibility to all wings.
Q4. East and West Public Ltd. has decided to network all its offices spread in five buildings.

[ ] indicates the
Building Building total no. of
2 [45] 3 computers.
[110]
Building
1 [40]
Building Building
5 [70] 4 [60]

The distances between buildings are given below:


Between 1 & 2 20 Mts Between 3 & 5 70 Mts
Between 2 & 3 50 Mts Between 1 & 5 65 Mts
Between 3 & 4 120 Mts Between 2 & 5 50 Mts
Between 4 & 5 30 Mts Between 1 & 3 60 Mts
(i) Suggest cable layout(s) for connecting the buildings.
(ii) Suggest the most suitable building to install the server of this organization with a suitable
reason, with justification.
(iii) Suggest the placement of the following devices with justification?
(a) Hub/Switch
(b) Repeater
(iv) The company also has another office in the same city but at a distant location about 25-30 kms
away. How can link be established with this building? (i.e. suggest the transmission medium).

Q5. Standard Bank has set up its new center in India for its office and web based activities. It has five
buildings as shown in the diagram below:

A B C

D E
Distance between various buildings
A to B 50 Mts
B to C 30 Mts
C to D 30 Mts (a) Suggest a possible cable layout for connecting the
buildings.
D to E 35 Mts
(b) Suggest the most suitable place to install the server
E to C 40 Mts of this organization.
D to A 120 Mts (c) Suggest the placement of the following devices with
D to B 45 Mts justification.

E to B 65 Mts (i.) Hub/Switch


(ii.) Repeater
(d) The company wants to link its head office in ‘A’ building to its Office in Sydney
(i) Which type of transmission medium is appropriate for such a link?
(ii) What type of network this connection result into?

Anda mungkin juga menyukai