in-service course for pgts comp. sc - kvs...

355
- - 1 K K E E N N D D R R I I Y Y A A V V I I D D Y Y A A L L A A Y Y A A S S A A N NG G A A T T H H A A N N M MU U M MB B A A I I R R E E G G I I O O N N M M M å å å ü ü ü l l l S S S ì ì ì Ï Ï Ï r r r É É É Ì Ì Ì u u u É É É ± ± ± É É É s s s É É É r r r É É É x x x É É É Ç Ç Ç a a a É É É P P P è è è l l l É É É q q q É É É Ñ Ñ Ñ q q q o o o É É É D D D x x x É É É Ç Ç Ç p p p É É É É É É a a a É É É I I N N - - S S E E R R V V I I C C E E C C O O U U R R S S E E F F O O R R P P G G T T s s C C O O M MP P . . S S C C . . 0 0 3 3 - - 0 0 5 5 - - 2 2 0 0 1 1 0 0 T T O O 1 1 4 4 - - 0 0 5 5 - - 2 2 0 0 1 1 0 0 x x x É É É å åå u u u É É É É É É M M M ü ü ü É É É s s s É É É Ï Ï Ï l l l É É É m m m É É É ë ëë Í Í Í v v v É É É ¤ ¤ ¤ É É É h h h É É É m m m É É É É É É P P P è èè r r r É É É ¢ ¢ ¢ ü ü ü q q q É É É x x x l l l É É É É É É i i i M M M ü ü ü É É É å å å ¨ ¨ ¨ É É É U U U Í Í Í v v v É É É ¤ ¤ ¤ É É É M M M ü ü ü x x x É É É Ç Ç Ç a a a É É É h h h É É É M M M ü ü ü Ì Ì Ì u u u É É É ¥ ¥ ¥ É É É É É É l l l É É É 0 0 0 3 3 3 - - - 0 0 0 5 5 5 - - - 2 2 2 0 0 0 1 1 1 0 0 0 x x x É É É å å å 1 1 1 4 4 4 - - - 0 0 0 5 5 5 - - - 2 2 2 0 0 0 1 1 1 0 0 0 K K E E N N D D R R I I Y Y A A V V I I D D Y Y A A L L A A Y Y A A I I I I T T P P O O W WA A I I , , M MU U M MB B A A I I - - 7 7 6 6 M M M å å å ü ü ü l l l S S S ì ì ì Ï Ï Ï r r r É É É Ì Ì Ì u u u É É É ± ± ± É É É s s s É É É r r r É É É A A A É É É r r r É É É A A A É É É r r r É É É O O O û û û Ï Ï Ï , , , m m m É É É u u u É É É D D D , , , q q q É É É Ñ Ñ Ñ q q q o o o É É É D D D - - - 7 7 7 6 6 6

Upload: tranngoc

Post on 28-Mar-2018

248 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 1

KKKEEENNNDDDRRRIIIYYYAAA VVVIIIDDDYYYAAALLLAAAYYYAAA SSSAAANNNGGGAAATTTHHHAAANNN

MMMUUUMMMBBBAAAIII RRREEEGGGIIIOOONNN

MMMMMMMMMMMMåååååååå åååå üüüüüüüüüüüüllllllllllllSSSSSSSSSSSSìììììììì ìììì ÏÏÏÏÏÏÏÏÏÏÏÏrrrrrrrrrrrrÉÉÉÉÉÉÉÉÉÉÉÉ ÌÌÌÌÌÌÌÌÌÌÌÌuuuuuuuuuuuuÉÉÉÉÉÉÉÉÉÉÉɱ±±±±±±±±±±±ÉÉÉÉÉÉÉÉÉÉÉÉssssssssssssÉÉÉÉÉÉÉÉÉÉÉÉrrrrrrrrrrrrÉÉÉÉÉÉÉÉÉÉÉÉ xxxxxxxxxxxxÉÉÉÉÉÉÉÉÉÉÉÉ ÇÇÇÇÇÇÇÇ ÇÇÇÇ aaaaaaaaaaaaÉÉÉÉÉÉÉÉÉÉÉÉPPPPPPPPPPPPèèèèèèèè èèèè llllllllllllÉÉÉÉÉÉÉÉÉÉÉÉ qqqqqqqqqqqqÉÉÉÉÉÉÉÉÉÉÉÉ ÑÑÑÑÑÑÑÑ ÑÑÑÑ qqqqqqqqqqqqooooooooooooÉÉÉÉÉÉÉÉÉÉÉÉDDDDDDDDDDDD xxxxxxxxxxxxÉÉÉÉÉÉÉÉÉÉÉÉ ÇÇÇÇÇÇÇÇ ÇÇÇÇppppppppppppÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉaaaaaaaaaaaaÉÉÉÉÉÉÉÉÉÉÉÉ

IIINNN---SSSEEERRRVVVIIICCCEEE CCCOOOUUURRRSSSEEE FFFOOORRR PPPGGGTTTsss CCCOOOMMMPPP... SSSCCC...

000333---000555---222000111000 TTTOOO 111444---000555---222000111000

xxxxxxxxxxxxÉÉÉÉÉÉÉÉÉÉÉÉ åååååååååååå uuuuuuuuuuuuÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉMMMMMMMMMMMMüüüüüüüüüüüüÉÉÉÉÉÉÉÉÉÉÉÉssssssssssssÉÉÉÉÉÉÉÉÉÉÉÉÏÏÏÏÏÏÏÏÏÏÏÏllllllllllllÉÉÉÉÉÉÉÉÉÉÉÉ mmmmmmmmmmmmÉÉÉÉÉÉÉÉÉÉÉÉ ëëëëëëëë ëëëë ÍÍÍÍÍÍÍÍÍÍÍÍvvvvvvvvvvvvÉÉÉÉÉÉÉÉÉÉÉɤ¤¤¤¤¤¤¤¤¤¤¤ÉÉÉÉÉÉÉÉÉÉÉÉhhhhhhhhhhhhÉÉÉÉÉÉÉÉÉÉÉÉ mmmmmmmmmmmmÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉPPPPPPPPPPPPèèèèèèèèèèèèrrrrrrrrrrrrÉÉÉÉÉÉÉÉÉÉÉÉ¢¢¢¢¢¢¢¢¢¢¢¢üüüüüüüüüüüüqqqqqqqqqqqqÉÉÉÉÉÉÉÉÉÉÉÉ xxxxxxxxxxxxllllllllllllÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉiiiiiiiiiiiiMMMMMMMMMMMMüüüüüüüüüüüüÉÉÉÉÉÉÉÉÉÉÉÉ åååååååå åååå ¨̈̈̈̈̈̈̈̈̈̈̈ÉÉÉÉÉÉÉÉÉÉÉÉUUUUUUUUUUUU ÍÍÍÍÍÍÍÍÍÍÍÍvvvvvvvvvvvvÉÉÉÉÉÉÉÉÉÉÉɤ¤¤¤¤¤¤¤¤¤¤¤ÉÉÉÉÉÉÉÉÉÉÉÉMMMMMMMMMMMMüüüüüüüüüüüü xxxxxxxxxxxxÉÉÉÉÉÉÉÉÉÉÉÉ ÇÇÇÇÇÇÇÇ ÇÇÇÇ aaaaaaaaaaaaÉÉÉÉÉÉÉÉÉÉÉÉhhhhhhhhhhhhÉÉÉÉÉÉÉÉÉÉÉÉMMMMMMMMMMMMüüüüüüüüüüüü ÌÌÌÌÌÌÌÌÌÌÌÌuuuuuuuuuuuuÉÉÉÉÉÉÉÉÉÉÉÉ¥¥¥¥¥¥¥¥¥¥¥¥ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉllllllllllllÉÉÉÉÉÉÉÉÉÉÉÉ

000000000000333333333333------------000000000000555555555555------------222222222222000000000000111111111111000000000000 xxxxxxxxxxxxÉÉÉÉÉÉÉÉÉÉÉÉ åååååååå åååå 111111111111444444444444------------000000000000555555555555------------222222222222000000000000111111111111000000000000

KKKEEENNNDDDRRRIIIYYYAAA VVVIIIDDDYYYAAALLLAAAYYYAAA IIIIIITTT PPPOOOWWWAAAIII,,, MMMUUUMMMBBBAAAIII ---777666

MMMMMMMMMMMMåååååååååååå üüüüüüüüüüüüllllllllllllSSSSSSSSSSSSìììììììììììì ÏÏÏÏÏÏÏÏÏÏÏÏrrrrrrrrrrrrÉÉÉÉÉÉÉÉÉÉÉÉ ÌÌÌÌÌÌÌÌÌÌÌÌuuuuuuuuuuuuÉÉÉÉÉÉÉÉÉÉÉɱ±±±±±±±±±±±ÉÉÉÉÉÉÉÉÉÉÉÉssssssssssssÉÉÉÉÉÉÉÉÉÉÉÉrrrrrrrrrrrrÉÉÉÉÉÉÉÉÉÉÉÉ AAAAAAAAAAAAÉÉÉÉÉÉÉÉÉÉÉÉrrrrrrrrrrrrÉÉÉÉÉÉÉÉÉÉÉÉ AAAAAAAAAAAAÉÉÉÉÉÉÉÉÉÉÉÉrrrrrrrrrrrrÉÉÉÉÉÉÉÉÉÉÉÉ OOOOOOOOOOOOûûûûûûûûûûûûÏÏÏÏÏÏÏÏÏÏÏÏ,,,,,,,,,,,, mmmmmmmmmmmmÉÉÉÉÉÉÉÉÉÉÉÉuuuuuuuuuuuuÉÉÉÉÉÉÉÉÉÉÉÉDDDDDDDDDDDD,,,,,,,,,,,, qqqqqqqqqqqqÉÉÉÉÉÉÉÉÉÉÉÉ ÑÑÑÑÑÑÑÑÑÑÑÑqqqqqqqqqqqqooooooooooooÉÉÉÉÉÉÉÉÉÉÉÉDDDDDDDDDDDD------------777777777777666666666666

Page 2: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 2

KENDRIYA VIDYALAYA SANGATHAN MUMBAI REGION

Report Of

In - service course for

PGTs Computer Science

Director Mr.Cherian C. George

Principal, KV, IIT, Powai

Associate Director

Mr O.P. Chaube Vice Principal, KV, Koliwada

Resource Persons Mr Sandeep Sharma

KV No.1 Ahmednagar Mr.V.K.Soni

KV Ganeshkhind, Pune

03-05-2010 to 14-05-2010

KENDRIYA VIDYALAYA, IIT, POWAI

MUMBAI-400 076

Page 3: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 3

INDEX

Page 4: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 4

INDEX 1. ACKNOWLEDGEMENT

2. WORD FROM THE COURSE DIRECTOR

3. FOREWORD

4. PREFACE

5. TIME TABLE FOR INSERVICE COURSE (PGT COMP.SC.) 2010

6. LIST OF PARTICIPANTS

7. CONTACT NO. & EMAILS OF PARTICIPANTS

8. LIST OF DEMO LESSON ASSIGNED

9. LIST OF IDIVIDUAL TASK ASSIGNED

10. LIST OF PARTICIPANTS GROUP-WISE

11. DAILY REPORTS

12. DERIVED ROLE PGT(CS)

13. SHORT TEST – I (08-05-2010)

14. ERROR ANALYSIS OF SHORT TEST

15. SHORT TEST – II (11-05-2010)

16. GIST OF GUEST LECTURER

17. NAME OF THE WEBSITES FOR REFERNCE FOR THE TEACHERS

18. DEMO LESSON-PLAN

19. INDIVIDUAL TASK ASSIGNED

Page 5: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 5

Acknowledgement

Mrs.V.Vijayalakshmi I/C Joint Commissioner (Admin.)

KVS , New Delhi

Dr. Sachi Kant I/C Joint Commissioner (Acad.)

KVS, New Delhi

Shri. M. M. Joshi Deputy Commissioner (Acad I)

KVS , New Delhi

Mr. PRL Gupta Asstt. Commissioner KVS, RO, Mumbai

Shri N R Murali

Director, KVS ZIET, Mysore

Shri Avinash Dixit, IDAS

Commissioner, KVS New Delhi

Shri S. K.Verma

EO, KVS(MR) Shri Vasudev M.

EO, KVS(MR) Mrs. A. P. Bhalla

EO, KVS(MR)

Dr. V K Agarwal

Director, ZIET, Mumbai

Page 6: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 6

W ord from the Course D irectorW ord from the Course D irectorW ord from the Course D irectorW ord from the Course D irector A Veteran Teacher knows that a well organized classroom doesn’t simply happen. It needs a lot of training, planning and committed work. In - service training programmes are regular events in any organization with an objective to make this happen through improving knowledge, skills and modifying attitudes As far as this In-service course for PGTs Computer Science is concerned; it is unique, since it is a maiden experience to the participants ; secondly they are teachers who have handled Higher Secondary classes for the last one year, experienced the classroom environment and enjoyed their job profile most of them without undergoing a professional course in teaching methodology. Hence an attempt in the programme was leveled on the following lines:

• Content Enrichment

• Improving Teaching Methodologies

• Developing Attitudes The hall mark of professionalism is a constant striving to refine and improve their subject skills Efforts were made to enrich the content knowledge by interacting with the professors of IIT Bombay and various other subject experts. To impart teaching skills senior teachers of the host school and interactive teaching methods among the peer group were used. Sensitizing the participants to the organizational set up of KVS and to become familiar with its country wide unified objectives, the group was brought closer to their organization with their interaction with the officers of KVS, AAO, and the Associate Director. They were also given an insight into NCF, Life skills, CBSE, NCERT, Comprehensive Evaluation, Think.com, and such other activities closely associated with the KVS system. Addressing the affective concerns of an individual and to instill personal qualities that can help influence behaviour and performance in positive ways; classes in psychology, counseling, group management, group psychology, stress management, etc were imparted mainly through their interaction with the Associate Director and the Director of the course. An attempt was made to develop teacher attitudes through presentations incorporated into the assembly programmes. Since no specific text book is published by NCERT an attempt has been made to develop a comprehensive training module which can serve as a teacher tool to handle XI and XII classes. Hence the following were prepared by participants:

• Content mapping of around 20 lessons

• Question bank for XI and XII

• Sample papers with blue prints and marking scheme

• List of projects which can be undertaken

• Tentative split up syllabus Few innovative techniques adopted were prepared during the group work sessions and included in the manual. Field trips and cultural events took care of the finer aspects. As far as technology in class rooms is concerned the most recent tools of the Information age are the ones holding the greatest promise for improved teaching and learning. As subject

Page 7: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 7

experts in the filed of technology it is my earnest request to the participants to assist in the promotion of the following in their respective schools:

• Installing and facilitating use of technology in classrooms

• Helping teachers achieve competencies in word processing, preparing spread sheets, browsing the net for teacher resources

• Familiarizing teachers with the use of LCD, preparation of PPT, graphics, etc

• Exploring possibilities to link on- line access to libraries and public databases

• Preparing computerized simulators to teach various concepts

• Preparing software programmes for execution of various school related tasks As the new technology has made easy access to a number of new tools, accelerating globalization and knowledge explosion the responsibility of promoting their use in schools lie on PGTs in Computer Science. I am sure through this comprehensive programme of 12 days the individuals have been moulded as skilled teachers, balanced individuals, and healthy team members which was the ultimate target of the programme.

Cherian C. George

Course Director & Principal, KV, IIT, Powai

Page 8: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

F orew ordF orew ordF orew ordF orew ord

The In - service course for the PGTs Computer Science, Mumbai Region was conducted for the new recruits at K.V, IIT, Powai. It was a conscious effort taken to train them into the system, facilitate them into their role as teachers and help achieve role efficiency. I thank the Commissioner, KVS, HQ, Delhi, Mr.PRL Gupta , the Assistant Commissioner, Mumbai Region, Director ZIET, Mysore, Director, ZIET, Mumbai, Education Officers, and AAO of KVS, RO, Mumbai, for providing the opportunity and extending support and material resources to conduct this course at Kendriya Vidyalaya IIT, Powai. I also thank the Director IIT and all the learned professors at the Dept. of Computer Science IIT Bombay, for the infrastructural and intellectual resources they provided to the participants to enrich them professionally. It was a unique opportunity for the participants to be learners at the Dept. of Computer Science, IIT, Bombay and taste the erudite guest lectures of the faculty. I acknowledge the active participation of the Associate Director of the course Mr. O. P. Choube, Vice Principal, KV, Koliwada and also thank him for his commendable support and assistance in successful completion of the course. I congratulate the Resource Person Mr.Sandeep Sharma KV No 1 Ahmednagar & Mr. Vijay Kumar Soni KV Ganeshkhind, Pune and all the participants who have helped in preparation and compiling the manual of the In-service course, for their participation and above all, hope that the knowledge and exposure they have gained during the course would enable them productive utility in scaling heights of excellence as teachers.

Cherian C. George Course Director & Principal, IIT Powai

Editorial Committee

* Sandeep Sharma * Ghanshyam Mehar * Amit Dave

Cover Page designed by: * Sandeep Sharma Compilation:

* Sandeep Sharma Published By: Shri. Cherian C. George Principal KV IIT, Powai

Page 9: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 9

PrefacePrefacePrefacePreface The responsibility of conducting the In - service Course for the PGTs Computer Science was entrusted to me and I feel honoured that Kendriya Vidyalaya, IIT, Powai was chosen the venue. The rich ICT facilities available in the Vidyalaya and the scholarly ambience of the school being located in the premises of IIT, Bombay gave the participants a sense of satisfaction and an insight into the depth of the course materials entrusted into their hands to be passed on the student community. The main objective of the course was broadly classified into three domains– acquainting the participants with the KVS system and what Sangathan expects from them; the teacher as SELF focusing on subject expertise and traits needed to be a successful teacher; and the role of a teacher in society to initiate change and bring in transformation. Guest lectures comprising of diverse topics, preparing lesson modules on various topics, preparation of question bank in Computer Science, interactive sessions, peer group teaching and evaluation etc ensured that the participants spent useful time during their involvement in the course. I would like to thank the KVS authorities for the opportunity given to me. The programme was a great success due to the meticulous execution of the planning by Shri. O. P. Choube, the Associate Director of the course. I thank him for all the efforts taken. I thank the Chairman, VMC & Director, IIT for the valuable guidance given in organizing the programme in collaboration with the Dept. of Computer Science at IIT. I thank all the participants who have taken efforts in finalizing the booklet

Cherian C. George

Course Director & Principal, KV, IIT, Powai.

Page 10: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 10

KENDRIYA VIDYALAYA I.I.T. POWAI(MUMBAI)

Time Table for Inservice course (PGT Comp.Sc.) TIMETABLE FOR THE 12 DAY IN-SERVICE TRAINING PROGRAMME

Day/ Time

8:30 -8.45

08:45 - 09:15

09:15- 10:45 10.45-11.00

11.00-12.00 12.00-13.00 13.00 -

14.00

14.00-

15.30

15.30-

15.45

15.15-

17.30

3rd

M

ay

20

10

Guest Lecture Prof.Ranade

IITB

PRE TEST

4th

May

2

01

0 AC KVS RO

Mumbai

Region

Mr.Phawa KVS

RO MR

5th

May

2

01

0

Pro

f.

Ch

aud

hu

ri I

ITB

Mrs.Elsy Rani,

Comm. Skill

KV IIT Mumbai

Mrs.Usha, V.P.

KV IIT Mumbai

6th

May

2

01

0

Mrs.Sengupta

Communicati

on Skills

Mrs.Farida

Khan KV IIT

7th

May

2

01

0

Dr.

Su

man

a II

B

Sh. Cherian

C. Gorge,

Course

Director

Mrs.Elsy Rani,

Comm. Skill

KV IIT Mumbai

8th

May

2

01

0 Prof.Khedker

IITB Mrs. Deepthi Web Designing

Dem

o L

esso

ns

By

pa

rtic

ipa

nts

GR

OU

P W

OR

K

9th

May

201

0

Educational

Tour Educational Tour

Educational Tour

Educational Tour

10

th M

ay

20

10

Mrs. Elsy Rani

Communication Skills

KV IIT

11

th M

ay

20

10

P

rof

.Dh

aval

IIT

B

Shri S.K.Varma

EO KVS RO

Mrs.Nalini

Chavan

Value

Education

K.V. I.I.T.

12

th M

ay

20

10 Prof.

Karthik IITB

Prof. Krishna

Mohan,

I.I.T. Bombay

Mrs.P. Pal,

Lesson

Planning

KV IIT

13

th

May

20

10 TBD

IITB Mr. P. K. Pahwa

AO, KVS RO Mumbai

Dem

o L

esso

ns

By

pa

rtic

ipa

nts

GR

OU

P W

OR

K

14

th M

ay

20

10

Pra

yer

/ T

ho

ug

ht/

Rep

ort

Dir

ecto

r /

Ass

oci

ate

Dir

ecto

r

Mrs.Abha

Jambekar

KV IIT

Tea

Bre

ak

Prof.

Narayan,

I.I.T. Bombay

Group Work

Lu

nch

Bre

ak

VALE

DICT

ORY

Funct

ion

Tea

Bre

ak

VALE

DICT

ORY

Funct

ion

Page 11: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 11

KENDRIYA VIDYALAYA I.I.T. POWAI (MUMBAI REGION)

INSERVICE COURSE FOR PGT COMP.SC.

DURATION- MAY 3-14, 2010

Sr. No.

Name of the teacher Sex Name of KV Gen / OBC/

SC / ST Name of Region

1 Mr. Pankaj Singh M Rly. G'dham GEN AHMDEDABAD

2 Mr.Kapil Sehgal M ONGC Ankleshwar GEN AHMDEDABAD

3 Mr Amit Meena M Narmadanagar ST BHOPAL

4 Mr Ashwani M Karera ST BHOPAL

5 Mr M.S.Kirar M No.3 Bhopal OBC BHOPAL

6 Ms. Kritika F Andrews Ganj (2nd Sh.) SC DELHI

7 Sh. Ashutosh Pandey M Dantewada Gen JABALPUR

8 Mr. Sunil Kumar M Suranussi SC JAMMU

9 Mr. Dinesh Narwal M Suranussi SC JAMMU

10 Sh. Manoj Kumar M Leh SC JAMMU

11 Mr. S.N. Meena M Manauri Alld ST LUCKNOW

12 Mrs. Richa Chaudhary F COD Alld SC LUCKNOW

13 Sh. Sushil Mishra M New Cantt Alld Gen LUCKNOW

14 Smt.Swati Srivastava F K.V.IIM Lucknoow Gen LUCKNOW

15 Sh.Bhoopendra Navadya M Basti SC LUCKNOW

16 Sh. Ashish Kr.Joshi M No.1 Chakeri Knp Gen LUCKNOW

17 Mrs. Shruti Srivastava F panvel GEN MUMBAI

18 Mr. Ramesha K.S. M panvel SC MUMBAI

19 Mr. SREEJITH K V M ojhar2sh OBC MUMBAI

20 AMANDEEP KAUR F Sec 2 R K Puram GEN MUMBAI

21 Mr. Kamlesh Amin M 9BRD Pune SC MUMBAI

22 Mr. Raju L. Meena M No.2 AFS Pune ST MUMBAI

23 NITIN KUMAR JAIN M afs1pune GEN MUMBAI

24 Mr. Abrar Ali Choudhary M lonavala OBC MUMBAI

25 Mr. Amit Dave M I.I.T. Powai GEN MUMBAI

26 Ms. Rachana Katiyar F K.V.M.M. SADIQ NAGAR,N.Del OBC DELHI

27 Ms. Kavita F K.V. REWARI OBC DELHI

28 Ms. Seema Kersi F K.V. NO.2 ARMAPUR,KANPUR GEN LUCKNOW

29 Mr. Ghanshyam Mehar M K.V.NO.5 BHATINDA CANTT. SC CHANDIGARH

30 Mr. P. L. Meena M K.V. RECKONGPEO,HIMACHAL P. ST CHANDIGARH

NON-KV PARTICIPANT PARTICIPATED IN INSERVICE COURSE

31 Mr. Anup Kumar Bachhil M Ambuja Public School, Rabariyawas GEN RAJSTHAN

CATEGORY WISE BREAKUP:

GEN : 12 TOTAL NO. OF PRESENT : 31 SC 9 TOTAL NO. OF MALE PARTICIPANTS 23 ST : 5 TOTAL NO. OF FEMALE PARTICIPANTS 8 OBC : 5

TOTAL : 31

Page 12: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 12

KENDRIYA VIDYALAYA I.I.T. POWAI (MUMBAI REGION)

INSERVICE COURSE FOR PGT COMP.SC.

DURATION- MAY 3-14, 2010

Contact No. & Emails of participants SN Name Region Mobile DOB Email

1 Pankaj Singh AHMDEDABAD 9638259217 7/6/1976 [email protected]

2 Mr.Kapil Sehgal AHMDEDABAD 9558663502 8/15/1975 [email protected]

3 Mr Amit Meena BHOPAL 9424866816 9/27/1980 [email protected]

4 Mr Ashwani BHOPAL 9907474783 8/26/1979 [email protected]

5 Mr M.S.Kirar BHOPAL 9827375135 1/1/1980 [email protected]

6 Ms. Kirtika DELHI 9868892485 6/5/1984 [email protected]

7 Sh. Ashutosh Pandey JABALPUR 9755913651 8/19/1982 [email protected]

8 Mr. Sunil Kumar JAMMU 9878920190 5/10/1971 [email protected]

9 Mr. Dinesh Narwal JAMMU 9815908770 2/18/1984 [email protected]

10 Sh. Manoj Kumar JAMMU 8871129219 2/28/1979 [email protected]

11 Mr. S.N. Meena LUCKNOW 9616320343 2/8/1986 [email protected]

12 Mrs. Richa Chaudhary LUCKNOW 9451942984 5/17/1980 [email protected]

13 Sh. Sushil Mishra LUCKNOW 9616388451 8/15/1975 [email protected]

14 Smt.Swati Srivastava LUCKNOW 9389465867 9/28/1982 [email protected]

15 Sh.Bhoopendra Navadya LUCKNOW 9838823807 9/1/1982 [email protected]

16 Sh. Ashish Kr.Joshi LUCKNOW 9794989656 71/1/84 [email protected]

17 Mrs. Shruti Srivastava MUMBAI 9969767322 6/16/1980 [email protected]

18 Mr. Ramesha K.S. MUMBAI 9702343805 10/19/1975 [email protected]

19 SREEJITH K V MUMBAI 9049804646 2/5/1981 [email protected]

20 AMANDEEP KAUR MUMBAI 9213232884 10/6/1979 [email protected]

21 Mr. Kamlesh Amin MUMBAI 9766379050 5/21/1977 [email protected]

22 Mr. Raju L. Meena MUMBAI 9011833566 7/7/1979 [email protected]

23 NITIN KUMAR JAIN MUMBAI 9225623897 4/13/1980 [email protected]

24 Mr. Abrar Ali Chowdhary MUMBAI 9623150251 11/16/1980 [email protected]

25 Mr. Amit Dave MUMBAI 9987077055 4/27/1978 [email protected]

26 Ms. Rachana Katiyar DELHI 9718800223 8/15/1981 [email protected]

27 Ms. Kavita DELHI 9416010089 23/2/78 [email protected]

28 Ms. Seema Kersi LUCKNOW 9621139720 3/10/1983 [email protected]

29 Mr. Ghanshyam Mehar CHANDIGARH 9465294009 20/6/84 [email protected]

30 Mr. P. L. Meena CHANDIGARH 9805724472 7/1/1983 [email protected]

31 Mr. Anup Kumar Bachhil RAJASTHAN 9413738808 5/15/1975 [email protected]

1 Mr. Vijay Soni MUMBAI 9370969320 11/7/1969 [email protected]

2 Mr. Sandeep Sharma MUMBAI 9763073103 2/26/1979 [email protected]

Page 13: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 13

KENDRIYA VIDYALAYA I.I.T. POWAI (MUMBAI REGION)

INSERVICE COURSE FOR PGT COMP.SC.

DURATION- MAY 3-14, 2010

LIST OF DEMO LESSON ASSIGNED

SN Name Demo Lesson

1 Pankaj Singh Computer fundamentals

2 Mr.Kapil Sehgal Intro to C++

3 Mr Amit Meena Boolean Algebra

4 Mr Ashwani SQL- DDL,DML

5 Mr M.S.Kirar Stack, Queue, Linked List

6 Ms. Kritika RDBMS – database fundamentals

7 Sh. Ashutosh Pandey Front-End Interface Component in Java

8 Mr. Sunil Kumar Front-End and Database Connectivity in Java

9 Mr. Dinesh Narwal Programming Guidelines - Java

10 Sh. Manoj Kumar Flow of Control - Java

11 Mr. S.N. Meena Computer fundamentals

12 Mrs. Richa Chaudhary Flow of Control – C++

13 Sh. Sushil Mishra OOPS

14 Smt.Swati Srivastava Constructor- Destructor

15 Sh.Bhoopendra Navadya Data File Handling

16 Sh. Ashish Kr.Joshi Stack, Queue, Linked List

17 Mrs. Shruti Srivastava RDBMS – database fundamentals

18 Mr. Ramesha K.S. My SQL -functions

19 SREEJITH K V Open Source concept

20 AMANDEEP KAUR RDBMS - Constraints

21 Mr. Kamlesh Amin Front-End Interface Component in Java

22 Mr. Raju L. Meena Programming Guidelines - Java

23 NITIN KUMAR JAIN Flow of Control - Java

24 Mr. Abrar Ali Chowdhary Arrays 1D & 2D

25 Mr. Amit Dave My SQL -functions

26 Ms. Rachana Katiyar SQL- DDL,DML

27 Ms. Kavita Data File Handling

28 Ms. Seema Kersi Functions

29 Mr. Ghanshyam Mehar Constructor- Destructor

30 Mr. P. L. Meena Stack, Queue, Linked List

31 Mr. Anup Kumar Bachhil HTML

Page 14: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 14

KENDRIYA VIDYALAYA I.I.T. POWAI (MUMBAI REGION)

INSERVICE COURSE FOR PGT COMP.SC.

DURATION- MAY 3-14, 2010

LIST OF IDIVIDUAL TASK ASSIGNED

SN Name Task

1 Pankaj Singh Unit wise Q/A for slow achievers - XI CS

2 Mr.Kapil Sehgal Unit wise Q/A for slow achievers - XII CS

3 Mr Amit Meena HOTS chapter wise - XII IP

4 Mr Ashwani Split up syllabus - XI & XII CS

5 Mr M.S.Kirar Split up syllabus - XI & XII IP

6 Ms. Kritika Q. paper, Marking Scheme, Blue print - XI CS (2 Set)

7 Sh. Ashutosh Pandey Lesson Plan & Content mapping - XII IP (any 4 topic)

8 Mr. Sunil Kumar Question Bank for Home Assignment - XI CS

9 Mr. Dinesh Narwal Question Bank for Home Assignment - XII CS

10 Sh. Manoj Kumar Question Bank for Home Assignment - XI IP

11 Mr. S.N. Meena Question Bank for Home Assignment - XII IP

12 Mrs. Richa Chaudhary Programs for practical assignment with solution - XII CS (chapterwise)

13 Sh. Sushil Mishra Programs for practical assignment with solution - XI IP (chapterwise)

14 Smt.Swati Srivastava Programs for practical assignment with solution - XII IP (chapterwise)

15 Sh.Bhoopendra Navadya List of Projects with detailed specification of each - XI CS

16 Sh. Ashish Kr.Joshi List of Projects with detailed specification of each - XI IP

17 Mrs. Shruti Srivastava Q. paper, Marking Scheme, Blue print - XI CS (2 Set) Unit Test - I

18 Mr. Ramesha K.S. Q. paper, Marking Scheme, Blue print - XII CS (2 Set) Unit Test - I

19 SREEJITH K V Q. paper, Marking Scheme, Blue print - XI IP (2 Set) Unit Test - I

20 AMANDEEP KAUR Q. paper, Marking Scheme, Blue print - XII IP (2 Set) Unit Test - I

21 Mr. Kamlesh Amin Q. paper, Marking Scheme, Blue print - XI CS (2 Set) Unit Test - II

22 Mr. Raju L. Meena Q. paper, Marking Scheme, Blue print - XI IP (2 Set) Unit Test - II

23 NITIN KUMAR JAIN Q. paper, Marking Scheme, Blue print - XII IP (2 Set) Unit Test - II

24 Mr. Abrar Ali Chowdhary Tips for improvement & maintenance of ICT in KV

25 Mr. Amit Dave Lesson Plan & Content mapping - XII CS (any 4 topic)

26 Ms. Rachana Katiyar Unit wise Q/A for slow achievers - XI IP

27 Ms. Kavita List of Projects with detailed specification of each - XII CS

28 Ms. Seema Kersi HOTS chapter wise - XI CS

29 Mr. Ghanshyam Mehar HOTS chapter wise - XII CS

30 Mr. P. L. Meena HOTS chapter wise - XI IP

31 Mr. Anup Kumar Bachhil Q. paper, Marking Scheme, Blue print - XII CS (2 Set)

Page 15: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 15

KENDRIYA VIDYALAYA I.I.T. POWAI (MUMBAI REGION)

INSERVICE COURSE FOR PGT COMP.SC.

DURATION- MAY 3-14, 2010

LIST OF PARTICIPANTS GROUP-WISE

SN Name KV Group Topic of Group Work

1 Pankaj Singh Rly. G'dham G1

2 Mr Amit Meena Narmadanagar G1

3 Mrs. Shruti Srivastava panvel G1

Problem Based Learning

4 Mr.Kapil Sehgal ONGC Ankleshwar G2

5 Mr Ashwani Karera G2

6 Mr. Ramesha K.S. panvel G2

Aims & Objectives of Education

7 Mr M.S.Kirar No.3 Bhopal G3

8 Mr. S.N. Meena Manauri Alld G3

9 SREEJITH K V ojhar2sh G3

Co-curricular Activities E magazine

10 Ms. Kirtika Andrews Ganj (2nd Sh.) G4

11 Sh. Sushil Mishra New Cantt Alld G4

12 Mr. Kamlesh Amin 9BRD Pune G4

Tips for maintaining ICT

13 Sh. Ashutosh Pandey Dantewada G5

14 Mrs. Richa Chaudhary COD Alld G5

15 Mr. Raju L. Meena No.2 AFS Pune G5

NCF 2005

16 Mr. Sunil Kumar Suranussi G6

17 Smt.Swati Srivastava K.V.IIM Lucknoow G6

18 NITIN KUMAR JAIN afs1pune G6

Stress Management

19 Mr. Dinesh Narwal Suranussi G7

20 Sh.Bhoopendra Navadya Basti G7

21 AMANDEEP KAUR Sec 2 R K Puram G7

Right to Education

22 Sh. Manoj Kumar Leh G8

23 Sh. Ashish Kr.Joshi No.1 Chakeri Knp G8

24 Mr. Abrar Ali Chowdhary lonavala G8

Personality Development

25 Mr. Amit Dave KV IIT Mumbai G9

26 Ms. Rachana Katiyar K.V.M.M. SADIQ NAGAR,N.Del G9

27 Mr. P. L. Meena K.V. RECKONGPEO,HIMACHAL P. G9

Communication Skills

28 Ms. Kavita K.V. REWARI G10

29 Ms. Seema Kersi K.V. NO.2 ARMAPUR,KANPUR G10

30 Mr. Ghanshyam Mehar K.V.NO.5 BHATINDA CANTT. G10

31 Mr. Anup Kumar Bachhil Ambuja Public School, Rabariyawas G10

Design of Question Papers

Page 16: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 16

DAILY REPORT

Page 17: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 17

Report - Day 1 (03/05/2010, Monday) The In-service Course for PGTs (Computer Science) started with the morning assembly under the guidance Mr. O. P. Choubey (Vice Principal) KV Koliwada and the course Director Mr. Cherian C. George, Principal, KV IIT Powai. The Director of the course gave a detailed and comprehensive guideline to the participants on the objectives of the course and about the role and responsibility of the participants that is obligatory to ensure successful completion of the course. After that, introduction of all participants was conducted followed with their feedback on three topics regarding:

1) The qualities liked in a teacher 2) The qualities disliked in a teacher 3) Expectations from In Service Course

After this event, all participants appeared in a Pre Test of 02:00 hrs and then they proceeded to lunch. After lunch, the course Director Mr. Cherian C. George guided all participants regarding boarding and hostel accommodation arranged at IITB by the host school. Then Vice Principal Mr. O. P. Chobey gave his valuable suggestions and motivated the participants. At 03:30 pm two Guest Speakers Prof. Uday Khedker HoD Dept of CS and Prof. Abhiram G. Ranade Ex-HoD IITB officially inaugurated the In Service Course. Both Professors also were proud of being ex-KVians and expressed their readiness to always help KVians. A short lecture was delivered by Prof. Uday in which he emphasized on implementation of whatever is being taught to children. Prof Ranade presented his views on topic “Technology, Education and Fun” in which he emphasised on teaching computers is a fun way method. He also discussed interesting programming languages like LOGO and Scratch which are helpful in creating interest in maths and technology. Vote of thanks to these Technocrats was given by Mr, O. P. Choubey. At last Mr. Sandeep Sharma gave a demonstration on how to present a lesson plan and demo lesson.

Prepared by Group-1 1. Mr. Pankaj Singh, KV Railway Gandhidham 2. Mr. Amit Meena, KV Narmadanagar 3. Mrs. Shruti Srivastava, KV Panvel

Report -Day 2 (04/05/2010, Tuesday)

The day started with the Assembly at 8.30am sharp conducted by Group-1. After the assembly the Course Director gave instruction to make the assembly more effective. He also advised us to follow the following points in a proper manner; they are 1) Prayer 2) Report 3) Thought of the Day 4) Special Item. The Course Director discussed the Role of PGT(CS) in KVS. The following points were highlighted: 1) Profile of the teacher 2) Managing the Computer Lab 3) Stake holder concept related to give and take policy and assigned some tasks to the participants related to the stake holder concept.

Page 18: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 18

Thereafter Professor P Choudary, Department of CS , IIT Bombay, delivered a Guest Lecture for nearly 02 hours about C++ , Pointer, Linux, Selection Sort, Sorting Algorithm, Dynamic Memory Allocation, Insertion Sort and Matrix Multiplication problems through OOP concepts.. After tea break, The Course Associate Director, given information about Relieving and Joining Order on duty and also the importance of joining report, Medical fitness certificate etc. Thereafter the Ist Demo Lesson given by Mr. Pankaj Singh on Computer Fundamental was helpful to the participants. He covered Hardware, Software and Basics of Computers. His Binary calculation through teaching Aids was appreciated by everybody. 2nd Demo Lesson started just after finishing 1st one, by Amit Meena, the topic was Boolean algebra, and He covered all Logical operation which was helpful to design electrical circuit. The Course Director gave suggestion to the participants that the Demo lessons should not be Lecture method but rather interactive. After Lunch from 1.00pm to 2.00pm, 3rd Demo Lesson was presented by Smt. Shruti Srivastav, the topic was RDBMS concept, and her lesson was appreciated by all the participants. And she covered File System, DataBase Technology, DBMS, and Data Base Administrator etc. In the post noon session the Honourable Assistant Commissioner of Mumbai Region Sh. P R L Gupta addressed the participants on current Technology, Data abstraction & Encapsulation, Unix Platforms, Front end and Back end and give more stress on real Projects assigned to the Students . He explained how to assign the projects and mentioned the areas like Library Condemnation process software etc., and how to maintain Networks in the School. Then after Vote of thanks to Honourable Assistant Commissioner, Mumbai Region Sh. P R L Gupta was given by Associative Director, Mr, O. P. Chobey. Then after Tea break, Lab work was given to the Participants and thus ended 2nd Day of In-service Course.

Prepared By Group-02

1) Mr. Ramesha K.S.

2) Mr. Kapil Sehgal

3) Mr. Ashwani

Report -Day 3 (05/05/2010, Wednesday)

The day started with morning assembly at 8.30am conducted by Group number 2. It was more attractive than previous day. The course director Mr.Cherian C. George appreciated the improvement and gave more suggestions for future plans. After the session, the Course Director interacted with the participants and projected a multimedia presentation. He explained not only the role of the PGT Computer science, but also the difference between their role and job. Participants asked queries regarding their job profile. He answered all the questions and the session ended in a joyful atmosphere. After that Mr. Choudary, Professor, Department of CS, IIT Bombay, continued his previous day’s lecturer. He explained the arrays concept in depth. The session was interactive and he demonstrated the data file handling programs with the help of a compiler. He covered the topics on file creation, data insertion in to file, searching,

Page 19: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 19

appending etc and also executed some graphics based programs. During the lecture practically explained the concept of file handling. He said that it depended on the system and the file system depended on the operating system. The session was content based and described the problems during the execution time. Another interesting thing was that the all got an opportunity to understand new compiler other than Turbo C++. The compiler successfully executed filename.hpp in Mac OS. That was a new experience to all participants. He also explained the differences of modes like app, ate, trunk etc in data file handling. The use of ‘const’ in different ways in a program was really fruitful to all and he concluded the seminar with a good interaction. After the seminar and tea break the Associate Course Director Mr. O.P.Chobey introduced Mrs. Usha Raghuram, Vice principal, KV IIT powai. She explained the duties and responsibilities of different committees in the vidylaya like Exam, Admission, Time table, CCA etc. Some participants queried their doubts. The lunch break was between 1.15 to 2.15 PM. After the delicious lunch the demo lessons by the participants started at 2.30 P.m. The first lesson started at 2.30 P.M by Mr. Ramesh K.S., KVONGC Panvel, and the topic was MySQL functions. He covered the string functions like Ltrim, Ucase, Lcase, Rtrim,Ltrim, LEFT, RIGHT ETC. Second demo Lesson started just after finishing 1st one by Mr. Kapil Sehgal , KV ONGC Ankleshwar, and the topic was Introduction to C++. He explained about character set, keywords, constant, Escape sequence etc. After the tea break, third demo lesson started by Mr. Ashwani, KV Karera, and the topic was SQL- DDL and DML. He explained about DDL commands like create, alter etc. and after the practical activity of the participants the third day ends.

Prepared By Group-03

4) SREEJITH KVAFS Ojhar, Second Shift

5) M.S. Kirar, K.V. No.3, Bhopal

6) S.N. Meena, KV Manauri Alld

Report -Day 4 (06/05/2010, Thursday)

The fourth day of the in-service course started with the morning assembly sharply at 8.30 a.m. It was

organized by the members of group 3: (1) Mr. M. S. Kirar, KV 3 (Bhopal Region) (2) Mr. S. N. Meena Alld (Lucknow Region) (3) Mr. Sreejith K V, KV Ojhar2 AFS (Ahmedabad Region).

After the completion of the morning assembly, there was Guest Lecture by Prof. Sumana Srinivasam on

“Programming with Java”. She explained various concepts of Java and C++ programming languages related to OOPs concepts and Java “Ecilips” in practical demo, at the time, all the participants were engaged in practical work parallel.

After tea break, Mr. O.P. Choube Associate Director, interacted with the participants and gave useful

information about the condemnation process, stock register etc., and important documents to be maintained for this process such as copy of challan, copy of condemnation order, and copy of auction order.

Page 20: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 20

Thereafter, Smt. Sen Gupta delivered lecturer on the topic of Communication Skills, She gave detailed information of Communication Skills, and interacted with Participants and it was so interesting, the participants understood so many skills of communication. And she quoted skill should be shared and then only communication will takes place effectively.

Smt. Farida, PGT Bio, KV, IIT Powai delivered demonstration of New ideas of Teaching methodology and

gave valuable information for Teachers. These methodologies can be utilizes in schools for the benefit of students.

After lunch break from 1.00pm to 2.00pm, Sh. S.K. Verma, E.O. Mumbai Region, arrived and gave

assignment work for all the groups to check the website of KVs of Mumbai Region and E.O. Sir informed, sort out the data of admission. The participants were engaged in Computer work from 2.00 to 5.30pm and submitted their assigned work.

In this way Day 4 was successfully completed.

Prepared by Group 4 1. Mr. Kamlesh Amin KV 9 BRD, Pune (Mumbai Region) 2. Mr. Sushil Mishra K.V. Newcantt. Alld, (Lucknow Region) 3. Ms. Kritika KV Andrews Ganj(2nd Shift) (Delhi Region)

Report -Day 5 (07/05/2010, Friday)

Yesterday morning assembly was conducted by Group four under the leadership of Mr. Kamlesh . The

Special Item presented by Ms. Kritika, who gave valuable information about certain errors in MS-office was appreciated by all. The thought of the day was presented by Mr Sushil Mishra

Comments and suggestions for the improvement of morning assembly were given by the Participants & Mr. Choubey Sir, our Associate Director. In the morning session the Principal & Course Director of the Program discussed about what we have learned from previous day’s guest lectures. He also gave valuable information about- why KVS is an autonomous body, types of funds - S F & VVN accounts of our Vidyalaya . Next session was followed by Professor Sumana Srinivasan . She told us about new IDE-ELIPSE. It was very innovative lecture and all participants actively participated in the lecture. She explained about the Test Driven Development Benefits and use of util classes-creation of own objects. After Tea Break Mrs. Elsy Rani(PGT – Eng) of this Vidayalaya, taught us about communication skills, body language, gestures through games, activities and question- answer technique. Then at 1:00 PM we had lunch –break. After the lunch break Mr. Chaubey Vice principal & Associate Director gave the idea & precautions about maintenance of stock register, lab and lab entry record for staff using computers. After that Demo Lessons were presented by group three & four .

1. Mr. M.S.Kirar – Gave the concept about Stack and Queue.

2. Mr. S.N. Meena – Illustrated about Computer Fundamentals.

3. Mr. Sreeejith KV – Illustrated the concept about Open Source Software in a group discussion and

activity based teaching form which was appreciated by one and all.

4. Mr. Sushil Mishra – Gave the concept of OOPs.

Page 21: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 21

5. Mr. Kamlesh – illustrated the concept of Front-End Interface in Java.

6. Ms. Kritika – about RDBMS basis.

Each demo lesson was followed by the comments and suggestions by the participants and Associate Director. The day was concluded by valuable suggestions of Mr. Choubey Sir, to develop interest among students while teaching, Mr. Sandeep - Resource person of this course gave some useful points about Java and & Mr. Soni - Resource person gave additional information on Think Quest.

Prepared by Group 5

1. Sh. Ashutosh Pandey Dantewada

2. Mrs. Richa Chaudhary COD Alld

3. Mr. Raju L. Meena No.2 AFS Pune

Report -Day 6 (08/05/2010, Friday)

The day began with the morning assembly conducted by Group – 5 under the leadership of Mr. Ashutosh Pandey, KV Dantewada . Thought was presented by Mr. Raju Lal Meena , KV No.2, AFS, Pune, News and Special item was presented by Ashutosh Pandey, KV Dantewada and finally previous day’s report was presented by Mrs. Richa Sharma, KV Old Cantt Allahabad, Cheoki. All the items were presented in well organized manner and with proper coordination. After that two participants among us namely Mr. Pankaj Singh, KV Rly G’dham and Mrs. Shruti Srivastava, KV Panvel were honoured for their overall best presentation and participation during 05 days by Mr. Cherian C. George, Principal, KV, IIT, Powai, Mumbai and Mr. O.P. Choubey, Vice Principal, KV Koliwada. Soon after, the Principal of the vidyalaya recapitulated the previous day contents regarding purchase in vidyalaya by asking questions to the participants and then he continued the same topic and gave some valuable information of how to utilize the funds . He also told us some key points of condemnation that should be kept in mind. After that Mr. O.P. Choubey sir told us the difference between quotation and tender and benefit of having quotation in advance. Soon after post test was conducted for20 marks covering the syllabus , demo lessons, lectures delivered from 03.05.2010 to 07.05.2010. Then we had tea break and was followed by a lecture on self learning delivered by Mr. Uday Khedkar , HOD of Comp.Sc. Dept. of IIT , Powai, Mumbai. He illustrated the concept through ppt, some mathematical & logical calculation with some group activities, story of IIT etc. and we came to know how we can motivate our student to face the changing world, how to tell them hard & soft skills. It was followed by Vote of Thanks given by Mrs. Richa , then after having our lunch we attended another lecture on web designing by Ms. Deepti Gala, designer of website of KVS, RO, Mumbai Region, KV Thane, IIT etc. She explained about some software of web designing and gave valuable suggestions on how to update website in an effective manner. She cleared doubts and queries of all the participants by opening website and giving demo on using Flash Software. After that interesting session , 3 - demo lessons through power point presentation were given by 3- members of group- 5. Firstly Mr. Ashutosh Pandey explained the concept of OOP with some new technology giving advantage of all the concepts and there was involvement of all participant. Secondly Mrs. Richa illustrated the concept of Flow of control and new technology and invited students to perform on the board. Finally Mr. Raju Lal Meena explained the concept of Programming Guidelines with some stylistic view and good contents.

Page 22: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 22

And the day ended with some instructions , suggestions and planning of excursion on 09.May.2010, Sunday by Mr. O.P. Choubey. Prepared by Group 6 Mr. Sunil Kumar Suranussi

Smt.Swati Srivastava K.V.IIM Lucknoow

NITIN KUMAR JAIN afs1pune

Report -Day 7 (09/05/2010, Saturday) The day started with enthusiasm and excitement in the mind of participants to enjoy Mumbai Darshan. We started the trip from IIT campus at 8.30 AM after having our breakfast. First, we went to GATEWAY OF

INDIA, the Entrance of India through sea, and saw Taj Hotel there and enjoyed the sea-view. Then we moved to Chattrapati Shivaji Museum and Art Gallery. In the museum we saw historical sculptures prepared by ancient people, collection of old coins, kingdom of birds and animals through statues and Tata Art Gallery displays belonging to Tata family. Soon after we visited Jahangir Art Gallery in which different paintings of three artists were displayed. Paintings of Anant Mandel were so exciting and marvelous that even though we were in Mumbai , a clear scene of Calcutta streets were before our eyes. We refreshed and had our lunch at Hanging Gardens while enjoying the beauty of nature. According to Mantra:

“Om Lakshmi Ganesh Brahma Vishnu Mahesh, Mam Karat Pap Shap

Santap Door Karo mera Kast Haro. Ommmm !”

We all went to the Lap of Almighty God at Maha Lakshmi Temple and Baba Haji Ali Dargah respectively and found our peace of mind. Till this time we had totally forgotten that we are PGT Computer Science teachers of Kendriya Vidyalayas but as we entered the Nehru National Science Centre and saw the innovative and creative projects such as puzzles, magics, new technique quiz based on sound, light, vision etc., we felt encouraged to motivate our students to be innovative. From Nehru Science Centre we went to Juhu Chaupaty through Worli Sea Link. The day ended with a photo session of the participants at Juhu Chaupaty, capturing the sweet memories spent together and then moved to our respective hostels, had our dinner and planned for the next day session. Thank you.

Prepared by Group 7 Mr. Dinesh Narwal Suranussi

Sh.Bhoopendra Navadya Basti

AMANDEEP KAUR koliwada

Report -Day 8 (11/05/2010, Monday)

The day started with prayer song presented by Group 6 and Group 7 together, followed by thought given by Shri Dinesh Narwal, KV Suranssi, Jammu Region. Shri Bhoopendra Navadya, KV Basti, Lucknow Region presented the news followed by the report of day 6 by Smt. Swati Shrivastav, KV IIM Lucknow, Lucknow Region. The Assembly concluded with the report of Day 7 by Smt. Amandeep Kaur, KV Koliwada, Mumbai Region just after the special item given by Shri Dinesh Narwal on CCE. Our Associate Director, Shri O. P. Chaubey then discussed on Personal File and Service Book. He not only made the participants aware of the importance of Personal File but also informed about the important documents that should be filed in the Personal File and its order. He also explained the difference between a Personal File and Service Book and concluded his lecture by advising that all the information and documents should be updated if any change takes place.

Page 23: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 23

At 10’O clock, Mr. Naval Bonde, pursuing his M. Tech from IIT Powai, gave us the lecture on Netbeans and Java. In spite of very short duration of time, he made all the participant to work with NetBeans and Java very conveniently. He briefly explained the topics Java, IDE and NetBeans features with the help of sample programs in a very effective manner. Vote of thanks was given by Smt. Amandeep Kaur. Then started the most interesting class of the day, for which the participants were eagerly waiting for. The class was very interesting and the interactions of all the participants were up to the mark. It was a class on Pronunciation and Phonetics taken by Smt. Elsy Rani - PGT (English), KV IIT Powai. She had not only given exercises in pronunciation, stress and intonation but also made the minds of the participants active by her way of teaching. Then participants went for lunch and demo lessons were presented by the members of Group 6 and Group 7 thereafter. Demo lessons on “Flow of Control” by Shri Nitin Jain, KV AFS1 Pune, Mumbai Region, “Class and Constructors” by Shri Swati Shrivastava, “Front End and Database Connectivity in Java” by Shri Sunil Kumar, KV Suranssi, Jammu Region, “Software Design and Programming Guidelines by Shri Dinesh Narwal, “Data File Handling” by Shri Boopendra Navadya were conducted and concluded by Smt. Amandeep Kaur on “RDBMS Constraints”. All the demo lessons were very interactive and enthusiastic. The presentations were very good and appreciated by all. The day concluded by our Asst. Director Shri O. P. Chaubey advising all the participants that the energy, activeness, interaction and the talents shown till date should be there till the last day of this In-Service Course. He also informed the participants about the Cultural program that will be presented on the 11th day, by the participants. Presented By Group 8

Mr.Abrar Ali KV Lonawala

Mr.Ashish Kumar Joshi KV No 1 Chakeri

Mr.Manoj Kumar KV Leh

Page 24: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 24

GROUP – 01 DAILY REPORT

DAY – 11 Morning Assembly conducted by Group -10 Group members are Mr. Anup , Mr. Ghanshyam, Mrs. Kavita and Ms. Seema. Thought was given by Mr. Ghanshyam, special item was given by Mr. Anup presented power point slide social issue of not wasting of food. News was given by Ms. Seema .Daily report was given by Mrs. Kavita using interactive photos of the previous day. Then we all get together for a group photo session for capturing sweet memories of the Course. After that Mr. Chobey, Associate Director delivered lecture on CBSE examination, rules and regulations by giving different examples which is very fruitful for us. Mr. Vijay Kumar Soni gives us very important tips on Lab Maintenance like creating account, administrator control maintaining the register, security of Internet surfing and blocking the unwanted sites on computers. In the same session Mr. Amit Dave and Mr. Ghanshyam gave some useful information about preventive unwanted access to computers from students. After that Mr. Cherian C. George, Course Director introduces Mr. P.K. Pahwa Audit and Account Officer, Mumbai region and Mr. Padmanabhan Sr. Account Officer Mumbai region. Both personalities delivered valuable information on purchase procedure, personal claims as well as NPS. They solved all the queries of the entire participant in a satisfactory way. Then we had our delicious and quick Lunch and prepared for the post test which was of 30 marks conducted by the resource persons. By relaxing from the Post Test. All the participants enjoyed their tea break. Then Demo Lesson was presented by group 10 members one by one. First demo lesson was given by Mr. Anup from Ambuja Public School , Pali on HTML programming in which he gave us the nice information on creating web pages using HTML tags. Second demo lesson was given by Mrs. Kavita from KV, Rewari on File Handling in C++ in a very sober and interactive way. Third demo lesson was given by Mr. Ghanshyam from KV, No.5 Bhatinda on Virus in which he gave us the very new information about virus its types and its harmful attacks on computers. Last demo lesson was given by Ms. Seema Kesri from KV No. 2 Armapur Kanpur function in C++ on in a very interactive manner and involvement of students in her class. Then a refreshing cultural programme was given by the participants. The program anchors Mrs. Amandeep and Mr. Pankaj started the program by welcoming the Director, Associate Director and Resourse persons by Kabir doha. Group song “Achutam keshvam” of Lord Krishna was given by Mrs. Shruti and group which really touches everybody’s heart Then Mr. Pankaj told us the joke on the corruption which really insists us to think about the level of corruption. Then Mr. Shreejith and group presented very enjoying skits on CS Channel which was enjoyed by everybody. Mrs. Swati Srivastava presented her own written poem on “The responsibilities of a teacher” which was full of enthusiasm.

Page 25: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 25

Then Mr. Sunil Kumar mimics the song in different way which was full of fun. Then Mrs. Kavita delivered the shero-shayari which was really appreciable. Then Mr. Amit Meena and group presented a mono act on “Home of different religions” which was really touchable. Then presentation on sweet memories was given by Mrs. Rachna and Ms. Kiritika in power point which was unforgettable. A Hindi poem “Jeevan ki Paribhashayen” was presented by Mr. V.K. Soni which was heart throbbing. Again a poem on “Pal” was presented by Mr. Pankaj which was inspiring. At last vote of thanks was given by Mr. Nitin Jain on the behalf of all the participants. The program was wind up with the appreciation note given by Mr. Cherian and Mr. Chobey.

THANK YOU

Page 26: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 26

Derivation of my role as Post Graduate Teacher in Computer Science during the training programme under the direction of Shri. Cherian C George, Director, We have derived the role of PGT Comp. Sc.

• To bring Quantity and Quality – wise result.

• Maintenance of proper Performance Index.

• TO be Loyal towards the duty.

• Updation & maintenance of website of school.

• Timely completion of all the duties assigned.

• Proper maintenance of ICT of the school.

• Provide the students Career guidance.

• Never harass the students.

• Never take tuitions or prompt students for tuitions.

• Never involve ourselves in any other organization other than KVS.

• Applying new tactics for Uplifting of school.

• By keeping my Computer Lab up to date and well equipped.

• Regularly checking of Emails and other computer related work.

• Maintaining discipline in school.

• Having proper command on children.

• Interaction with parents/guardian in a polite manner.

• Motivating students.

• Teaches students in a friendly way and solve their problems when they need.

• Give students a proper career guidance.

• Maintenance of ICT infrastructure in KVS.

• Use of new technology.

• To help the staff for learning computer fundamentals.

• Develop command in my subject.

• Clearing the basic concepts of my students.

• Clearing the doubts time to time.

• Helping students to gain high score.

• Be friendly with students.

• Feel comfortable to the students.

• Remove fear of the subject.

• Help in practical programming.

• Help in project work.

• Help in writing correct method of answer.

• Pay Personal attention to each child.

• Help in solving personal problems (if any)

• Help in improvement of the subject

• Improve confidence in the subject.

Page 27: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 27

• Should follow the CBSE norms.

• Should follow the CBSE evaluation Norms.

• Should follow the marking scheme design by CBSE

• Follow the reference book referred by CBSE syllabus

• Downloading Sample Papers from CBSE Site for the students

• Review the latest circulars of CBSE

• Developing interest in the subject.

• Develop the personality of the child

• Motivate the child for co-curricular activities

• Building confidence in the child.

• Help him to score maximum marks

• Solve the problems in the subject.

• Pay personal attention to the child.

• Make him disciplined and punctual.

• Clear the concepts of child.

• Help the Child should to be creative.

• TO BE A GOOD TEACHER

• Prepare split up syllabus and complete the course according to that.

• All notebooks should be maintained properly.

• Students should do all the practical.

• Project work should be complete on time.

• List of practical and projects given on time.

• Computers are working properly.

• Networking of lab.

• Cleanliness of lab.

• Notice board should be attractive and display different information’s,

• All 26 links should be updated monthly.

• The links such as What’s NEW, Current News, Enrollment, Category wise Enrollment,

• CCA Activities should be updated regularly.

• Preparation of condemnation report

• Train the staff members.

• We should be more cooperative, friendly & helpful.

• We should teach teachers computer to update their knowledge and make teaching and learning method more effective.

• We should tell teachers something regarding Basic Hardware knowledge of computer, so that they can handle their computer easily.

• We should tell teachers about new techniques of teaching, useful websites from where they can get the useful contents in power point form.

• We should help them in other school activities.

• We should arrange ICT for their teaching and tell them how to use ICT for future lesson plans.

• We should understand teachers problems and counsel them if required.

Page 28: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 28

• We should help teachers to do work on Thinkquest.org

• We should help teachers to do work with school website and emails.

• We should help teachers in making innovative projects.

• To be a good teacher.

• To maintain result and PI.

• To maintain computer department.

• To assist Principal in implementation of new technology.

• To train other teachers for new technology.

• To assist Principal in implementation of thinkquest.org and other IT projects from KVS.

• To maintain good relations with parents for development of their children.

• To work for a child’s overall development.

• To help in development of interactive society.

• To maintain decorum of KVS in society.

• TO BE A GOOD TEACHER

• Prepare split up syllabus and complete the course according to that.

• All notebooks should be maintained properly.

• Students should do all the practical.

• Project work should be complete on time.

My own expectation:- •

The above role derived my role as PGT Computer Science.

Participants

In-Service Course

Page 29: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 29

KENDRIYA VIDYALAYA I.I.T. POWAI (MUMBAI REGION)

INSERVICE COURSE FOR PGT COMP.SC.

DURATION- MAY 3-14, 2010

MM:30 SHORT TEST – I (08-05-2010) DURATION: 1 Hr Name:_________________________________ KV: _________________________________ Note: Q. No. 1 to 7 carry ½ mark each, Q. No. 8 to 20 each fill in the blank contains ½ mark

Q. No. 21 to 25 contain 2 mark each & Q. No. 26,27 contain 4 mark each 1. Degree is: (a) no. of columns (b) no. of rows (c) no. of tables (d) none 2. Cardinality is: (a) none (b) no. of rows (c) no. of columns (d) ) no. of tables 3. Name the first large scale vacuum tube computer (first generation) - (a) IMAC (b) ENIMAC (c) ENIAC (d) EMAC 4. RAM is a memory (a) temporary (b) permanent (c) virtual (d) cache 5. Through which command we can remove a table completely (a) Delete (b) Drop (c) Remove (d) Update 6. Smallest individual unit in a program is known as: (a) byte (b) variable (c) token (d) literal 7. W3C is created in October (a) 1996 (b) 1993 (c) 1992 (d) 1994 8. Full form of NIC _____________________________________________________ 9. Write full form of FLOSS ________________________________________________ 10. Full form of JFC _____________________________________________________ 11. The top 3 container classes in Java are ________________, _________________ & ________________ 12. IC was invented by ______________________

13. GNU project was initiated by ______________________

14. Gigabyte is consist of 1025 MB, Petabyte is consist of ______________________ 15. There are _____ Keywords in C++ among them ____ keywords are inherited from C. 16. Java does not support typedefs, defines of pre-processor, uses ____________ keyword instead 17. Let a =5 and b = 6, Then value of k , a and b after executing this equation will be

k = a++ * ++a * ++a – ++a * ++b * b++ the value of a is ____ b is ____

18. Java does not support ____________________________ 19. Let a = 5 and what is output of the followings

cout<<++a * a++ * ++a; the out put will be ________

20. cout<< setprecision(4)<< 12.658425 output will be __________________ 21. Write short note on (i) Joining report (ii) Medical fitness certificate 22. Explain utilization of School fund & VVN 23. What are the Imp key points should be in mind while doing condemnation. 24. Write 5 important Role & Responsibility as PGT Comp. Teacher. 25. How Communication plays an important role in teaching? 26. Write a program to input 10 numbers to store in an Array. Now find the Max & Min no. with their index number. 27. Write a program to input 10 numbers to store in an Array. Now sort this Array in ascending & descending order.

Page 30: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 30

ERROR ANALYSIS OF SHORT TEST

I

Page 31: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 31

KENDRIYA VIDYALAYA I.I.T. POWAI (MUMBAI REGION)

INSERVICE COURSE FOR PGT COMP.SC.

DURATION- MAY 3-14, 2010

MM:30 SHORT TEST – II (11-05-2010) DURATION: 1 Hr

Name: _________________________________ KV: _________________________________

Q 1. Write full form of (1/2 marks each):- (5) (i) DDL ________________________________________________________

(ii) DML ________________________________________________________

(iii) TCL ________________________________________________________

(iv) JDBC ________________________________________________________

(v) ODBC ________________________________________________________

(vi) ASP ________________________________________________________

(vii) JSP ________________________________________________________

(viii) ISP ________________________________________________________

(ix) WWW ________________________________________________________

(x) XML ________________________________________________________

Q 2. Fill in the blanks (1/2 marks each):- (5) 1. The property of partitioning the program into individual components is called ___________________

2. ___________________ is the capability of one class of things to inherit capabilities or properties from

another class.

3. The ability of a program to recover following an error and to continue operating within its environment, is

called ___________________.

4. The exit() function has been defined under a header file ___________________

5. The java.lang packages one class namely Class offers a method ___________________ that register the

driver with driver manager.

6. A member function with the same name as its class is called ___________________

7. SQL commands are interpreted by the ___________________

8. A ___________________ is a collection of inter-related data stored in a particular area on the disk.

9. RDBMS is a dbms that is based on the relational model as introduced by ___________________

10. The art of pinpointing a bug and fixing it is called ___________________

Q 3. How we can prepare a effective lesson plan (2) Q 4. Write short note on Police verification & Nomination (3) Q 5. Explain the difference between Service Book & Personal File (3) Q 5. What is difference between consonant & vowels? (2) Q 6. What are main requisite to become a professional? (2) Q 7. Write a program to find the factorial of a given number, using recursive function. (4) Q 8. Explain the difference between While & Do-While loop. (4)

Page 32: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 32

GIST OF GUEST LECTURERS

Page 33: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 33

Prof. Abhiram G. Ranade, Ex HOD, IIT Powai

Topic: Technology, Education and Fun Objective: Education by Fun � Teachers should make sure that student have fun and learning � Computer technology can provide the motivation to learn other subjects specially maths � Students should feel that learning will help them with some personal goals � Students should able to play with what is taught not just consume/memorize � Students can learn a lot from programming languages like LOGO and Scratch

Use of LOGO Programming This language is about 30 yrs old and developed by Seymous Pappert. It provide visualization of geometry figures of mathematics through a special means ie “turtle”. They learn lot of pattern matching diagrams like square, polygons, cubes and many more and built up their logical reasoning power. Use of Scratch Programming It is descendent of LOGO. It provides visualize object as “sprite”. In Scratch programming we can produce sound, nice visual effects, animated stories, messages etc. and enable original expressions with great strength. It can also be used in the field of physics to demonstrate Doppler Effects, Automatic Tank Filling System etc. It can be downloaded from the website www.scratch.mit.edu Prof Ranade also emphasis on use of computer in science subjects to make them interesting.

Mr. Uday Khedkar ,

HOD of Comp.Sc. Dept. of IIT , Powai, Mumbai. Lecture on self learning delivered by Mr. Uday Khedkar , HOD of Comp.Sc. Dept. of IIT , Powai, Mumbai. He illustrated the concept through ppt, some mathematical & logical calculation with some group activities, story of IIT etc. and we came to know how we can motivate our student to face the changing world, how to tell them hard & soft skills.

Prof. P. Chaowdhary

CSE Department, IIT Powai

Topic: Pointers and Array in C++.

Objective: Use of Pointer and Arrary in various algoritm and C++ Concept � In Selection Sort � In Insertion Sort � In Matrix Multiplication � Dynamic memory allocation in C++ � Compiling and Running C++ programs on different platform.

Technical points covered. � Concept of nameapce in C++ � Logic of Selection Sort with array and pointers. � Logic of Insertion Sort. with array and pointers. � Matrix Multiplication with function overloading and operators overloading. � Concept of pointer to pointer.

Page 34: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 34

The session was very interactive and explanations are very good. The following topics are covered in this

lecture:- (1) Operator Overloading (2) Function Overloading (3) Explanation on constant keywords (4) Show example and program on Matrix Multiplication (5) File Handling In this session participants got more practical knowledge and explanation on above topics. Sir has also

explained file handling in briefly- how to open and how to close a file. It will helpful to all participants. He explained the arrays concept in depth. The session was interactive and he demonstrated the data file

handling programs with the help of a compiler. He covered the topics on file creation, data insertion in to file, searching, appending etc and also executed some graphics based programs. During the lecture practically explained the concept of file handling. He said that it depended on the system and the file system depended on the operating system. The session was content based and described the problems during the execution time. Another interesting thing was that the all got an opportunity to understand new compiler other than Turbo C++. The compiler successfully executed filename.hpp in Mac OS. That was a new experience to all participants. He also explained the differences of modes like app, ate, trunk etc in data file handling. The use of ‘const’ in different ways in a program was really fruitful to all and he concluded the seminar with a good interaction.

Mr. Dhaval Bonde

CSE Department, IIT Powai

(email address: [email protected], phone: 09820965806) Mr. Dhaval Bonde persuing MTech at IIT Bombay in department of CSE working in the field of distributed systems and cloud computing, was invited by the Director of Inservice course of PGT (CS) to guide the participants about Java Netbeans IDE. He introduced the participants with Java Netbeans IDE by giving some examples of Applications we can make in Java for eg. Chatting, Database Management, Games etc. Along with theory he showed the practicals using Java Netbeans. He illustrated useful shorthands that are used while writing java programs. The shorthands would make programmer feel at ease to make more complex programs and the students will find java more interesting. He also told us various methods of taking input such as from keyboard and from Command line. During programming the most complex part is to debug the error which can be generated during run – time. Within a complex program it become very difficult, but Mr Bonde gave us solution to this problem by explaining the use of debugger. Through which it becomes easy to debug / find the errors. His knowledge and the ease with which he used Java Netbeans IDE was highly appreciable and added to the knowledge of all participants.

Prof. Sumana Srinivasam

CSE Department, IIT Powai She has taken lecture on “Programming with Java”. She explained various concepts of Java and C++ programming languages related to OOPs concepts and Java “Ecilips” in practical demo, at the time, all the participants were engaged in practical work parallel. She told about new IDE-ELIPSE. It was very innovative lecture and all participants actively participated in the lecture. She explained about the Test Driven Development Benefits and use of util classes-creation of own objects.

Page 35: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 35

NAME OF THE WEBSITES FOR REFERNCE FOR THE TEACHERS All Teachers can get the content and material for their subject from the websites given below including the projects and PowerPoint presentations. Teachers are requested to download the contents and presentations and use it for the beneficial of the students.

S.No. Physics Chemistry 1. www.phyics.2lv.in/blog/node/107 http://chemistry.about.com/od/chemistryactivities/Che

mistry_Activities_for_Kids.html

2. www.cbseguess.com http://www.scienceproject.com/projects/index/senior/chemistry.asp

3. www.wikipedia.org http://www.juliantrubin.com/chemistryprojects.html

4. www.motionmountain.net http://www.educypedia.be/education/chemistryexperiments.htm

5. www.icbse.org http://homeschooling.gomilpitas.com/explore/chemistry.htm

6. www.eschoolscience.com http://www.scifun.org/homeexpts/homeexpts.html

7. www.ocw.mit.edu http://www.neatorama.com/.../top-10-mad-science-worthy-chemistry-experiments/

8. www.cbsenotes.com http://www.silviamar.com/chemistry_everyday.htm

9. www.plustwophysics.com http://www.squidoo.com/ChemistryOfDailyLife

10. www.wiziq.com http://www.wtps.org/wths/imc/teacher_assignment/science/carcel%20chemistry%20life.htm

11. www.globalshiksha.com http://cbse.learnhub.com/lesson/10660-cbse-question-papers-2007-chemistry

12. www.scribd.com http://www.icbse.com/2009/chemistry-projects-class-xii-12th-cbse/

13. http://www.kv1jalahalli.org/tutorials/vault/Electrostatics_1.ppt

http://www.pdfqueen.com/pdf/cb/cbse-board-paper-2009-chemistry/

14. http://www.lbl.gov/abc/wallchart/teachersguide/pdf/

http://www.youtube.com/watch?v=9ZmqKik-070

15. www.electronicsdevices.com http://www.boardguess.com/cbse/cbse-syllabus/cbse-board-syllabus-chemistry-class-xi-xii-6100.htm

16. www.greenpeace.org/.../electronics/.../what-s-in-electronic-devices/

http://indiacbse.com/cbse/chemistry-practicals-syllabus-2010-cbse-class-xii

17. www.zietmysore.org/stud_mats/XII/.../dua

l%20nature%20of%20matter.pdf http://www.slideshare.net/whbs/online-chemistry-e-learning-courses-for-cbse-grade-12

18. www.colorado.edu/physics/2000/waves_particles/

http://cbseportal.com/exam/Projects/Download-CBSE-Class-XII-Chemistry-Project-Determination-Of-The-Contents-Of-Cold-Drinks

19. www.tutorvista.com http://www.genee-india.com/cbse-subject-details.php?id=47

20. www.zietmysore.org/stud_mats/XII/PHYSICS/unit3-mag.pdf

21. http://www.opticsindia.com/

Page 36: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 36

S.No. Mathematics Computer Science / IP

1. http://mycbseguide.com/blog/cbse-solved-test-papers-for-class-12-mathematics/

www.schoolofeducator.com

2. http://entrance-exam.net/cbse-2009-class-xllth-mathematics-sample-papers/

www.pptpoint.com

3. http://www.mathisfun.com www.cbseguess.com

4. http://www.mathematicsprojects.blogspot.com www.computersfundamentals.com

5. http://www.cbseguess.com www.xml.com

6. http://www.zietmysore.org www.cbse.com

7. http://www.wiziq.com/online-test/ www.thinkquest.org

8. http://www.ct4me.net/math_resources.htm www.cprogramming.com

9. http://www.successcds.net www.cppreference.com

10. http://www.icbse.com/2009/cbse-class-xii-maths-sample-unit-test/

www.asp-sharerware.org

S.No. Business Studies /

Accountancy

Economics Computer Science / IP

1. http://www.icseguess.com http://economics.about.com/ www.asp101.com

2. http://www.icbse.com www.boardguess.com/ www.html.net

3. http://cbseguess.com www.gocbse.com/ www.htmlhelp.com

4. http://cbseportal.com www.iisjed.com/booklistIX-XII.asp www.webdesigning.org

5. http://www.onlineteahers.co.in www.indiastudychannel.com www.mysql.com

6. http://www.upscportal.com http://arjournals.annualreviews.org www.oracle.com

7. http://www.mycbseguide.com www.ncert.nic.in www.java.com

8. www.pdfqueen.com www.microsoft.com

9. www.cplusplus.com

10. www.cbse.nic.in

� For Primary Classes the worksheets, PowerPoint presentations are available in the website

www.eslprintables.com .

Page 37: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 37

Demo Lesson-Plan

Page 38: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 38

Presented by : Mr. Amit Kumar Meena, PGT (Comp.Sci), KV NARMDANAGAR,, BHOPAL Region

S.no. Particulars Details

1 Name of the module Boolean algebra

2 Duration 40 mins. (01 period theory)

3 Objectives 1. Understand the concept of Boolean algebra 2. Why is it important in computer?

4 Content 1. Definition of Boolean algebra 2. Binary valued quantities 3. Logical Operators (NOT, OR, AND Operators)

4. Tautology & Fallacy 5. Logic Gates (NOT, OR, AND) 6. Basic Theorem of Boolean Algebra 7. Idempotence Law, Involution Law 8. Complementary Law, Commutative Law 9. Associative, Distributive & Absorption Law With

Truth Table. 10. Demorgan’s theorem 11. Universality of NAND and NOR Gates

5 Exercise /methodology 1. Design Truth table. 2. Drawing the various gates 3. Displaying Expression 4. Showing Formulas

6 Reference Digital Computer,Digital Electronics Morris Mano

7 Teaching aid LCD projector and computer

8 Evaluation Check the truth table by prove the expression

9 Remarks Computer science class XII

Name: Pankaj Singh

KV Name: KV Railway, Gandhidham, Gujarat

Topic: Computer Fundamental

S. No. Particulars Details

1 Name of the Module Computer Fundamentals

2 Duration 40 Mins. (01 Period Theory)

3 Objectives 1. To understand the basics of computers 2. Use of computers in different areas 3. Data and Information 4. Concept of Hardware & Software 5. How computer works 6. Different Number Systems

4 Content 1. What is Computer? 2. Data Vs Information 3. I-P-O Cycle 4. Generations of Computers 5. Computer Parts 6. Input/ Output/ Processing/ Storage Devices

Page 39: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 39

7. Units of size 8. Software 9. Number Systems

5 Exercise /Methodology 1. Demonstration of hardware and software 2. Practice on Number Systems

6 Reference Input Output devices and search engines on internet

7 Teaching Aid LCD Projector, computer and decimal to binary convertor

(manual)

8 Evaluation Identification of I/O devices and their proper use

9 Remarks Computer Science Class XI

Mrs. Shruti Shrivastava, PGT CS

Lesson-Plan

S. No. Particulars Details

1 Name of the Module RDBMS-Database Fundamental

2 Duration 35 Min. (01 Period Theory)

3 Objectives 1. To understand the concept DBMS 2. To understand the need of DBMS 3. Advantages of DBMS 4. Switch from DBMS to RDBMS 5. RDBMS Terminology 6. Advantages & Disadvantages of RDBMS

4 Content 1. Definition of RDBMS 2. Traditional Method of Data Storage : File System 3. Disadvantages of File Systems 4.Database Technology 5. Place of DBMS 6.Difference between File & DBMS Operation 7. Advantages of DBMS 8. Levels of Abstraction 9. Components of DBMS 10. Data Models 11. Relation Data Model (RDBMS) 12. Relational Terminology 13.Relation Model Basics 14. Properties of Relation/Table 15. Integrity Constraints: Keys 16. Examples of Keys 17. View, Referential Integrity 18. Advantages & Disadvantages of RDBMS

5 Exercise/Methodology 1. Demonstrate the use of DBMS 2. Explain different types of data Models 3. Explain the different terminology of Relational Model 4. Demonstrate the advantages & disadvantages of RDBMS

6 Reference Class XI IP book Different articles on RDBMS from net

7 Teaching Aids LCD Projector, Computer, White Board, Marker

8 Evaluation Correction of answers & exact points of the answers

9 Remarks Informatics Practices Class XI

Page 40: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 40

Lesson-Plan

Mr. Ashwini, PGT CS

S. No. Particulars Details

1 Name of the Module Introduction to DDL and DML

2 Duration 30 Mins. (01 Period Theory & 02 Periods Practical)

3 Objectives 1. To understand the concept of DDL and DML 2. Use of sql commandss

4 Content 1. Definition 2. Commands of DDL 3. Commands of DML

5 Exercise /Methodology 1. Create table 2. Insert values into tables 3. Update values of tabl

6 Reference Sql basics

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of sql commands and proper output

9 Remarks Computer Science Class XII

Lesson-Plan

Mr. Kapil Sehgal, PGT CS

S. No. Particulars Details

1 Name of the Module Introduction to C++

2 Duration 30 Mins. (01 Period Theory & 02 Periods Practical)

3 Objectives 1. To understand the basics of C++. 2. Understanding Tokens 3. Use of various operators 4. How to create program

4 Content 1. Character Sets 2. Tokens 3. Keywords 4. Identifiers 5. Literals 6. Escape Sequence 7. Punctuators 8. Unary, Binary Operators and Ternary operators 9. Variables 10. I/O Operations

5 Exercise /Methodology 11. Develop a first program 12. Develop a program using identifiers and literals 13. Develop a program using various variables 14. Develop a program for adding and multiplication.

6 Reference C++ basics and System Help in c++

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of coding and proper output of programs

Page 41: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 41

9 Remarks Computer Science Class XII

Lesson Plan

Mr. Ramesha, PGT CS

KV ONGC Panvel

S. No. Particulars Details

1 Name of the Module MySQL function

2 Duration 30 Mins. (02 Period Theory & 04 Periods Practical)

3 Objectives 1. To defining function. 2. Understanding Character functions, 3. Understanding Number functions 4. Understanding Date functions.

4 Content I. 1.Lower/LCASE, 2. Upper/UCASE( ), 3. Concat(), 4. Instr(), 5. Length(), 6. RTrim(), 7. LTrim(),

8. Substr(). II. 1. Round( ), 2.Truncate( ), 3. Mod( ), 4. Sign( ). III. 1. Curdate( ), 2. Date( ), 3. Month( ), 4. Year( ), 5. DayName( ), 6. DayofMonth( ), 7. DayofWeek( ), 8. DayofYear( ), 9. Now( ), 10. SysDate( )

5 Exercise 1. Display names ‘MR. OBAMA’ and ‘MR. Gandhi’ into lowercase. 2. Write a query to remove leading spaces of string ‘ RDBMS MySQL’. 3. Display the position of occurrence of string ‘OR’ in string ‘CORPORATE FLOOR’.

6 Reference MySQL basics and Function by Sumita Arora.

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of query and proper output of queries

9 Remarks IP Class XI

Demo Lesson Plan

Topic : Stack, Queue and Linked List Presented By : Malam Singh Kirar, PGT (Computer Science)

K. V. NO. 3, Bhopal (Bhopal Region)

S.No. Particulars Details

1 Name of the Module Stack, Queue and linked list

2 Duration 40 minutes

3 Objectives 1. Understanding of Stack and Queue 2. Representation of stack and Queue 3. Stack and Queue as an array or as a linked list 4. Insertion and deletion of stack and Queue.

4 Content 1. How to represent of Stack and Queue

2. Use array to represent of a Stack and Queue.

3. Insert elements to stack – Pushing – Algorithm for Pushing

Page 42: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 42

4. Delete elements from Stack - Popping

5. Overflow and Underflow (empty) conditions

6. Program for implement a stack using array.

7. Use linked list to represent a stack

8. Pushing in linked list.

9. Popping from the linked list

10. Program for implement a stack using a linked list.

11. Insert and deletion operation performs on Queue.

12. Program for implement a Queue using array.

13. Program for implement a Queue using a linked list.

5 Exercise /Methodology 1. What is stack ?

2. What is the overflow condition ?

3. How to arrange link list for stack ?

4. What is difference between stack representation as array and as linked list ?

5. What is the difference between Stack and Queue.

6. How to arrange link list for Queue?

6 Reference The Complete Reference of C++

7 Teaching Aid LCD Projector and computer, PowerPoint Presentation

8 Evaluation Correction of the program for Insertion and Deletion elements in

stack and queue and check correct output.

9 Remarks Computer Science Class XII

Topic: Computer Fundamental

Name: S. N. Meena

KV Name: KV AFS Manauri Allahabad

S. No. Particulars Details

1 Name of the Module Computer Fundamentals

2 Duration 20 Mins. (01 Period Theory)

3 Objectives 1. Definition the basics of computer 2. Use of computers in different areas 3. Data and Information 4. Concept of Hardware & Software 5. How computer works 6. Definition of different computer terms

4 Content 1. What is Computer? 2. Input output Devices 3. Generations of Computers 4. Computer Parts 5. Basic working of computer System 6. Definition of different computer terms

5

Exercise /Methodology Basic working of computer System

Page 43: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 43

6 Reference Computer Science Class XI

7 Teaching Aid LCD Projector, computer

8 Evaluation To understanding working of computer

9 Remarks Specially attention on working on computer

Name: SREEJITH K.V.

KV Name: KV AFS OJHAR, II SHIFT

Topic: Open Source Concepts

S. No. Particulars Details

1 Name of the Module Networking and Open standards

2 Duration 20 Mins. (01 Period Theory)

3 Objectives 1. To develop ability to use the Open Source Technology

2. To understand terminologies and definitions of Open source based software.

3. Types of standards 4. Advantages of open standards 5. Indian languages standards

4 Content 1. Introduction to open source softwares 2. Terminologies and definitions 3. Open source softwares 4. Proprietary Vs Open standards 5. Common open standard formats 6. Indian language computing 7. Fonts

5 Exercise /Methodology 1. Compare and contrast open source software and proprietary softwares.

2. Different types of open source/free softwares?

6 Reference www.openoffice.org www.pango.org www.postgresql.org www.php.net www.apache.org www.mozilla.org

7 Teaching Aid LCD Projector and computer system with open source operating system.

8 Evaluation Advantages of OSS over proprietary softwares

9 Remarks Informatics Practices Class XII

DEMO LESSON PLAN

PRESENTED BY: Mr. KAMLESH AMIN PGT-(Comp. Sc.)

K V 9 BRD, AF , PUNE-14

S. No. Particulars Details

1 Name of the Module Front End Interface Components in Java

2 Duration 20 Mins. (01 Period Theory ) + 01 Practical Class

Page 44: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 44

3 Objectives 1. Introduction to GUI 2. JAVA Swing API: Components 3. Various Swing controls 4. Basic components in Java 5. Proprieties, method and event handling 6. Steps to cerate GUI Application 7. Execution of application

4 Content 1. Introduction 2. Understanding swing components 3. More about swing components 4. Containers and Controls 5. Creating GUI programming 6. Handling Events 7. Major Events of swing components 8. Working with Top level components 9. Working with other controls 10. 10 Setting properties, events and methods

5 Exercise /Methodology 1. What is Java JFC? 2. What is container controls? 3. Name some Top level components. 4. What is Event? What is event handler? 5. What is the relationship of proprieties, methods and

events? 6. What is panel? What is it mainly used? 7. Lab Exercises

6 Reference Sumita Arora Text Book , Internet

7 Teaching Aid LCD Projector and computer

8 Evaluation Practical implementation of application

9 Remarks Informatics Practices Class XI

Ms Kirtika, PGT CS

KV Andrews Ganj

Lesson-Plan

S. No. Particulars Details

1 Name of the Module RDBMS-Database Fundamental

2 Duration 35 Min. (01 Period Theory)

3 Objectives 1. To understand the concept DBMS 2. To understand the need of DBMS 3. Advantages of DBMS 4. Switch from DBMS to RDBMS 5. RDBMS Terminology 6. Advantages & Disadvantages of RDBMS

4 Content 1. Definition of RDBMS 2. Database Components 3. RDBMS Restriction/Conventions 4. RDBMS Keys 5. Database Integrity 6. RDBMS software classification 7. Advantages of DBMS

Page 45: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 45

Lesson-Plan PRESENTED BY: Mr. Sushil Mishra PGT-CS

K V New Cantt. Allahabad

S. No. Particulars Details

1 Name of the Module Object Oriented Programming Concept

2 Duration 40 Mins. (01 Period Theory )

3 Objectives 1. To Learn Programming Methodology 2. Types of Programming 3. 3. To Understand OOPs Concept

4 Content 1. Introduction 2. Various Programming Paradigm 3. Procedural Programming 4. Object Based Programming 5. Object Oriented Programming 6. OOPs concept 7. Basic Concept of OOPs 8. Data Abstraction 9. Data Encapsulation 10. Modularity 11. Inheritance 12. Polymorphism 13. Implementing OOPs Concept in C++ 14. Implementing Object 15. Implementing Data Hiding 16. Implementing Data Abstraction 17. Implementing Data Encapsulation 18. Implementing Inheritance 19. Implementing Polymorphism 20. Advantage of OOPs 21. 7. Disadvantage of OOPs

8. Levels of Abstraction 9. Components of DBMS 10. Exercise 11. Solutions

5 Exercise/Methodology 1. Demonstrate the use of DBMS 2. Explain different types of data Models 3. Explain the different terminology of Relational Model 4. Demonstrate the advantages & disadvantages of RDBMS

6 Reference Class XI IP book Different articles on RDBMS from net

7 Teaching Aids LCD Projector, Computer, White Board, Marker

8 Evaluation Correction of answers & exact points of the answers

9 Remarks Informatics Practices Class XI

Page 46: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 46

5 Exercise /Methodology Define the term Data Hiding in the context of Object Oriented Programming.

6 Reference A Text Book by Sumita Arora Internet

7 Teaching Aid LCD Projector and Computer

8 Evaluation Practical implementation of application

9 Remarks Computer Science with C++ Class XII

DEMO LESSON PLAN PRESENTED BY: Mr.Ashutosh Pandey PGT-CS

K V Dantewada, C.G.

S. No. Particulars Details

1 Name of the Module Basic Concepts of OOPS

2 Duration/Marks 40 Mins. (01 Period Theory ) /2

3 Objectives 5. To Learn basic terminology used in OOPs 6. Features of OOPs 3. To understand concept of OOPs in respect of C++

4 Content 1. Introduction 2. . OOPs concept What is Object 3. Basic Concept of OOPs 4. Data Abstraction 5. Data Encapsulation 6. Modularity 7. Inheritance 8. Polymorphism 9. Implementing OOPs Concept in C++ 10. Implementing Object 11. Implementing Data Hiding 12. Implementing Data Abstraction 13. Implementing Data Encapsulation 14. Implementing Inheritance 15. Implementing Polymorphism 16. Advantage of OOPs 17. 7. Disadvantage of OOPs

5 Exercise /Methodology 1. Define the term Data Hiding in the context of Object Oriented Programming.

2. Define The Terms Inheritance & Polymorphism 3. What are Advantage & Disadvantage of OOPs

Define Class & Object 6 Reference A Text Book by Sumita Arora,

Internet

7 Teaching Aid Multimedia Projector and Computer, White board

8 Evaluation Practical implementation of application

9 Remarks Computer Science with C++ Class XII

Page 47: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 47

Ms. Richa, PGT CS LESSON PLAN

SNO. PATICULARS DETAILS

1. Name of the Module Flow of Control inC++

2. Duration 35 Minutes

3. Objectives • Illustration of the Concept of Control Flow

• Types of Control Flow

• Knowledge about conditional and repetitive statements.

• Make more proficient in handling programs in Control Flow.

• Develop Logic building skill.

4. Content • Illustration of the Concept of Control Flow

• Types of Control Flow

• Sequential

• Selection

• Iteration

• Conditional Statement along with the programs.

• Alternative of IF statement.

• Switch Case along with the programs.

• Iteration Statements . For Loop . While Loop . Do-While Loop

• Solved Program as Examples

• Jump Statements . Return . Break . Continue

• Exit Function

• Programs to test your learning skills

5. Exercise /

Methodology • Programs related to conditional and repetitive

statements.

6. Reference • Computer Science by Sumita Arora

• Programming in C++ by Robert Lafore

• Website

7. Teaching Aids • LCD Projector, Computer, White Board.

8. Evaluation • Home Assignment and Practical Skills, Class Room Performance, Thinking and Logic Developing Skills.

9. Remarks • Students will develop the concept in programming – using the conditional and repetitive statements.

RAJU LAL MEENA

PGT COMP. SC.

KV, NO.2 AFS, PUNE

S. No. Particulars Details

1 Name of the Module Programming Guidelines

Page 48: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 48

2 Duration 40 Mins. (01 Period Theory & 02 Periods Practical)

3 Objectives 1. Stylistic Guidelines. 2. Characteristics of a Good Program. 3. Stages of Program development process. 4. Robustness 5. Types of Error 6. Exception Handling 7. Problem Solving Methodology 8. Debugging 9. Documentation

Content 1. Meaningful names for Identifiers 2. Ensure clarity of expression 3. Use comments and Identation 4. Insert Blank Lines and Blank spaces 5. Statement Formatting style 6. Compile time error 7. Run time error 8. Logical Error 9. General debugging methods 10. Program verification 11. Pogram testing 12. Program Maintenance

5 Exercise /Methodology 3. Short answer type questions 4. Long answer type questions

6 Reference Sumita Arora

For class XI

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of Definitons and stages of programs

9 Remarks Informatics Practices Class XI

Mr. Nitin, PGT CS

LESSON PLAN S. No. Particulars Details

1 Name of the Module Flow of Control

2 Duration 35 Minutes

3 Objectives 1. To understand the concept of Flow of Control. 2. To learn different types of flow of control 3. To learn different control flow statements & loops 4. To learn Implementation of loops and statements in

programming

4 Content 1. Flow of Control. 2. Different types of flow of control. 3. Different statements and loop. If statement switch statement for loop

Page 49: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 49

while loop do…while loop break statement continue statement 4. Elements that controls loop Implementation of loops

5 Exercise /Methodology Develop a program using to find greater of two numbers. Write a program to print all numbers between 1 and 10. Write a program to check whether the given number is prime or not Write a program to find the sum of the series – 1 + x + x2 + x3 + …………. + xn

6 Reference 1. Learning JAVA – E. Balagurusamy 2. JAVA unleashed

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of coding and proper output of programs

9 Remarks Computer Science Class XI

LESSON - PLAN

SUNIL KUMAR - PGT(Computer Science).

KENDRIYA VIDYALAYA SURANUSSI

S. No. Particulars Details

1 Name of the Module Front-end and database connectivity in java

2 Duration 120 Mins. (02 Period Theory & 02 Periods Practical)

3 Objectives 1. To understand the connectivity between front end and backend.

2. Use of java.sql.* package within java with jdbc. 3. Steps to front-end and backend connectivity.

4 Content 1. Data access mechanisms 2. Classes used for database connectivity 3. Steps for creating database connectivity

applications 4. Import the package required for database

programming 5. Register the JDBC Driver 6. . Open a connection 7. Execute a Query 8. Extract data from ResultSet 9. Clean up the Environment 10. ResultSet Methods 11. Retrieving data based on user specified criteria.

5 Exercise /Methodology 1. Develop a program connectivity 2. Methods of the resultset. 3. Show the columns value of the mysql in java

control.

6 Reference Connecting with database and frontend

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of coding and proper output of programs

Page 50: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 50

9 Remarks Informatics Practices of Class XII

Lesson Plan

Mrs. Swati Srivastav

PGT CS

S. No. Particulars Details

1 Name of the Module RDBMS CONSTRAINTS

2 Duration 30 Mins. (01 Period Theory & 02 Periods Practical)

3 Objectives 7. Identify the different types of constraints 8. Unique constraints 9. Null constraints 10. Primary constraints 11. Default constraint 12. Check constraint 13. When to use and how to use these constraints.

4 Content 14. Definition of constraint 15. Unique constraints 16. Null constraints 17. Primary constraints 18. Difference between Primary and Unique constraint 19. Default constraint 20. Check constraint 21. Foreign key

5 Exercise /Methodology 5. Cre 6. Develop a program using identifiers and literals 7. Develop a program using various variables 8. Develop a program for adding and multiplication.

6 Reference C++ basics and System Help in c++

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of coding and proper output of programs

9 Remarks Computer Science Class XII

Lesson Plan Prepared by : Bhoopendra Navadya,PGT (Comp. Sc.)

Kendriya Vidyalaya ,Basti Region

S.No. Particulars Details

1 Name of the Module Data File Handling

2 Duration 35 Mins Theory

3 Objectives 1. Why is file Handling needed? 2. Understand the concept of Files, streams and classes

and functions related. 3. Types of Files and File Modes 4. Opening and Closing of files. 5. Sequential I/O with Files.

4 Content 1. Definition of file, stream 2. Use of related header files, classes and functions 3. Types of files: Text & Binary 4. Opening a file using constructor & using function

open() 5. File Modes and their related functions

Page 51: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 51

6. Various Input/Output functions like get(),put()

5 Exercise

/Methodology

1. Develop a file handling program using functions. 2. Program to work with a text file 3. WWrriittee aa FFuunnccttiioonn iinn CC++++ ttoo pprriinntt tthhee ccoouunntt ooff wwoorrdd iiss aass aann

iinnddeeppeennddeenntt wwoorrdd iinn aa tteexxtt ffiillee ddiiaalloogguuee..ttxxtt.. 6 Reference Data File Handling from Course Book, Internet

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of simple programs and questions, How to make a MS-Word File through a file handling program

9 Remarks Computer Science Class XII

Demo Lesson Plan

Topic : PROGRAMMING GUIDELINES Presented By : Dinesh Narwal PGT (Comp Sci)

K V Suranussi, Jalandhar (Jammu Region)

S.No. Particulars Details

1 Name of the Module PROGRAMMING GUIDELINES

2 Duration 40 minutes

3 Objectives 1. To represent Guidelines for Good Programming 2. Identification of different errors 3. Need of testing and maintenance 4. Documentation in the program

4 Content 1. How to develop a good program. 2. Characteristics of Good Programming. 3. Stages of Program development process. 4. Types of errors. 5. Program solving methodologies and techniques. 6. General debugging methods 7. Program verification and testing 8. Program maintenance. 9. Exception Handling

5 Exercise /Methodology 1. To identify errors in the given code and their type. 2. Difference between different testing methods.

6 Reference Complete Reference in Java , Software Engineering by Pankaj Jalotia

7 Teaching Aid LCD Projector and computer, PowerPoint Presentation

8 Evaluation To Develop a easy to understand and stylistic Program

9 Remarks I.P. Class XI

Lesson Plan

Mrs. Amandeep

PGT CS

S. No. Particulars Details

1 Name of the Module RDBMS CONSTRAINTS

2 Duration 30 Mins. (01 Period Theory & 02 Periods Practical)

3 Objectives 1. Identify the different types of constraints

Page 52: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 52

2. Unique constraints 3. Null constraints 4. Primary constraints 5. Default constraint 6. Check constraint 7. Create table using these constraints.

4 Content 1. Definition of constraint 2. Unique constraints 3. Null constraints 4. Primary constraints 5. Difference between Primary and Unique

constraint 6. Default constraint 7. Check constraint 8. Foreign key

5 Exercise /Methodology Write a MYSQL Command to create a furniture table including all constraints.

6 Reference Lerry Ulman, MYSQL Database, Pearson Education, 2008

7 Teaching Aid LCD Projector, computer and Oracle

8 Evaluation Correction of coding and proper output of programs

9 Remarks

Lesson Plan

MR. Abrar, PGT CS

KV Lonavala

S.

No.

Particulars Details

1 Name of the Module 1-D & 2-D Arrays

2 Duration 90 Mins. (01 Period Theory & 02 Periods Practical)

3 Objectives 1. To understand the concept of arrays. 2. Use of string and matrix as an array. 3. Doing manipulation with 1-D and 2-D Array. 4. Implementation of arrays in programming.

4 Content 1. Introduction to arrays. 2. Declaration/initialisation of One-dimensional array 3. Inputting Array Elements 4. Accessing Array Elements 5. Implementation of One-Dimensional Array in

Memory. 6. Manipulation of Array elements (sum of elements,

product of elements). 7. Average of elements, finding maximum/minimum

value. 8. Linear search, Sorting. 9. Declaration/Initialization of a String 10. String manipulations (counting

vowels/consonants/digits/ special characters 11. Case conversion, Reversing a string 12. Reversing each word of a string.

Page 53: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 53

13. Declaration/ initialization of Two-dimensional Array.

14. Inputting Array Elements. 15. Accessing Array Elements. 16. Implementation of Two-Dimensional Array in

Memory. 17. Different Patterns and programs related to Matrix

Algebra of 2-D Arrays.

5 Exercise /Methodology 9. Develop a program using array. 10. Finding greatest, smallest and sum of 1 D array. 11. Develop a program using string as an array. 12. Counting number of words, characters in a line.

6 Reference Arrays and System Help in c++

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of coding and proper output of programs

9 Remarks Computer Science Class XI

DEMO LESSON PLAN

PRESENTED BY: Mr.Ashish Kumar Joshi PGT-CS K V 1, AFS, Chakeri, Kanpur

S. No. Particulars Details

1 Name of the Module Stack, Queue and Linklist

2 Duration/Marks 30 Mins. (01 Period Theory )

3 Objectives 1. To Learn basic operation on stack. 2. To Learn implementation of stack by array and

linklist. 3. To Learn basic operation on Queue. 4. To Learn implementation of Queue by array and

linklist.

4 Content 14. Introduction 2.Stack:- a. Stack Operation PUSH,POP b. Implementation of stack by array and linklist c. Application of Stack

• Conversion of Infix to Postfix Expression

• Evaluation of a Postfix Expression 3. Queue:- a. Queue Operation INSERT ,DELETE b. Implementation of Queue by array and linklist 4. Conclusion

5 Exercise /Methodology 1. What is the difference between static and dynamic allocation of memory. 2. How stack can be implemented by array and linklist. 3. How queue can be implemented by array and linklist. 4. What are the application of stack.

6 Reference 1. Text Book by Sumita Arora and Reeta Sahoo 2. Internet

7 Teaching Aid Multimedia Projector and Computer, White board

Page 54: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 54

8 Evaluation Practical implementation of application

9 Remarks Computer Science with C++ Class XII

Demo Lesson Plan

Topic : FLOW OF CONTROL Presented By : MANOJ KUMAR AHIRWAR PGT (Comp Sci)

K V LEH-LADAKH(Jammu Region)

S.No. Particulars Details

1 Name of the Module FLOW OF CONTROL

2 Duration 30 minutes

3 Objectives 7. To understand the introductory concepts of programming 8. To understand the syntax of flow of control 9. Implementation of syntax into program.

4 Content 15. Decision Structures: if, if-else, if-elseif, nested if, switch 16. Looping Structures: for, while, do-while; 17. Jump Statements: return, break and continue.

5 Exercise /Methodology 7. To write different program based on different condition.

6 Reference Complete Reference:Java2 by Herbert Schilt

7 Teaching Aid LCD Projector and computer, PowerPoint Presentation, White board marker.

8 Evaluation To Develop a easy to understand and stylistic Program

9 Remarks Informatics Practices Class XI

Lesson Plan Pappu Lal Meena, PGT-C.S.

K.V. Reckongpeo S.

No.

Particulars Details

1 Name of the Topic LINKED LIST 2 Duration 35 Min.

3

Objective:

1) To make the students to understand the facts regarding linked lists.

2) To develop the attitude of problem solving. 3) To provide work of leisure. 4) To develop skills of programming 5) Students will be able to do programming related to Data structure. 5) Students will be able to know the advantages of data Structure over normal declaration of data and arrays.

4

Contents:

1. Introduction 2. Need for linked list 3. Types of linked list] 4. Singly linked list 5. doubly linked list

Page 55: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 55

6. Operations of singly linked list 7. Insertion 8. Deletion 9. Traverser

5

Exercise/

Methodology

Q1. What is linked list? Q2. How does the linked list implemented? Q3. What are the types of linked list? Q4. What are the operations related to linked list?

6 Reference Computer Science C++ by Sumita Arora & Internet

7 Teaching Aid White board, Marker, LCD Projector

8 Evaluation Giving programs based on Linked list & HOTS

9 Remarks Computer Science Class XII

Mrs. Rachana Katiyar

PGT ( Comp. Sci.)

K V MM Sadiq Nagar, New Delhi

S. No. Particulars Details

1 Name of the Module Introduction to DDL and DML

2 Duration 30 Mins. (02 Period Theory & 04 Periods Practical)

3 Objectives 1. To understand the concept of DDL and DML 2. Use of sql commands 3. Use of constraints

4 Content 1. Definition 2. Commands of DDL 3. Commands of DML

5 Exercise /Methodology 1. Create table 2. Insert values into tables 3. Update values of tabl

6 Reference Sql basics

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of sql commands and proper output

9 Remarks Computer Science Class XII

Mr. Anup, PGT CS

Lesson-Plan

S. No. Particulars Details

1 Name of the Module HTML

2 Duration 30 Mins. (01 Period Theory & 01 Periods Practical)

3 Objectives 1. To understand the concept of HTML Language. 2. To Create Web Page.

Page 56: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 56

3. Design Web Page. 4. Implementation of HTML programming in website

designing

4 Content 1. Introduction to HTML Programs 2. History Of HTML 3. Steps Involved in Creating Web Page 4. Tags - Detail 5. Image and Sound Insertion 6. Bullets and Numbering 7. Hyper linking 8. Tables 9. short revision

5 Exercise /Methodology 1. Develop a website for your school. 2. Insert picture in you page. 3. Link two web pages.

6 Reference Learn HTML in 24 Hr by Swan Series

7 Teaching Aid LCD Projector, Web site and computer

8 Evaluation Creation of web page properly run

9 Remarks Informatics Practices Class XI & XII

Lesson Plan Ghanshyam Mehar, PGT-C.S.

K.V. No.5 Bathinda Cantt. S.

No.

Particulars Details

1 Name of the Topic Constructor & Destructor

2 Duration 20 -35 Min.

3

Objective:

1. To understand the concept of Constructor in C++ 2. To familiar with types of Constructor 3. To understand the concept of Destructor 4. To understand the concept of Copy Constructor

4

Contents:

1. Introduction 2. Example of constructor 3. Comments on Constructor 4. Overloading Constructor 5. Composition: objects as members of classes 6. What is a destructor 7. Comments on destructors 8. What is a copy constructor? 9. Example of Copy constructor 10. Defining Copy constructor

5

Exercise/ Methodology

Q1. What is constructor? Q2. How Constructor can be parameterized? Q3. Why copy constructor is necessary to define? Q4. When a constructor is executed? Q5. When a destructor is executed?

6 Reference Computer Science C++ by Sumita Arora & Internet

Page 57: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 57

7 Teaching Aid White board, Marker, LCD Projector

8 Evaluation Giving programs based on constructor & HOTS

9 Remarks Computer Science Class XII

Lesson PLan

Ms. Kavita, PGT CS

KV Rewari

S. No. Particulars Details

1 Name of the Module DATA FILE HANDLING

2 Duration 30 Mins. (01 Period Theory & 02 Periods Practical)

3 Objectives 1. To understand the data file handling. 2. Understanding file concepts 3. Use of various streams 4. How to create program

4 Content 1. Opening file 2. Open file using Constructor 3. Open file using open function 4. Closing files 5. steps to process a file 6. Determine the type of link required 7. Declare a stream 8. Attatch the file 9. Process the file 10. Close the file link 11. Detecting EOF

5 Exercise /Methodology 1. Develop a first program 2. Develop a program using open() 3. Develop a program using constructor.

6 Reference C++ basics and System Help in c++

7 Teaching Aid LCD Projector and computer

8 Evaluation Correction of coding and proper output of programs

9 Remarks Computer Science Class XII

Lesson Plan Seema Kesri, PGT-C.S.

K.V. No.2 Armapur, Kanpur S.

No.

Particulars Details

1 Name of the Topic Function in C++

2 Duration 20 -35 Mins

3 Objective:

1. To understand the concept of function in C++ 2. To familiar with types of function

Page 58: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 58

3. To understand default arguments & constant arguments

4. Differentiate between Call by value & Call by reference

5. To understand returning from a function

4 Contents:

1. Introducing Function 2. Function Statistics 3. Types of functions 4. Function definition 5. Function Prototype 6. Calling a function 7. Default arguments 8. Constant arguments 9. Call by Value & Call by Reference 10. Returning from a function -Returning Values -Returning Reference

5 Exercise/

Methodology

Q1. What are the 3 steps in using a function? Q2. What are the actual & formal parameters of a function? Q3. When is a default argument value used inside a function? Q4. What is the significance of empty parentheses in a function declaration? Q5. Write a function to take an int argument & return 0 if the given number is prime otherwise return -1.

6 Reference Computer Science C++ by Sumita Arora & Internet

7 Teaching Aid White board, Marker, LCD Projector

8 Evaluation Giving programs using function & HOTs

9 Remarks Computer Science Class XI

Page 59: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 59

INDIVIDUAL TASK ASSIGNED

Page 60: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 60

Split up Syllabus XI and XII CS

Ashwini

PGT – Comp. Sc.

K.V. Karera

Class XI

No. of periods

required

Month

Contents

Theory

Prac./Comp.

Aid.

Teaching

No. of

working

days

June UNIT 1: COMPUTER FUNDAMENTALS Evolution of computers; Basics of computer and its operation: Functional Components and their inter-connections, concept of Booting, Use of Operating System for directory listing, hierarchical directory structure, renaming, deleting files/folders, formatting floppy, copying files, concepts of path and pathname, switching between tasks, installation/removal of applications;

08

02

07

July Software Concepts: Types of Software - System Software, Utility Software and Application Software; System Software: Operating System, Compilers, Interpreters and Assembler;

Operating System: Need for operating system, Functions of Operating System (Processor Management, Memory Management, File Management and Device Management), Types of operating system – Interactive (GUI based), Time Sharing, Real Time and Distributed; Commonly used operating systems: Solaris, UNIX,LINUX, Mac OS, MS Windows; General functionalities of an Operating System to be illustrated and implemented using any of the above operating systems.

UNIT 2: PROGRAMMING METHODOLOGY General Concepts; Modular approach; Clarity and Simplicity of Expressions, Use of proper Names for identifiers, Comments, Indentation; Documentation and Program Maintenance; Running and Debugging programs, Syntax Errors, Run-Time Errors, Logical Errors; Problem Solving Methodology and Techniques: Understanding of the problem, Identifying minimum number of inputs required for output, Step by step solution for the problem, breaking down solution into

25

07

26

Page 61: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 61

simple steps, Identification of arithmetic and logical operations required for solution, Using Control Structure: Conditional control and looping (finite and infinite);

UNIT 3: INTRODUCTION TO

PROGRAMMING IN C++ Programming by Example In C++ Language :

C++ character set, C++ Tokens (Identifiers, Keywords, Constants, Operators), Structure of a C++ Program (include files, main function); Header files – iostream.h, iomanip.h; cout, cin; Use of I/O operators (<< and >>), Use of endl and setw(), Cascading of I/O operators, Error Messages; Use of editor, basic commands of editor, compilation, linking and execution; standard input/output operations from C language: gets(), puts() of stdio.h header file;

August Data Types, Variables and Constants: Concept of Data types; Built-in Data types: char, int, float and double; Constants: Integer Constants, Character Constants (Backslash character constants - \n, \t ), Floating Point Constants, String Constants; Access modifier: const; Variables of built-in data types, Declaration/Initialisation of variables, Assignment statement; Type modifier: signed, unsigned, long;

Operators and Expressions: Operators: Arithmetic operators (-,+,*,/,%), Unary operator (-), Increment and Decrement Operators (—,++), Relational operators (>,>=,<,<=,==,!=), Logical operators (!, &&, ||), Conditional operator: <condition>?<if true>:<else>; Precedence of Operators; Expressions; Automatic type conversion in expressions, Type casting; C++ shorthand’s (+=, -=, *=, /=, %=);

20

10

24

September Flow of control: Conditional statements: if-else, Nested if, switch..case..default, Nested switch..case, break statement (to be used in switch..case only); Loops: while, do - while , for and Nested loops;

Structured Data Type: Array Declaratrion/initialisation of One-dimensional array, Inputting array elements, Accessing array elements, Manipulation of Array elements (sum of elements, product of elements, average of elements, linear search, finding maximum/minimum value); Declaration/Initialization of a String, string manipulations (counting vowels/consonants/digits/ special characters, case conversion, reversing a string, reversing each word of a string);

18

12

23

Page 62: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 62

October String Functions: Header File: string.h Functions: isalnum(), isalpha(), isdigit(), islower(), isupper(), tolower(), toupper();

Character Functions: Header File: ctype.h Functions: isalnum(), isalpha(), isdigit(), islower(), isupper(), tolower(), toupper(), strcpy(), strcat(), strlen(), strcmp(), strcmpi();

Mathematical Functions: Header File: math.h, stdlib.h; Functions: fabs(), log(), log10(), pow(), sqrt(), sin(), cos(), abs(),

Other Functions: Header File: stdlib.h; Functions: randomize(), random();

11

14

17

November Half Yearly Examination Two-dimensional Array:

Declaration/initialisation of a two-dimensional array, inputting array elements Accessing array elements, Manipulation of Array elements (sum of row element, column elements, diagonal elements, finding maximum/minimum values);

User Defined Functions: Defining a function; function prototype, Invoking/calling a function, passing arguments to function, specifying argument data types, default argument, constant argument, call by value, call by reference, returning values from a function, calling functions with arrays, scope rules of functions and variables; local and global variables;

15

14

22

December Event programming: Games as examples General Guidelines: Initial Requirement, developing an interface for user (it is advised to use text based interface screen), developing logic for playing the game and developing logic for scoring points 1. Memory Game: A number guessing game with

application of 2 dimensional arrays containing randomly generated numbers in pairs hidden inside boxes. 2. Cross ‘N Knots Game: A regular tic-tac-toe game 3. Hollywood/Hangman: A word Guessing game 4. Cows ‘N Bulls: A word/number Guessing game

10

15

18

January UNIT 4: COMPUTER SYSTEM

ORGANISATION Number System: Binary, Octal, Decimal, Hexadecimal and conversion between two different number systems. Integer, Floating Point, 2’s complement of number from base-2; Internal Storage encoding of Characters: ASCII,

22

08

24

Page 63: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 63

ISCII (Indian scripts Standard Code for Information Interchange), and UNICODE; Microprocessor: Basic concepts, Clock speed (MHz,GHz), 16 bit, 32 bit, 64 bit processors; Types – CISC, RISC; Concept of System Buses, Address bus, Data bus, Concepts of Accumulator, Instruction Register, and Program Counter; Commonly used CPUs and CPU related terminologies: Intel Pentium Series, Intel Celeron, Cyrix, AMD Series, Xeon, Intel Mobile, Mac Series; CPU Cache; Concept of heat sink and CPU fan, Motherboard; Single, Dual and Multiple processors; Types of Memory: Cache (L1,L2), Buffer, RAM (DRAM, SDRAM, RDRAM, DDRAM), ROM(PROM, EPROM), Hard Disk Drive, Floppy Disk Drive, CD/DVD Drive; Access Time; Input Output Ports/Connections: Power connector, Monitor Socket, Serial (COM) and Parallel(LPT) port, Universal Serial Bus port, PS-2 port, SCSI port, PCI/MCI socket, Keyboard socket,Infrared port (IR), audio/speaker socket, Mic socket; data Bus; external storage devices connected using I/O ports;

February Keyboards: QWERTY, Inscript, Multilingual, Dvorak Printers: Dot Matrix Printer, Line Printer, Deskjet/Inkjet/Bubblejet Printer, Laser Printer; Power Supply: Switched Mode Power Supply (SMPS): Elementary Concept of Power Supply: Voltage, Current, Power (Volt, Ampere, Watt), SMPS supplies – Mother Board, Power Conditioning Devices: Voltage Stabilizer, Constant Voltage Transformer (CVT), Uninterrupted Power Supply (UPS)-Online and offline.

Project Work

Revision

15

05

22

Page 64: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 64

Class XII

No. of period

required

Month

Contents

Theory

Prac./Comp.

Aid.

Teaching

No. of

working

days

April UNIT 1: PROGRAMMING IN C++ REVIEW: C++ covered In Class –XI.

Defining a symbol name using typedef keyword and defining a macro using #define directive; Need for User defined data type;

Structures: Defining a Structure, Declaring structure variables, Accessing structure elements, Passing structure to Functions as value and reference argument/parameter, Function returning structure, Array of structures, passing an array of structure as an argument/ a parameter to a function.

Object Oriented Programming: Concept of Object Oriented Programming – Data hiding, Data encapsulation, Class and Object, Abstract class and Concrete class, Polymorphism (Implementation of polymorphism using Function overloading as an example in C++); Inheritance, Advantages of Object Oriented Programming over earlier programming methodologies.

25

06

23

May &

June

Implementation of Object Oriented Programming

concepts in C++: Definition of a class, Members of a class - Data Members and Member Functions (methods), Using Private and Public visibility modes, default visibility mode (private); Member function definition: inside class definition and outside class definition using scope resolution operator(::); Declaration of objects as instances of a class; accessing members from object(s), Array of type class, Objects as function arguments - pass by value and pass by reference;

8

5

3+7

July Constructor and Destructor:

Constructor: Special Characteristics, Declaration and Definition of a constructor, Default Constructor, Overloaded Constructors, Copy Constructor, Constructor with default arguments;

Destructor: Special Characteristics, Declaration and definition of destructor;

Inheritance (Extending Classes): Concept of Inheritance, Base Class, Derived Class, Defining derived classes, protected visibility mode; Single level inheritance, Multilevel inheritance and Multiple inheritance, Privately derived, Publicly derived and Protectedly derived class, accessibility of members

16

16

26

Page 65: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 65

from objects and within derived class (es); Data File Handling:

Need for a data file, Types of data files – Text file and Binary file;

Basic file operations on text file:

Creating/Writing text into file, Reading and Manipulation of text from an already existing text File (accessing sequentially);

Binary File: Creation of file, Writing data into file, Searching for required data from file, Appending data to a file, Insertion of data in sorted file, Deletion of data from file, Modification of data in a file;

August Implementation of above mentioned data file handling in C++. Components of C++ to be used with file handling:

Header file: fstream.h; ifstream, ofstream, fstream classes; Opening a text file in in, out, and app modes; Using cascading operators for writing text to the file and reading text from the file; open(), get(), put(), getline() and close() functions; Detecting end-of-file (with or without using eof() function); Opening a binary file using in, out, and app modes; open(), read(), write() and close() functions; Detecting end-of-file (with or without using eof()

function); tellg(), tellp(), seekg(), seekp() functions

Pointers: Declaration and Initialization of Pointers; Dynamic memory allocation/deallocation operators: new,

delete; Pointers and Arrays: Array of Pointers, Pointer to an array (one dimensional array), Function returning a pointer, Reference variables and use of alias; Function call by reference. Pointer to structures: Deference operator: *, ->; self referencial structures;

UNIT 2: DATA STRUCTURES

Arrays: One and two Dimensional arrays: Sequential allocation and address calculation; One dimensional array: Traversal, Searching (Linear, Binary Search), Insertion of an element in an array, deletion of an element from an array, Sorting (Insertion, Selection, Bubble sort), concatenation of two linear arrays, merging of two sorted arrays; Two-dimensional arrays: Traversal, Finding sum/difference of two NxM arrays containing numeric values, Interchanging Row and Column elements in a two dimensional array.

20

13

23

Page 66: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 66

September Stack (Array and Linked implementation of Stack): Operations on Stack (PUSH and POP) and its Implementation in C++, Converting expressions from INFIX to POSTFIX notation and evaluation of Postfix expression;

Queue: (Circular Array and Linked Implementation): Operations on Queue (Insert and Delete) and its Implementation in C++.

UNIT 3: DATABASES AND SQL Database Concepts:

Relational data model: Concept of domain, tuple, relation, key, primary key, alternate key, Candidate key; Relational algebra: Selection, Projection, Union and Cartesian product;

20

12

23

October Structured Query Language:

General Concepts: Advantages of using SQL, Data Definition Language and Data Manipulation Language;

Data types: NUMBER, CHARACTER, DATE; SQL commands:

CREATE TABLE, DROP TABLE, ALTER TABLE, UPDATE...SET..., INSERT, DELETE; SELECT, DISTINCT, FROM, WHERE, IN, BETWEEN, GROUP BY, HAVING, ORDER BY;

SQL functions: SUM, AVG, COUNT, MAX and MIN;

11

13

18

November Half Yearly Examination

UNIT 4: BOOLEAN ALGEBRA Binary-valued Quantities, Boolean Variable, Boolean Constant and Boolean Operators: AND, OR, NOT; Truth Tables; Closure Property, Commutative Law, Associative Law, Identity law, Inverse law, Principle of Duality, Idem potent Law, Distributive Law, Absorption Law, Involution law, DeMorgan’s Law and their applications;

Obtaining Sum of Product (SOP) and Product of Sum (POS) form from the Truth Table, Reducing Boolean Expression (SOP and POS) to its minimal form, Use of Karnaugh Map for minimization of Boolean expressions (up to 4 variables);

Basic Logic Gates (NOT, AND, OR, NAND, NOR) and their use in circuits.

UNIT 5: COMMUNICATION AND NETWORK

CONCEPTS Evolution of Networking: ARPANET, Internet, Interspace; Different ways of sending data across the network with reference to switching techniques;

20

05

16

Page 67: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 67

Data Communication terminologies: Concept of Channel, Baud, Bandwidth (Hz, KHz, MHz) and Data transfer rate (bps, kbps, Mbps, Gbps, Tbps);

Transmission media: Twisted pair cable, coaxial cable, optical fiber, infrared, radio link, microwave link and satellite link. Network devices: Modem, RJ45 connector, Ethernet Card, Hub, Switch, Gateway; Different Topologies- Bus, Star, Tree; Concepts of LAN, WAN, MAN; Protocol: TCP/IP, File Transfer Protocol (FTP), PPP, Level-Remote Login (Telnet), Internet,

Wireless/Mobile Communication, GSM, CDMA, WLL, 3G, SMS, Voice mail, Application, Electronic Mail, Chat, Video Conferencing; Network Security Concepts: Cyber Law, Virus threats and prevention, Firewall, Cookies, Hacking; WebPages; Hyper Text Markup Language (HTML), eXtensible Markup Language (XML); Hyper Text Transfer Protocol (HTTP); Domain Names; URL; Protocol Address; Website, Web browser, Web Servers; Web Hosting.

December Revision, Project Work Preparation & I pre

Board

January Revision and II Pre Board

February Revision

Page 68: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 68

Split up Syllabus XI and XII IP

M S Kirar

PGT – Comp. Sc.

K.V. No. 3, Bhopal

Class XI

No of period required

Month

Contents Theory Prac./Comp

Aid. Teach.

June Hardware Concepts: Computer organization (basic concepts): CPU, Memory (RAM and ROM), I/O devices,communication bus, ports (serial, parallel, network, phone); Input devices: Keyboard, Mouse, Light pen, Touch Screens, Graphics Tablets, Joystick,Microphone, OCR, Scanner, Smart Card reader, Barcode reader, Biometric sensor,web camera; Output Devices: Monitor/Visual Display Unit (VDU), LCD screen, Television, Printer(Dot Matrix Printer, Desk jet/ Inkjet/ Bubble jet Printer, Laser Printer), Plotter, Speaker; Secondary Storage Devices: Floppy Disk, Hard Disk, Compact Disk, Magnetic Tape,Digital Versatile Disk (DVD), USB Drive, Memory cards - Comparative properties

12

-

July Software Concepts:

Operating systems, Need for operating system, major functions of Operating System,Memory Management; Security of system: sources of attack and possible damages, virus and related entities -worms, propagation of these entities, virus detection using a tool, Desktop security,Digital certificates, Digital signature, cookies, firewall, password, file access permissions. Types of Software: System Software, Utility Software, Application Software and Developer Tools System Software: General Purpose Application Software: Word Processor, Presentation Tool, Spreadsheet Package, Database Management System;Specific Purpose Application software (for example: Inventory Management System, Purchasing System, Human Resource Management System, Payroll System, Financial Accounting, Hotel Management and Reservation System, etc.); Developer Tools: Compilers and Interpreters, Integrated Development Environment Getting started with Programming using IDE Introduction, Rapid Application Development using IDE - Integrated Development Environment; Familiarization of IDE using basic Interface components; Basic component handling methods/attributes 1st Term unit test

22

04

August Programming Fundamentals

Data Types: Concept of data types; Built-in data types - byte, short, int, long, float,double, char, String (or any object), Boolean; Concept of a Class and Instance as userdefined datatypes. Variables:

18

12

Page 69: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 69

Need to use variable, Declaring Variables, Variable Naming Convention, Assigning value to Variables; Control Structures:

Assignment Statement Decision Structure - if, if-else, switch;

September Looping Structure- while, do-while, for; Concept of a Method: structure, local variables, return values, types of parameter passing Autumn break

12

14

Octobr Concept of a Class ( simple class only): members, methods, using classes as data types Programming Guidelines:

Choice of Expressions and Names, Comments, use of Indentation; Documentation and Program Maintenance; Debugging programs: Syntax Errors, Run-Time Errors, Logical Errors; Problem Solving Methodology and Techniques: Understanding of the problem, Identifying relevant information, top-down development approach 2nd Term unit test

18

8

November Half Yearly Examination Database Management System Introduction to database concepts: Relation/Table, attribute/fields, Tuple / Rows; Data Types - Number, Character and Date Key - Primary Key, Candidate key, Alternate key; Introduction to MySQL (ANSI SQL 99 standard commands) Classification of SQL Statements: DML - SELECT, INSERT, UPDATE, DELETE; DDL - CREATE, DROP, ALTER;

14

6

December SQL SELECT Statement (working with demo/already existing tables): SELECT statement, Selecting All the Columns, Selecting Specific Column, Using Arithmetic Operators, Operator Precedence, Defining and using Column Alias, Duplicate rows and their Elimination (DISTINCT keyword), Displaying Table Structure (DESC command); SELECT Statement Continued: Limiting Rows during selection (using WHERE clause), Working with Character Strings and Dates, Working with NULL values; Using Comparison operators - =, <, >, <=, >=, < >, BETWEEN, IN, LIKE(%), Logical Operators -AND, OR, NOT; Operator Precedence; ORDER BY Clause, Sorting in Ascending/Descending Order, Sorting By Column Alias Name, Sorting On Multiple Columns; Winter Break

15

12

January Functions in MySQL: String Function - CHAR(), CONCAT(),INSTR(), LCASE(), LEFT(), LOWER(), LENGTH(),LTRIM(), MID(), RIGHT(), RTRIM(), SUBSTR(), TRIM(), UCASE(), UPPER(). Mathematical Functions - POWER(), ROUND(), TRUNCATE(). Date and Time Functions - CURDATE() , DATE(), MONTH(), YEAR(), DAYNAME(), DAYOFMONTH(), DAYOFWEEK(), DAYOFYEAR(), NOW(), SYSDATE(). Manipulating Data of a Table/Relation: Inserting New Rows, Inserting

16

20

Page 70: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 70

New Rows with Null Values, Inserting NUMBER, CHAR and DATE Values, Update Statement to Change Existing Data of a Table, Updating Rows in A Table, Delete statement - removing row/rows from a Table; Creating Table using CREATE TABLE, ALTER TABLE for adding a new column, using naming conventions for column names; 3rd Term unit test

February • e - Governance - Definition, e-Governance websites; their salient features and societal impacts • e - Business - Definition, e-Business websites, their salient features and societal impacts • e - Learning - Definition; Benefits to students (Learners), Teachers (Trainers) and School (Institution) Management; e-Learning websites and their salient features and societal impacts Revision

Revision

15

17

March Revision Session Ending Examinations

5 -

Class XII

No. of periods required

Month

Contents

Theory

Practical/Comp

Aid. Teach.

April Unit 1 : Networking & Open Standards Computer Networking:Networking-a brief overview, Identifying computers and users over a network(Domain Name , MAC ‘Media Access Control ‘ and IP address ),domain name resolution, network topologies, types of network – LAN,MAN,WAN,PAN;Wired Technologies-Co-axial, Ethernet Cable, Optical Fiber, Wireless Technologies- Blue Tooth, Infrared ,Microwave , Radio Link , Satellite Link; Network devices-Hub,Switch,Repeater,Gateway- and their functions; Network security – denial of service , intrusion problems , snooping;

20 8

May &

June

Unit-II

Review of Class XI

Programming fundamentals: Access specifier for classes, members and methods, concept of package Inheritance: need and implementation,method overloading and overriding , abstract class and interfaces, use of interfaces Commonly used libraries: string class and methods : tostring(), concat(), length(), tolowerCase(), toUperCase(), trim(), substring() Math object: pow(), round() Simple GUI objects: Dialog Open source concepts : open source software (OSI norms), common FOSS examples(Gnu/Linux, Firefox, OpenOffice),common open standards(open document format , Ogg Vorbis) Indian language computing: character encoding, UNICODE and Indian language, different types of fonts(open type vs true type, static vs dynamic) , entering Indian Language text – phonetic and keymap based.

10 05

Page 71: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 71

July

Programming Fundamentals Accessing MySQL database using ODBC to connect with database. Web application development : URL,web server, Communicating with the web server, concept of client and server side. HTML based web pages covering basic tags-HTML.TITLE,BODY,H1-H6,P,BR,HR,FONT,TABLE LIST(UL,OL),FORM;

17

15

August Creating and accessing ststic pages using HTML and introduction to XML concept of database tranction, committing and Rvoking a tranction using COMMIT & REVOKE, Grouping records: GROUP BY, group functions- MAX(), MIN(), AVG(), SUM(), COUNT(), USING COUNT(*),DISTINCT clause with COUNT, group functions and null values, displaying data from multiple tables:Equi join & Cartesian product: concept of foreign key;

16

16

September Unit-III

Database fundamentals Creating a table with primary key and NOT NULL constraint, adding a constraint, enabling constraint, viewing constraint,viewing the columns associated with constraint; ALTER TABLE for deleting a column, ALTER TABLE for modifying data types of a column

DROP table for deleting a table

12

8

October Unit-IV

IT applications Revising the features of e-Goverenance,e-business and e-learning Front end interface – introduction ; content and features; identifying and using appropriate component for data entry, validation and display; Back-end database-introduction and its purpose ;exploring the requirement of tables and its essential attributes;

Front –end and database connectivity- introduction , requirement and benefits

20

10

November Project Work Half Yearly Examination

8

10

December Revision, Project Work Preparation & I pre Board

January Revision & II Pre Board

February Practical & Project Preparation

Tips for Maintenance & Improvements of ICT in KV

Abrar Ali

PGT – Comp. Sc.

K.V. Lonavala

Page 72: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 72

XI Computer Science HOTS Questions

Seema Kesri

PGT – Comp. Sc.

K.V. No. 2 Armapur Kanpur

UNIT 1

COMPUTER FUNDAMENTALS

1. Write full form for the following. CU , ENIAC , EDVAC , EDSAC ,IC, MSI , SSI ,VLSI,FDD , HDD , BIOS , FAT .FCFS , PCB

2. Write short notes.

i) Memory ii) Hardware iii) Software iv) System software v) Application software vi) Utilities vii) Compiler viii) Interpreter ix) Source program

x) Object program xi) Booting (cold booting , warm booting ) xii) Wildcards xiii) Multiprogramming xiv) Multiprocessing xv) Time sharing xvi) Icons xvii) Folder

3. Write the syntax and purpose of the following DOS commands. IME , DATE , CLS , VOL , VER , PATH ,DIR , MD ,CD , RD ,COPY CON , TYPE , COPY , DEL / ERASE ,REN ,FORMAT ,PROMPT .

Conversions :

4. Decimal to Binary decimal integer to binary integer (432)10 = ( )2 decimal fraction to binary fraction (0.8125)10 = ( )2 decimal mixed to binary mixed (432.8125)10 = ( )2

5. Binary to Decimal binary integer to decimal integer (10101001)2 = ( )10 binary fraction to decimal fraction (0.1101)2 = ( )10 binary mixed to decimal mixed (10101.1101)2 = ( )10

6. decimal to hexadecimal (235)10 = ( )16

7. hexadecimal to decimal (A1F)16 = ( )10

8. decimal to octal (57)10 = ( )8

9. octal to decimal (542)8 = ( )10

10. binary to octal (1010110)2 = ( )8

11. octal to binary (721235)8 = ( )2

12. binary to hexadecimal (1000110011001)2 = ( )16

13. hexadecimal to binary (FACE)16 = ( )10

Page 73: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 73

UNIT 2

Programming Methodology

i. What is portability of a program ?

ii. What is robustness ?

iii. What is the characteristics of a good program ?

iv. What is the purpose of comments and indentation ?

v. Define (i) input (ii) process (iii) output

vi. What methods are used to analyses a problem step_by_ step ?

vii. What do you mean by Dry Run ?

Write algorithm and draw flowchart for the following

i. To find the largest among three numbers .

ii. To generate FIBONACCI series up to N terms .

iii. To print the total number of positive (+ve) ,negative(-ve) and zero out of a given set of N numbers .

iv. To check whether the inputed integer is prime or not .

v. To check whether the inputed integer is armstrong or not .

vi. To check whether the inputed integer is automorphic or not .

vii. To find HCF and LCM of two inputed integers .

viii. To compute the sum of the square of N numbers .

UNIT 3

INTRODUCTION TO PROGRAMMING IN C++

1. Define the following:

i. Polymorphism

ii. Inheritance

iii. Modularity

2. Distinguish between

a. Call by value and call by reference b. Global variable and local variable c. Class and object d. Structure and Class e. Data hiding and encapsulation f. Simple variable & pointer variable g. Constants and identifiers h. Library functions and user defined functions i. Structure & array j. ‘a’ and “a” k. a=5 and a = = 5

l. file and directory m. return and exit() n. break and continue o. break and goto statement p. while and do while q. entry controlled loop and exit controlled loop r. run time error and syntax error s. getchar() and gets() t. putchar() and puts() u. getch() and getche() v. one dimensional array and two dimensional array w. auto variable and static variable x. fundamental data type and derived data

Page 74: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 74

type

3. Name the header files for the following functions

clrscr() setw() gets() toupper( ) putchar()

islower() sqrt() printf() strcmp() open()

randomize() pow() abs() strlen() isalpha()

puts() getchar() get() floor() cos()

gotoxy() exp() setprecision( ) strcpy() getc()

strlen() ceil() fabs() frexp() modf()

4. Define the following:

i. Tokens

ii. escape sequences

iii. header file

iv. fundamental data types

v. user defined function

vi. formal parameter

vii. actual parameter

viii. array

ix. subscripted variable

x. two dimensional array

xi. structures

xii. inheritance

xiii. pointer

5.

i. What are escape sequences?

ii. Name four datatype modifiers ?

iii. Why main() function is special ?Give two reasons.

iv. What is the application of void data type in C++ ?

v. What is the purpose of default clause in a switch construct.

vi. What are the purpose of goto statement ?

vii. How is entry controlled loop is different from exit controlled loop ?

viii. What is fallthrough?Explain with example .

ix. What is an array? How does it different from ordinary variable ?

x. What is meant by function prototype ?

xi. What is function recursion?

xii. What are inline function ?

xiii. How many storage class specifiers are available in C++?

Page 75: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 75

xiv. What are scope rules of variables ?

xv. What are default arguments ?

xvi. What are the three steps in using a function?

xvii. What is event programming?

xviii. What do you understand by the intrface of the game ?

xix. What are the different elements of a computer game?

xx. What is story ?

6. Find syntax errors and correct them . Underline each correction .

7. Output Questions related to control structure, array, function , String .

8. Write valid C++ statements using if ,if else ,while , do while , conditional operator ,array , function , switch

PROGRAMs

1. WAP to find the Pythagorian tripilate betwenn 1 to 500. 2. WAP to find maximum of N inputed numbers. 3. WAP to test whether the inputed no is Armstrong number or not . 4. WAP to test whether the inputed no is prime or not. 5. WAP to display the armstrong numbers between 1 and 500 . 6 . WAP to display the prime numbers between 1 and 100 . 7. WAP in C++ to check whether the inputed integer is automorphic or not . 8. WAP in C++ to find the sum of the digits of an inputed number. 10 . WAP in C++ to find H.C.F of two inputed numbers . 11. WAP in C++ to find the L.C.M. of two inputed numbers . 12. Create a matrix of order M X N and transpose it. Display the original and transposed matrix. 13. Create a two-dimensional array and find the highest and lowest element of each row. 14. Create an array of N elements and sort the elements in ascending order . 15. Create a two-demensional array of M X N elements. Write a program to find the row wise sum. 16. Write a program in C++ to find the column wise sum of a two dimensional array consists of M X N elements. 17. WAP that reads astring and check if the string is a palindrome. 18. WAP to replace every blank space in astring with an * (asterisk). 19. WAP to count the number of times an inputed character is present in a string . 20. WAP in C++ to create a matrix of order 3 x 3 and find the sum of the diagonal elements . 21. WAP that reads a string and a character .It then converts each sequence of the given character to opposite case . 22. WAP in C++ to display the following series 0 1 1 2 3 5 8 .....................upto N terms . 23. WAP that converts a decimal integer into binary integer . 24. WAP that converts a binary integer into a decimal integer. 25. WAP to find the sum of odd numbers of a matrix of order M X N. 26. WAP which finds the reverse of a number using function . 27. WAP in C++ that uses a function called carea() to calculate area of a circle.The function carea() receives radius of type float type and returns area of double type. The function main() gets aradius value from the user, calls carea() , and display the result .

Page 76: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 76

UNIT 4

COMPUTER SYSTEM ORGANISATION

1. Write full form for the following MIPS , CISC , RISC ,DR,MAR ,AC, IR , MBR ,TR,PC, INPR ,OUTR, CPU ,RAM, ROM, PROM, EPROM,EEPROM , SMPS ,CVT , IRDA ,UPS,

2. Difference between i) MAR and M ii) CISC and RISC iii) Register and Bus iv) Internal Bus and External Bus v) Data Bus and Address Bus vi) Active heatsink and passive heatsink vii) Static RAM and Dynamic RAM viii) Full ATX and Mini ATX ix) Single processor and dual processor x) RAM and ROM xi) Online UPS and offline UPS xii) Serial Port and Parallel Port xiii) Switch mode regulator and Switch mode converter xiv) Impact and Non-Impact printers xv) Program counter and Instruction register ?

1. What is a data bus ?

2. What is a control bus ?

3. What is the purpose of control unit ?

4. What is clock speed ?

5. What is a processor ?

6. What is program counter(PC) ?

7. What is a heat sink?

8. What is cache ?

9. What is multiple processor?

10. What is Port?

11. What is the use of power connector ?

12. What is the use of infrared port ?

13. What is the use of SMPS?

14. What is the use of CVT ?

15. Whart is the use of USB port ?

16. What is a mother board ?

Page 77: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 77

XII CS HOTS Questions

Ghanshyam

PGT – Comp. Sc.

K.V. No.5, Bhatinda Cantt.

INDEX

Chap 1. Programming in c++ Structure OOP’s Concepts Pointers Chap 2. Class and Objects, Constructor And Destructor And Inheritance Chap 3 Arrays Linked List & Stack Queues Chap 4 DATA FILE HANDLING IN C++ Chap 5 DATABASE CONCEPTS & SQL Chap 6 BOOLEAN ALGEBRA Chap 7 COMMUNICATION & COMPUTER NETWORKS Question 1. REVISION TOUR C++, OOPs Concepts & POINTERS Q 1 WHAT WIIL BE OUTPUT OF FOLLOWING PROGRAM? 1 #include<iostream.h> # include <conio.h> void main() { clrscr(); int sum(int(*)(int),int); int square(int); int cube(int); cout<<sum(square,4)<<endl; cout<<sum(cube,4)<<endl; getch(); } int sum(int(*ptr)(int k),int n) { int s=0; for(int i=1;i<=n;i++) { s+=(*ptr)(i); } return s; } int square(int k) { int sq; sq=k*k; return k*k; } int cube(int k) { return k*k*k; } ANS 1> OUTPUT WILL BE

30 100

Page 78: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 78

Q2>How many times will the following program will print “examination”? 1

#include<iostream.h> void main( ) {

while(1) { cout<<”examination”

} } ANS 2>Unless ^C is pressed ,program will print “examination” infinitely. Q 3> Will the following programs produce same output? 2 Program 1 # include<iostream.h> # include<conio.h> void main() { int x,y=1; if((x=y)!=0) cout<<x<<" "<<y; getch(); } Program 2 # include<iostream.h> # include <conio.h> void main() { int x,y=0; if((x=y=1)==1) cout<<x<<" "<<y; getch(); } Q4>What woulg\d be contents of following after array initialization? 1

int A[5]={3,8 ,9} Ans 4>

A

3 8 9 0 0

Q5>Suggest storage class for following variables ½ each

1. a normal variable. 2. very heavily used variable. 3. a variable that should retain its value after function is over. 4. a variable that spanes multiple files. 5. a variable global in one & not available in another file.

Ans 5>

Page 79: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 79

1. auto 2. register 3. static 4. extern 5. static global

Q 6> “Pointers always contain integers “ Comment. 1 Ans 6>

Pointer variable always store address of a variable which is always an integer. So pointers always store integers.

Classes & Objects, Constructor and Destructor, Inheritance Q.1 What is the difference between the constructor and normal function? Ans.

Constructor Normal Function

1. Constructor has same name as class name. 1. A normal function can have any legal name but not class name.

2. Constructor can not have any return type value not even void.

2. A function should have any return type value.

3. Constructor is automatically called. 3. A function is explicitly called.

4. Constructor can not be static. 4. A Function can be static.

Q.2 What is the similarity between class and the constructor? (HOTS)/Bright Student Ans.: The only similarity between constructor and is that constructor has same name as class name. Q.3 Find the output of the following program? #include<iostream.h> #include<conio.h> #include<string.h> class state { char *statename; int size; public: state(){size=0;statename=new char[size+1];} state (char *s) { size=strlen(s);statename=new char[size+1]; strcpy(statename,s); } void display() { cout<<statename<<endl;} void replace(state&a, state &b) {size=a.size+b.size; delete statename; statename=new char[size+1]; strcpy(statename, a.statename); strcat(statename,b.statename); } }; void main() { clrscr();

Page 80: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 80

char *temp="Delhi"; state state1(temp), state2("Mumbai"), state3("Nagpur"), s1,s2; s1.replace(state1,state2); s2.replace(s1,state3); s1.display(); s2.display(); getch(); } Ans.: DelhiMumbai DelhiMumbaiNagpur Q.3 Find out errors in the following program:-

class number {

int x=10; float y; number(){ x=y=10;}

public: number(number t) {

x=t.x; y=t.y; }

~ (){ cout<<"Object destroyed ";} } main() {

number a1, a2(a1); }

Ans.: error: int x=10; // class member can not be initialized in the class. Constructor should be declared in public section of class. Reference operator is missing in the definition of copy constructor In destructor class name is missing. Semicolon is missed after the definition of class.

Q.4 What is the difference between nesting or containership and inheritance? Explain with example? Ans.: Containership or Nesting: When a class contains object of other class type as its data member is known as containership or nesting.

Inheritance: Inheritance is the process of creating new class by reusing the properties of an existing class by accessing them depending on different visibility mode. The new class is called derived and existing class is called base class. Q.5 What will be the output of the program? #include<iostream.h> class base { public: void display() {

cout<<"It is a base class "<<endl; }

}; class derived: public base

Page 81: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 81

{ public:

void display() { cout<<"It is a derived class "<<endl;} };

main() {

derived ob1; ob1.display();

} Ans:- The output will be: It is a derived class. Q.6 Define a class named Tour in C++ with following description? 4 Private members: tcode integer (Ranges 6 - 10) adults, children, distance integer totalfare float AssignFare( ) A function which calculates and assign the value to data member totalfare as follows:- - For adults Fare Distance

Rs. 500 >=1500 And fare get reduced by 25% if distance is < 1500. - For Children

For every child a fixed Rs. 50 is charged as fare. Public members:

• A constructor which initialized initialize all data members with 0

• Function EnterTour() to input the values of the data members tcode, adults, children and call to AssignFare function.

• Function ShowTour() to print all the details of object of Travel type. Ans. class tour {

int tcode,adults,children,distance; float totalfare; void assignfare() { float cfare=50, afare=1500;

if(distance<1500) afare=afare-(afare*25/100); totalfare=(children*cfare)+(adults*afare); } public: travel() { tcode=adults=children=distance=totalfare=0; }

void entertour() {

do { cout<<"Enter tcode between 6-10 ";

cin>>tcode; if (tcode<6 || tcode>10) cout<<"Invalid tcode "<<endl;

}while(tcode<6 || tcode>10);

Page 82: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 82

cout<<"Enter children, adults, distance"; cin>>children>>adults>>distance;

assignfare(); } void showtour() { cout<<"tcode:"<<tcode<<endl;

cout<<"children:"<<children<<endl; cout<<"adults :"<<adults<<endl; cout<<"distance:"<<distance<<endl; cout<<"total fare:"<<totalfare<<endl; } }; Q.7. Define a class named Admission in C++ with following description? 4 Private members: admno integer (Ranges 10-1500) name string of 20 characters cls integer fees float Public members: A constructor which initialized admno with 10, name with “NULL”, cls with 0 & fees with 0 Function getdata() to read the object of Admission type. Function putdata() to print the details of object of admission type. Function draw_nos() to generate the admission no. randomly to match with admno and display the detail of object. Ans.: class admission

{ int admno; char name[20];

int cls; float fees;

public: admission()

{ admno=10; strcpy(name,"NULL");

cls=0; fees=0;

} void getdata() {

do { cout<<"Enter admno between 10-1500 ";

cin>>admn if (admno<10 || admno>1500)

cout<<"Invalid admission no !"<<endl; }while(admno<10 ||admno>1500);

cout<<"Enter name "; gets(name);

cout<<"Enter class and fees "; cin>>cls>>fees; } void putdata() { cout<<"Admno :"<<admno<<endl;

Page 83: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 83

cout<<"Name :"<<name<<endl; cout<<"Class :"<<cls<<endl; cout<<"Fees :"<<fees<<endl; } void draw_nos() { int num;

randomize(); num=random(1491)+10; if (num==admno) putdata(); } }; Q.8 Class testmeout { int rollno;

public: ~testmeout() //Function 1 { cout<<rollno<<” is Leaving examination hall”<<endl;

} testmeout() //Function 2

{ rollno=1; cout<<rollno<<” is appearing for examination “<<endl;

} testmeout(int n, char name[]) //Function 3

{ rollno=n; cout<<name<<” is in examination hall”<<endl;

} testmeout(testmeout & t);//function 4

void mywork() //Function 5 { cout<<rollno<<” is attempting questions “<<endl; }

}; i) In object oriented programming, what is Function 1 referred as and when does it get invoked? ii) In object oriented programming, what is Function 2 referred as and when does it get invoked? iii) In object oriented programming, what is Function 3 referred as and when does it get invoked? iv) Write a statement so that function 3 gets executed? Complete the definition of function 4 v) What will be the output of the above code if its main function definition is as given below (assumed the definition of Function 4 is completed ) : main() {testmeout ob1; ob1.mywork(); } vi) Which feature of object oriented programming is demonstrated using Function 2, Function 3 and Function 4 in the above class testmeout? vii) What is the scope of data member (rollno) of class testmeout? What does the scope of data members depend upon? Ans:- i) It is referred as destructor. It is automatically invoked when an object of concerned class goes out of scope.

Page 84: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 84

ii) It is referred as constructor. It is automatically invoked when an object of concerned class is declared / created. iii) It is parameterized constructor and gets invoked when an object of concerned class is created / declared with the matched parameters. iv) testmeout ob1(15, “Vicky”); testmeout (testmeout & t) { rollno=t.rollno;} v) output will be : 1 is appearing for examination 1 is attempting questions 1 is Leaving examination hall vi) It is constructor overloading. It shows Polymorphism feature of the OOP. vii) The rollno member of object can only be used by the concerned object where that object is declared. Its scope basically depends upon the concerned object. Data Structure – Array, link List, Stack & Queue

Q. 1 Given two arrays of integers A and B of sizes M and N respectively. Write a function named MIX() which will produce a third array named C, such that the following sequence is followed :

All even numbers of A from left to right are copied into C from left to right. All odd numbers of A from left to right are copied into C from right to left All even numbers of B from left to right are copied into C from left to right. All odd numbers of B from left to right are copied into C from right to left

A, B and C are passed as arguments to MIX(). e.g. : A is {3,2,1,7,6,3} and B is {9,3,5,6,2,8,10}, the resultant array C is {2,6,6,2,8,10,5,3,9,3,7,1,3} Solution : void mix (int A[], int B[], int n, int m) { int c[20],i=0,j=0,k=0,l; L=m+n-1; while (i<n && k<20) { if (A[i]%2==0) C[k++] = A[i++]; else C[l--] = A[i++]; } While (j<m && k<20) { if (B[j]%2==0) C[k++]=B[j++]; else C[l--]=B[j++]; } cout<<” \nThe elements of an array C is :”; for (i=0;i<m+n;i++) cout<<”\n”<<C[i]; } void main() { int A[j= { 3,2,1,7,6,3}, B[]= {9,3,5,6,2,8,10}; Mix(A,B,6,7); } Q. 2. Suppose an array P containing float is arranged in ascending order. Write a user defined function in C++ to search for one float from P with the help of binary search method. The function should return an integer 0 to show absence of the number and integer 1 ti show presence of the number in the array. The function should have the parameters as (1) an array (2) the number DATA to be searched (3) number of element N. Solution : int bsearch (float P[10], float DATA, int N)

{ int beg =0, end = N-1,mid, pos = -1;

Page 85: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 85

while(beg<=end) { mid = ( beg+ end )/2;

if (P[mid] == DATA) { pos =mid +1;

Break; } else if (item > AE[mid] )

beg = mid +1; else

end = mid-1; } return ((pos==-1)? 0:1);

} Q. 3 Write a function in C++ which accepts an integer array and its size as arguments / parameters 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 given below The resultant 2D array is 1 2 3 4 5 6 given below 1 2 3 4 5 0 1 2 3 1 2 3 4 0 0 1 2 0 1 2 3 0 0 0 1 0 0 1 2 0 0 0 0 1 0 0 0 0 0 Solution : void func(int arr[], int size) { int a2[20][20], i, j; for (i=0;i<size; i++) { for (j=0;j<size;j++) { if ((i+j) >=size) a2[i][j]=0; else a2[i][j]= arr[j]; cout<<a2[i][j]<<” “; } Cout<<”\n”;

} }

Q-4 Write a function in C++ to perform a PUSH operations on a dynamically allocated stack containing real number? Ans-

struct Node { float data; Node * next; }; Void push (Node*Top, float num) { Node*nptr = new Node; nptr -> data = num;

Page 86: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 86

nptr -> next = NULL; if(Top == NULL) Top = nptr; else { nptr -> next = Top;

Top = nptr; }

} Q-5 Each node of a STACK containing the following information, in addition to required pointer field: Roll no. of the student Age of the student. Gve the structure of node for the linked stack in question. TOP is a pointer to the topmost node of the STACK. Write the following function: PUSH() – TO push a node in to the stack which is allocated dynamically. POP() – Te remove a node from the stack and to release the memory. Ans- struct STACK { int rollno, age; STACK*next; } *top, *nptr, *ptr; void pop() { if (!pop) { cout << ”\nUnderflow!!” ; exit(1); } else { cout << ’\n’ << top -> rollno << ’\t’ << top -> age; ptr = top; top = top -> next; delete ptr; } } Void push() { nptr = new stack; //allocate memory

cout << “\n Enter roll number and age to be inserted : “ ; cin >> nptr-> rollno >> nptr->age ; nptr -> next = NULL; if (!top) top = nptr; else

{ ptr -> next = top; top = nptr } }

Page 87: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 87

Q.6 Write a function MAX in C++ which will return the Largest number stored in a two dimensional array of Integers. Ans #include <iostream.h> #include <conio.h> const r = 100, c = 100; // Function to find the largest integer in a two-dimensional array int MAX(int a[r][c], int m, int n) { int max = 0; for(int i= 0;i<m;i++) for(int j= 0;j<n;j++) { if (a[i][j] >max) max = a[i][j]; } return max; } void main() { clrscr(); int ar[r][c]; int rr, cc, mx = 0; int i, j; cout << "Enter no. of row : "; cin >> rr; cout << "Enter no. of column : "; cin >> cc; cout << "Enter the array elements : "; for (i=0; i<rr; i++) for (j = 0; j<cc; j++) cin >> ar[i][j]; mx = MAX(ar, rr, cc); cout << "Largest element is : " << max; } Q.7 Write a function in c++ which accepts a 2D array of integers and its size as arguments and displays the elements which lies on diagonals. [ Assuming the2D array to be a square matrix with odd dimensions , i.e 3x3, 5x5,7x7, etc ] Example if the array content is 5 4 3 6 7 8 1 2 9 Output through the function should be Diagonal one : 5 7 9 Diagonal two : 3 7 1 . Ans

Page 88: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 88

// Function to display the elements which lie on diagonals #include <stdio.h> #include <iostream.h> #include <conio.h> const M = 10; const N = 10; void display_diagonals(int MATRIX[M][N], int r, int c) { clrscr(); // Finding the diagonal from left index to right cout << "Diagonal One : "; for(int i=0; i<r; i++) for(int j=0; j<c; j++) { cout << MATRIX[i][j] << " "; i++; } cout << endl; // Finding the diagonal from right index to left cout << "Diagonal Two : "; for(i=0; i<=r; i++) { for(int j=c-1; j>=0; j--) { cout << MATRIX[i][j] << " "; i++; } } getch(); } void main() { int MATRIX[M][N]; int i, j; int r, c; cout << "Enter total no. of rows: "; cin >> r; cout << "Enter total no. of columns: "; cin >> c; if ((r == c) && ((r%2==1) && (c%2==1))) { cout << "Input steps"; cout << "\n\Enter the element in the array\n"; for(i=0; i<r; i++) for(j=0; j<c; j++) { cin >> MATRIX[i][j]; } } else return;

Page 89: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 89

display_diagonals(MATRIX, r, c); } Q.8 Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements of the middle row and the elements of middle column.

Example if the array content is 3 5 4 7 6 9 2 1 8

Output through the function should be: Middle row: 769 Middle column: 5 6 1

Ans // Function to display the elements which lie on middle of row and column #include <stdio.h> #include <iostream.h> #include <conio.h> const M = 10; const N = 10; void display_RowCol(int Array[M][N], int r, int c) { int row = r / 2; int col = c / 2; // Finding the middle row cout << "Middle Row : "; for(int j=0; j<c; j++) cout << Array[row][j] << " "; cout << endl; // Finding the middle column cout << "Middle Column : "; for(j=0; j<c; j++) cout << Array[j][col] << " "; getch(); } void main() { int Array[M][N]; int i, j; int r, c; cout << "Enter total no. of rows: "; cin >> r; cout << "Enter total no. of columns: "; cin >> c; if ((r == c) && ((r%2==1) && (c%2==1)))

Page 90: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 90

{ cout << "Input steps"; cout << "\n\Enter the element in the array\n"; for(i=0; i<r; i++) for(j=0; j<c; j++) { cin >> Array[i][j]; } } else { cout << "Input row and column not valid"; getch(); return; } display_RowCol(Array, r, c); } Q. 9. Declare a stack using array that contains int type numbers and define pop and push function using C++ Syntax. Ans #include <iostream.h> #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <ctype.h> #define MAX 100 // Shows maximum array length int stack[MAX]; // Declares array global variable int top; // Declares integer top // Function prototypes of add stack, delete stack, and // show stack in array implementation void push(int stack[], int val, int &top); // Add stack int pop(int stack[], int &top); // Delete stack void show_Stack(int stack[], int top); // Show stack void main() { int choice, val; char opt = 'Y'; // To continue the do loop in case top = -1; // Initialization of Queue clrscr(); do { cout << "\n\t\t Main Menu"; cout << "\n\t1. Addition of Stack"; cout << "\n\t2. Deletion from Stack"; cout << "\n\t3. Traverse of Stack"; cout << "\n\t4. Exit from Menu"; cout << "\n\nEnter your choice from above -> "; cin >> choice; switch (choice) { case 1: do { cout << "Enter the value to be added in the stack "; cin >> val; push(stack, val, top);

Page 91: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 91

cout <<"\nDo you want to add more elements <Y/N> ? "; cin >> opt; } while (toupper(opt) == 'Y'); break; case 2: opt = 'Y'; // Initialize for the second loop do { val = pop(stack, top); if (val != -1) cout << "Value deleted from statck is " << val; cout <<"\nDo you want to delete more elements<Y/N>?"; cin >> opt; } while (toupper(opt) == 'Y'); break; case 3: show_Stack(stack, top); break; case 4: exit(0); } } while (choice != 4); } // Function body for add stack with array void push(int stack[], int val, int &top) { if (top == MAX - 1) { cout << "Stack Full "; } else { top = top + 1; stack[top] = val; } } // Function body for delete stack with array int pop(int stack[], int &top) { int value; if (top < 0) { cout << "Stack Empty "; value = -1; } else { value = stack[top]; top = top - 1; } return (value); } // Function body for show stack with array void show_Stack(int stack[], int top) {

Page 92: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 92

int i; if (top < 0) { cout << "Stack Empty"; return; } i = top; clrscr(); cout << "The values are "; do { cout << "\n" << stack[i]; i = i - 1; }while(i >= 0); } Q.10. Define functionstackpush( ) to insert nodes and stack pops ( ) to delete nodes . for a linked list implemented stack having the following structure for each node struct Node { Char name [ 20 ] Int age ; Node * link ; }; Class stuck { Node * top ; Public Stack ( ) { top = null ;} ; Void stackpush ( ); Void stack pop ( ) ; } Ans #include <iostream.h> #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <ctype.h> // Declares a stack structure struct node { char name[20]; int age; node *link; }; class stack { node *top; public : stack() { top = NULL; } void stackpush(); // Add stack void stackpop(); // Delete stack void show_Stack(); // Show stack };

Page 93: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 93

// Function body for adds stack elements void stack::stackpush() { int val; node *temp; temp = new node; cout << "Enter name : "; gets(temp->name); cout << "Enter age : "; cin >> temp->age; temp->link = NULL; if(top ==NULL) top = temp; else { temp->link = top; top = temp; } } // Function body for delete stack elements void stack::stackpop() { node *temp; if (top == NULL) { cout << "Stack Empty "; } else { temp = top; top = top->link; temp->link = NULL; delete temp; } } // Function body for show stack elements void stack :: show_Stack() { node *temp; temp = top; clrscr(); cout << "The values are \n"; while (temp != NULL) { cout << "\n" << temp->name << "\t" << temp->age; temp = temp->link; } } // Main programming logic void main() {

Page 94: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 94

int choice; stack STACK; char opt = 'Y'; // To continue the do loop in case clrscr(); do { cout << "\n\t\t Main Menu"; cout << "\n\t1. Addition of Stack"; cout << "\n\t2. Deletion from Stack"; cout << "\n\t3. Traverse of Stack"; cout << "\n\t4. Exit from Menu"; cout << "\n\nEnter your choice from above "; cin >> choice; switch (choice) { case 1: do { STACK.stackpush(); cout<<"Do you want to add more elements<Y/N>?"; cin >> opt; } while (toupper(opt) == 'Y'); break; case 2: opt = 'Y'; // Initialize for the second loop do { STACK.stackpop(); cout<<"Do you want to delete more element<Y/N>?"; cin >> opt; } while (toupper(opt) == 'Y'); break; case 3: STACK.show_Stack(); break; case 4: exit(0); } } while (choice != 4); }

Page 95: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 95

DATA FILE HANDLING Q1, Assuming the class Vehicle as follows: Class vehicle { char vehicletype[10]; int no_of wheels; public: void getdetials() { gets(vehicletype); cin>>no_of_wheels; } void showdetails()] { cout<<”Vehicle Type”<<vehicletype; cout<<”Number of Wheels=”<<no_of_wheels; } } Write a function showfile() to read all the records present in an already exiting binary file SPEED.DAT and display them on the screen ,also count the number of records present in the file. Answer: Void showfile() { ifstream fin; fin.open(“SPEED.DAT”,ios::in|ios::binary); vehicle v1; int count=0; while (!fin.eof())

{ fin.read((char *)&v1,sizeof(v1)); count++; v1.showdetails();

} cout<<”Total number of records are “<<count; } Q2. Write a program that prints a text file on the printer. Answer:- #include<iostream.h> #include<fstream.h> #include<process.h> int main() { char filename[13], ch;

cout<<”enter the text file name :”; cin.getline(filename,13); ifstream fin; fin.open(filename); if(!fin) {cerr<<”\nFile can’t be opened !\n”; exit(-1); } ofstream fout; fout.open(“PRN”); while(fin.get(ch)!=0) fout.put(ch); return 0;

Page 96: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 96

} Q3. Write a c++ program ,which initializes a string variable to the content.”Time is a grat teacher but unfortunately it kills all its pupils.Berlioz”and output the string one character at a time to the disk file OUT.TXT .You have to include all the header files required. Answer: #include<fstream.h> Int main() {

ofstream fout(“OUT.TXT”); Char*str=” Time is a grat teacher but unfortunately it kills all its pupils.Berlioz”; Int i=0; If(!fout) {

cout<<”File cannot be opened “; return 0;

} While (str[i]!=’\0’) {

fout<<str[i]; i++;

} fout.close(); } Q4. Write a program that display the size of a file in bytes. Answer: #include<iostream.h> #include<fstream.h> #include<process.h> #include<conio.h> int main() {

char filename[13]; clrscr(); cout<”Enter Filename:\n”; cin.getline(filename,13); ifstream infile(filename); if(!infile) {

cout>>”sorry ! Can not open “<<filename <<”file\n”; Exit(-1);

} int no_bytes=0; char ch; while(cin.get(ch)) {

no_bytes ++; }

cout<<”File Size is”<<no_bytes<<”bytes\n”; return 0; }

Page 97: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 97

Q5. What will be the output produced by the following code? Answer: #include<iostream.h> #include<fstream.h> #include<process.h> #include<conio.h> int main() { clrscr() char filename[13]; cout<<”Enter Filename:”; cin.getline(filename,13); ifstream in(filename); if(!in) {cout<<”Cannot open input file!\n”; return (0) } Char str[255]; While(in) {in.getline(str,255); Cout<<str<<”\n”; } in.close(); return 0; }

Page 98: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 98

DATA BASE CONCEPT Q.1. What is foreign Key? What is its purpose? Ans: A non key attribute, whose value are derived from the primary key of some other table, is known as foreign key in the current table.

The table in which this non-key attribute i.e. foreign key attribute exists, is called a foreign table.

Q.2. Define the terms Tuple and Attribute Ans: Tuples: The rows of tables (relations) are generally referred to as tuples.

Attribute: The columns of tables are generally referred to as attribute.

Q.3. What do you understand by the terms Cardinality and Degree of the table? Ans Degree: The number of attributes in a relation determines the degree of a relation. A relation having 3 attributes is said to be a relation of degree 3.

Cardinality: The number of rows in a relation is known as Cardinality. Q.4. What is the main function of DBA. Ans: The DBA must be a manager, more than a technician-seeking to meet the needs of people who use the data. Since many user may share the same data resource, the DBA must be prepared to meet the need and objective. Q.5. Write a query on the customers table whose output will exclude all customers with a rating <=100, unless they are located in Shimla. Ans. SELECT * FROM customers WHERE rating >100 OR city =’Shimla’ ; Q.6. Write a query that selects all orders except those zeros or NULLs in the amount field. Ans. SELECT * FROM Orders WHERE amt < >0 AND (amt IS NOT NULL) ; Q.7. Write a query that lists customers in descending order of rating. Output the rating field first, followed by the customer’s name and number. Ans. SELECT rating, cust-name, cust-num FROM customers ORDER BY rating DESC ; Q.8. Write a command that puts the following values, in their given order, into the salesman table:

cust-name-Manisha, city-Manali, comm.- NULL, cust-num-1901. Ans. INSERT INTO salesman (city, cust-name, comm.,cust-num) VALUES(‘Manisha’,NULL,1901) ; Q.9. What are DDL and DML? Ans:- The DDL provides statements for the creation and deletion of tables and indexes.

The DML provides statements to enter, update, delete data and perform complex queries on these tables. Q.10. What is the difference between Where and Having Clause ? Ans: The HAVING clause places the condition on group but WHERE clause places the condition on

individual rows Q.11. What do you understand by constraints ? Ans: Constraints are used to enforce rules at table level when ever row is inserted, updated/deleted from table.

Constraints can be defined to one of the Two level. Column Level: Reference to a single column. can be defined any type of integrity.

Page 99: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 99

Table Level: References one or more columns and is defined separately from definition of the columns in the table.

Q.12. Write some features of SQL?

Ans: Recovery ad Concurrency:- Concurrency is concerned with the manner in which multiple user operate upon the Database. Security: The Security can be maintained by view mechanism. Integrity Constraints-> Integrity constraints are enforced by the system.

Q.13. Write various database objects available in SQL?

Ans: Table: A Table is used to store Data View: A view is the temporary table created using Original table. Sequence: Sequences are used to generate Primary key value. Index: They are used to improve queries. Synonym: They give alternative names to objects.

Q.14. Write the rules to name an objects?

Ans :

• The maximum length must be 30 character long.

• The Object name should not contain quotation mark.

• The name must start with letter.

• The use of $ and # is discouraged in the object name.

• A name must not be a reserved name.

Q.15. What are group Functions

Ans: The aggregate functions are group functions. They return result based on groups of rows. The group functions are AVG(), COUNT(), MAX(), MI N(), SUM()

Q.16. What are column alias?

Ans: In many cases heading table may not be descriptive and hence it difficult to understand. In such case we use columns alias It will change column heading with column alias.

Page 100: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 100

Q.17. Write the SQL query commands based on following table

Table : Book

Book_id Book name Author_name Publisher Price Type Quantity

C0001 Fast Cook Lata Kapoor EPB 355 Cookery 5

F0001 The Tears William Hopkins First Publi. 650 Fiction 20

T0001 My First c++ Brain & Brooke FPB 350 Text 10

T0002 C++ Brain works

A.W. Rossaine TDH 350 Text 15

F0002 Thunderbolts Anna Roberts First Publ. 750 Fiction 50

Table : issued

Book_Id Quantity Issued

T0001 4

C0001 5

F0001 2

Write SQL query for (a) to (f)

(a) To show book name, Author name and price of books of First Pub. Publisher (b) To list the names from books of text type (c) To Display the names and price from books in ascending order of their prices. (d) To increase the price of all books of EPB publishers by 50. (e) To display the Book_Id, Book_name and quantity issued for all books which have been issued (f) To insert a new row in the table issued having the following data. ‘F0003’, 1 (g) Give the output of the following

i. Select Count(*) from Books ii. Select Max(Price) from books where quantity >=15

iii. Select book_name, author_name from books where publishers=’first publ.’ iv. Select count(distinct publishers) from books where Price>=400

Ans: (a) Select book_name, author_name , price from books where publisher=’First Publ’ (b) Select book_name from books where type=’Text’ (c) Select book_name, price from books Order by Price; (d) Update books set price=price+50 where publishers=’EPB’ (e) Select a.book_id,a.book_name,b.quantity_issued from books a, issued b where a.book_id=b.book_id (f) Insert into issued Values (‘F0003’,1); (g)

i. 5 ii. 750

iii. Fast Cook Lata Kappor My First c++ Brain & Brooke

iv. 1

Q.18.

TABLE: GRADUATE

S.NO NAME STIPEND SUBJECT AVERAGE DIV.

1 KARAN 400 PHYSICS 68 I

2 DIWAKAR 450 COMP. Sc. 68 I

3 DIVYA 300 CHEMISTRY 62 I

Page 101: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 101

4 REKHA 350 PHYSICS 63 I

5 ARJUN 500 MATHS 70 I

6 SABINA 400 CEHMISTRY 55 II

7 JOHN 250 PHYSICS 64 I

8 ROBERT 450 MATHS 68 I

9 RUBINA 500 COMP. Sc. 62 I

10 VIKAS 400 MATHS 57 II

(a) List the names of those students who have obtained DIV I sorted by NAME. (b) Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received in a year

assuming that the STIPEND is paid every month. (c.) To count the number of students who are either PHYSICS or COMPUTER SC graduates. (d) To insert a new row in the GRADUATE table:

11,”KAJOL”, 300, “COMP. SC.”, 75, 1 (e) Give the output of following sql statement based on table GRADUATE:

(i) Select MIN(AVERAGE) from GRADUATE where SUBJECT=”PHYSICS”; (ii) Select SUM(STIPEND) from GRADUATE WHERE div=2; (iii) Select AVG(STIPEND) from GRADUATE where AVERAGE>=65; (iv) Select COUNT(distinct SUBDJECT) from GRADUATE;

Assume that there is one more table GUIDE in the database as shown below: Table: GUIDE

(f) What will be the output of the following query:

SELECT NAME, ADVISOR FROM GRADUATE,GUIDE WHERE SUBJECT= MAINAREA; Ans: (a) SELECT NAME FROM GRADUATE WHERE DIV='I' ORDER BY NAME; (b) SELECT NAME, STIPEND, SUBJECT, STIPEND*12 STIPEND_YEAR FROM GRADUATE; (c) SELECT SUBJECT, COUNT(NAME) FROM GRADUATE GROUPBY (SUBJECT) HAVING

SUBJECT='PHYSICS' OR SUBJECT='COMP. Sc.'; (d) INSERT INTO GRADUATE VALUES(11,'KAJOL',300,'COMP. Sc.',75,1); (e) (i) MIN(AVERAGE) 63

(ii) SUM(STIPEND) 800 (iii) AVG(STIPEND) 420 (iv) COUNT(DISTINCTSUBJECT) 4

(f) SELECT NAME, ADVISOR FROM GRADUATE, GUIDE WHERE SUBJECT=MAINAREA; NAME ADVISOR DIVYA RAJAN SABINA RAJAN KARAN VINOD REKHA VINOD JOHN VINOD Q.19. Table: Employees

Empid Firstname Lastname Address City

010 Ravi Kumar Raj nagar GZB

105 Harry Waltor Gandhi nagar GZB

152 Sam Tones 33 Elm St. Paris

MAINAREA ADVISOR

PHYSICS VINOD

COMPUTER SC ALOK

CHEMISTRY RAJAN

MATHEMATICS MAHESH

Page 102: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 102

215 Sarah Ackerman 440 U.S. 110 Upton

244 Manila Sengupta 24Friends street New Delhi

300 Robert Samuel 9 Fifth Cross Washington

335 Ritu Tondon Shastri Nagar GZB

400 Rachel Lee 121 Harrison St. New York

441 Peter Thompson 11 Red Road Paris

Table: EmpSalary

Empid Salary Benefits Designation

010 75000 15000 Manager

105 65000 15000 Manager

152 80000 25000 Director

215 75000 12500 Manager

244 50000 12000 Clerk

300 45000 10000 Clerk

335 40000 10000 Clerk

400 32000 7500 Salesman

441 28000 7500 salesman

Write the SQL commands for the following : (i) To show firstname,lastname,address and city of all employees living in paris (ii) To display the content of Employees table in descending order of Firstname. (iii) To display the firstname,lastname and total salary of all managers from the tables Employee and

empsalary , where total salary is calculated as salary+benefits. (iv) To display the maximum salary among managers and clerks from the table Empsalary. (v) Give the Output of following SQL commands:

(i) Select firstname,salary from employees ,empsalary where designation = ‘Salesman’ and Employees.empid=Empsalary.empid;

(ii) Select count(distinct designation) from empsalary; (iii) Select designation, sum(salary) from empsalary group by designation having count(*) >2; (iv) Select sum(benefits) from empsalary where designation =’Clerk’;

Ans: (i) select firstname, lastname, address, city from employees where city='Paris'; (ii) select * from employees order by firstname desc; (iii) select employees.firstname, employees.lastname, empsalary.salary + empsalary.benefits

total_salary from employees, empsalary where employees.empid=empsalary.empid and designation='Manager';

(iv) select max(salary) from empsalary where designation in('Manager','Clerk') (v) (i) select firstname, salary from employees, empsalary where designation='Salesman' and

employees.empid=empsalary.empid FIRSTNAME SALARY Rachel 32000 Peter 28000 (ii)select count(distinct designation) from empsalary; COUNT(DISTINCTDESIGNATION)

4 (iii)select designation, sum(salary) from empsalary group by designation having count(*)>2; DESIGNATION SUM(SALARY) Clerk 135000 Manager 215000 (iv)select sum(benefits) from empsalary where designation='Clerk'; SUM(BENEFITS)

32000

Page 103: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 103

Boolean Algebra

1. Prove that X.(X+Y)=X by algebraic method. Solution:

L.H.S.= X.(X+Y)=X .X + X .Y = X + X .Y = X .(1+Y) =X . 1 = X = R.H.S 2. Give duals for the following :

a) A+ ĀB

b) AB+ĀB Solution:

a) A. (Ā +B) b) (A + B). (Ā + B) 3. State and verify Involution law. Solution:

Involution Law states : Ā = A Truth Table:

4. State and verify Duality principle. Solution:

Principle of duality states that from every boolean relation, another boolean realation can be derived by (i) changing each OR sign(+) to an AND sign(-). (ii) changing each AND sign(-) to an OR sign(+) (iii) replacing each 1 by 0 and each 0 by 1.

The new derived relation is known as the dual of the original relation. Dual of A+ ĀB will be A+ ĀB = A. (Ā +B). 5. State and verify Absorption law in boolean algebra.

Solution: Absorption law states: (i) X + XY= X (ii) X ( X + Y) = X

Input Output

X Y X + XY

0 1 1 1

0 1 0 1

0 0 1 1

6. Draw logic circuit diagram for the following expression:

A Ā Ā

0 1

1 0

0 1

Page 104: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 104

Y= AB+BC+CĀ Solution:

a b Y c 7. State the distributive laws of boolean algebra. Soln: Distributive laws states: (i) X(Y+Z)=XY+XZ (ii) X+YZ=(X+Y)(X+Z) 8. Reduce the following Boolean expression using K-Map: F(P,Q,R,S)=Σ(0,3,5,6,7,11,12,15) Soln: R’S’ R’S RS RS’ P’Q’ P’Q

PQ

PQ’

This is 1 quad, 2airs & 2 lock Quad(m3+m7+m15+m11) reduces to RS Pair(m5+m7) reduces to P’QS Pair (m7+m6) reduces to P’QR Block m0=P’Q’R’S’ M12=PQR’S’ hence the final expressions is F=RS + P’QS + P’QR + PQR’S’ + P’Q’R’S’

9. Reduce the following Boolean expression using K-Map:

1 0

1

1 3

2

4

1 5

1 7

1 6

1 12

13

1 15

14

8

9

1 11

10

AND

AND

AND

Page 105: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 105

F(A,B,C,D)=∏(0,1,3,5,6,7,10,14,15) Soln:

Reduced expressions are as follows: For pair 1, (A+B+C)

For pair 2, (A’+C’+D) For Quad 1, (A+D’)

For Quad 2, (B’+C’) Hence final POS expression will be Y(A,B,C,D)= (A+B+C) (A+C+D) (A+D) (B+C)

Communication and Network Concepts Q.1 What is protocol? How many types of protocols are there? Ans. When computers communicate each other, there needs to be a common set of rules and instructions that each computer follows. A specific set of communication rules is called a protocol. Some protocol: PPP, HTTP, SLIP, FTP, TCP/IP Q.2 What is the difference between Networking and Remote Networking? Ans. The main difference between Networking and Remote Networking, is the network which we use in offices or other places locally such LAN or INTERNET and remote networking is one which we use TERMINAL Services to communicate with the remote users such WAN. Q.3 What is point-to-point protocol? Ans. A communication protocol used to connect computer to remote networking services include Internet Service Providers. In networking, the Point-to-Point protocol is commonly used to establish a direct connection between two nodes. Its primary use has been to connect computers using a phone line. Q.4 How gateway is different from router? Ans. A gateway operates at the upper levels of the OSI model and translates information between two completely different network architectures. Routers allow different networks to communicate with each other. They forward packets from one network to another based on network layer information. A gateway can interpret and translate the different protocols that are used on two distinct networks. Unlike routers that successfully connect networks with protocols that are similar, a gateway perform an application layer conversion of information from one protocol stack to another. Q.5 What is the role of network administrator? Ans. Basic tasks for which a network administrator may be responsible:

0 0 0

0 0 0

0 0

0

Page 106: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 106

Setting up and configuring network hardware and software. Installing and configuring network media and connections. Connecting user nodes and peripherals of all kinds to the network. Adding users to and removing users from the network. Managing user account. Ensuring the security of the network. Provide training to the users to utilize the network’s resources. Q.6 What is the difference between baseband and broadband transmission? Ans. Baseband is a bi-directional transmission while broadband is a unidirectional transmission. No Frequency division multiplexing possible in base band but possible in broadband.

SNo Baseband Broadband

1 Entire bandwidth of the cable is consumed by a signal

broadband transmission, signals are sent on multiple frequencies, allowing multiple signals to be sent simultaneously.

2 Digital signals Analog signals

3 bi-directional transmission unidirectional transmission

4 No Frequency division multiplexing possible

Frequency division multiplexing possible

5 Uses for short distance Uses for long distance

Q.7 What are the difference between domain and workgroup? Ans.

SNo Domain Workgroup

1. One or more computers are servers All Computers are peers.

2. If you have a user account on the domain, you can logon to any computer on the domain.

Each computer has a set of accounts.

3. There can be 100+ computers Typically not more then 20-30 computers

4. The computers can be on different local network

All computers must be on the same local netork.

Q.8 What is the differences between POP3 and IMAP Mail Server? Ans. IMAP is a standard protocol for accessing e-mail from a local server. A simpler e-mail protocol is Post Office Protocol 3 (POP3), which download mail to the computer and does not maintain the mail on the server. IMAP, e-mails are stored on the server, while in POP3, the messages are transferred to the client’s computer when they are read. Q.10 Name different layer of the ISO OSI Model. Ans. International Standard Orrganisation – Open Systems Interconnection has seven layers; Physical Layer Data Link Layer Network Layer Transport Layer Session Layer Presentation Layer Application Layer Q.11 What is client server architecture?

Page 107: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 107

Ans. To designated a particular node which is well known and fixed address, to provide a service to the network as a whole. The node providing the service is known as the server and the nodes that use that services are called clients of that server. This type of network is called Client-Server Architecture. Q.12 What is FDM? Give example. Ans. FDM-Frequency Division Multiplexing is used in analog transmission. It is often used in short distance. It is code transparent and any terminal of the same speed can use the same sub-channel after the sub-channel is established. The best example if FDM is the way we receive various stations in a radio. Q.13 describe the following in brief: i) MOSAIC ii) USENET iii) WAIS Ans. i) MOSAIC: is the program for cruising the internet. The National centre wrote this program for Super Computer application at the university of Illinois. It has a simple window interface, which creates useful hypertext links that automatically perform some of the menu bar and button functions. ii) USENET: is the way to meet people and share information. Usenet newsgroup is a special group set up by people who want to share common interests ranging from current topic to cultural heritages. iii) WAIS: is a WIDE AREA INFORMATION SERVER.

XI IP HOTS Questions

P L Meena

PGT – Comp. Sc.

K.V. Rekongpeo, HP 14. A relation R(A,B,C,D,E,F) have following dependency AB C ,ABD , BC,ABE , AF Break

down this relation into 2NF Answer R1 (A, B, D, E,F) and R2 (B, C) and R3 (A, F) 2. A relation R(A,B,C,D,E,F) have following dependency A C ,AB , A, BC,AE , EF, A F Break down this relation into 3NF Answer R1 (A, B, D, E,) and R2 (B, C) and R3 (E, F) Q 3: create the following series using sequence 1,5,9,13.....201 Answer: create sequence seq_series start with 1 incremented by 4 maxvalue 201 order consider the following structure and give the answer below Table: Customer

Name Address State Zip Phone Remarks

Amit Z-123 town park

Delhi 110023 54646466 None

Page 108: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 108

Mohan C-56 Town Park

Kerla 2344089 43553553 None

Table Part

Partno Description Price

1 Nut 100

2 Bolt 200

3 Screw 400

4 RAM 1000

ORDER

ORDERNO

ORDERDATE

Name Partno Qty. Remark

1 15-may-2009

Mohan 1 2 None

2 15-jun-2007 Amit 2 2 None

3 20-Jun-2001 Amit 4 10 None

Answer the following query on the basis of above table 4 Display the names and average order value for customer whose average order value is more than at least one average ordervalue grouped by customer Answer SELECT NAME ,AVG(quantity) from order group by name having Avg(qty)> ANY (select avg(qty) from orders group by name qes 5: Find the name of all customer who post the order after 15-jun-2007 Answer SELECT NAME FROM ORDER WHERE ORDERDATE< 15-JUN-2007 6 Re-write the following using a join query: SELECT ename FROM emp WHERE deptno = (SELECT deptno FROM emp WHERE ename = 'JONES'); ANSWER

Select ename ,deptno from emp join dept on emp.deptno=dept.deptno where emp.ename=’JONES’ 7 Re-write the following using NOT EXISTS clause: SELECT dept.dname FROM dept WHERE dept.deptno NOT IN( SELECT deptno FROM emp WHERE deptno IS NOT NULL ); Answer SELECT dept.dname FROM dept

Page 109: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 109

WHERE dept.deptno NOT EXISTS( SELECT deptno FROM emp WHERE deptno IS NOT NULL ); Table: PERSON

Fieldname Datatype Size comment

P_Id int Not null unique

Lastname varchar 255 Not null unique

FirstName varchar 255

Address varchar 255

City varchar 255

Salary Number(10,2)

Check >10000

Question 8: Create the table using the above constraint CREATE TABLE Persons ( P_Id int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255), salary number(10,2) check (salary>10000), CONSTRAINT uc_PersonID UNIQUE (P_Id,LastName) ) qes9: drop the constriant on the table person drop constraint uc_PersonID question 10: List all person whose city exist in {delhi,Channi,Mumbai} answer: select * from Person where city in ('delhi','Channi','Mumbai') ques10: List all person whose salary between 10000 and 20000 answer: select * from Person where salary between 10000 and 20000 Question 12: what is RDBMS list the four commercial available RDBMDS Answer RDBMS stands for Relational Database Management System.RDBMS is the basis for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle and Microsoft Access.The data in RDBMS is stored in database objects called tables.

A table is a collections of related data entries and it consists of columns and rows.

Commercial RDBMS: MS SQL Server, IBM DB2, Oracle and Microsoft Access.

Q Two table have following structure

Page 110: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 110

Employee(empcode varchar(10) , fname varchar(100) not null ,lname varchar(100),city varchar(100),dtofhiredate,salary number(10),deptcode varchar(10) ) Department (deptcode varchar (10) name varchar (100), location varchar (100)) 13.Create the above table with having above structure Answer: create table department(deptcode varchar(10),name varchar(100),location varchar(100)) create table employee(empcode varchar(10),fname varchar(100) not null,lname varchar(100),city varchar(100),dtofhire date,salary number(10,2),deptcode varchar(10)); 14. Add primary key constriant in employee(empcode) and department(deptcode) tables answer: Alter table department add constraint p_key primary key(deptcode) Alter table employee add constraint p_key1 primary key(empcode) 15. write a query to display the name and hiredate of all employee who are employed after the the employee 'SMITH'. Select name ,hiredate from employee where hiredate > ( select hiredate from employee where name='SMITH') ques16: create the index on the table employee on the field fname and lname Answer create index index_emp on employee(fname,lname) question 17: create the read only view on the table employee who have department start with 'A' answer: create view emp_view as select * from employee where employee.deptcode=department.deptcode and department.deptcode like 'A%' READ ONLY; question18: Display the output of the following program select concat(“RAM”,”MOHAN”) from dual; select LAST_DAY('10-jul-08') from dual; Answer: RAMMOHAN 31 question19:List the name of all employee who do not have same salary using self join Answer: select emp1.name,emp2.name from employee emp1,employee emp2 where emp1.salary <> emp2.salary question20: consider the following scenario GRANT ALL on EMPLOEE TO student_user WITH GRANT OPTION explain the above code Answer: a) it create all privileges on student_user b) WITH GRANT OPTION sepcifies that student can create new user and assign privileges to other user

Page 111: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 111

XII IP HOTS Questions

Amit Meena

PGT – Comp. Sc.

K.V. Narmada Nagar

UNIT – 1 COMPUTER NETWORKING AND OPEN STANDARDS:

Write the two advantages and two disadvantages of Bus Topology in a Network ‘A web server has started receiving endless messages.’ What is the situation like? How would you solve this problem? INDIAN PUBLIC SCHOOL in Darjeeling is setting up the network between its different wings. There are 4 wings named as SENIORS(S), JUNIORS(J), ADMN(A) and HOSTEL(H) Distances between various wings are given below:

Wing A to Wing S 100 m

Wing A to Wing J 200 m

Wing A to Wing H 400 m

Wing S to Wing J 300 m

Wing S to Wing H 100m

Wing J to Wing H 450 m

No. of Computers:

Wing A 10

Wing S 200

Wing J 100

Wing H 50

(i) Suggest a suitable Topology for Networking the computer of all Wings (ii) Suggest the placement of Hub/Switch in the network. (iii) Mention an economic technology to provide internet accessibility to all wings.

Write the different type of Topologies with one advantage and one disadvantage. Define Circuit Switching and Packet Switching Give one advantage and one disadvantage of optical fiber and coaxial cable used in communication. Explain the following terms

(1) Video Conferencing (2) TCP\IP

Knowledge Supplement Organization has set up its new center at Mangalore for its office and web based activities. It has 4 blocks of buildings as shown in the diagram below.

Block A

Block C

Block D

Block B

Page 112: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 112

The distances between the building are as : Block A to Block C- 120 meters Block A to Block B- 20 meters Block A to Block D- 550 meters Block B to Block D- 80 meters Block D to Block C- 110 meters Block B to Block C- 280 meters The number of computers in each Block are as follows: Block A - 120 Block B - 180 Block C - 20 Block D - 110 (i) Suggest a cable layout of connections between the blocks and type of cable.

(ii) Suggest the most suitable place (i.e. block) to house the server of this organization with a suitable reason.

(iii) Suggest the placement of the following devices with justification. (a) Repeater (b) Hub/Switch

(iv) The organization is planning to link its front office situated in the city in a hilly region where cable connection is not feasible, suggest an economic way to connect it with reasonably high speed.

What is the role of network administrator? What is the significance of Unicode in terms of Indian Language Computing? Discuss the risks associated with the use of OSS? What is Proprietary Software? What is GNU? Who initiated it? What is LAMP in Open Source concepts?

UNIT – 2 PROGRAMMING: Consider the following class: public class IdentifyMyParts { public static int x = 7; public int y = 3; } a. What are the class variables?

b. What are the instance variables?

What is the output from the following code? IdentifyMyParts a = new IdentifyMyParts(); IdentifyMyParts b = new IdentifyMyParts(); a.y = 5; b.y = 6; a.x = 1; b.x = 2; System.out.println("a.y = " + a.y); System.out.println("b.y = " + b.y); System.out.println("a.x = " + a.x);

Page 113: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 113

System.out.println("b.x = " + b.x); System.out.println("IdentifyMyParts.x = " + IdentifyMyParts.x); Consider the following two classes: public class ClassA { public void methodOne(int i) { } public void methodTwo(int i) { } public static void methodThree(int i) { } public static void methodFour(int i) { } } public class ClassB extends ClassA { public static void methodOne(int i) { } public void methodTwo(int i) { } public void methodThree(int i) { } public static void methodFour(int i) { } } a. Which method overrides a method in the superclass? b. Which method hides a method in the superclass? c. What do the other methods do? Create an application that receives a number through a text field and prints the sum of its individual digits when the Submit button is pressed as shown in the following fig: In the following, function abc is a part of some class. Assume that arguments x and y are greater than 0 when the function is invoked. int abc (int x, int y) { // Assume x >= 0 and y > 0 if (x >= y) { x = x – y; return abc (x , y) ; } else { return x ; }

Enter a number Sum of digits is

546

Submit

15

Page 114: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 114

} Design a class to represent a bank account. Include the following members: (1) Name of Depositor (2) Account Number (3) Type of Account (4) Balance in account Write a for loop that displays the numbers from 5 to 1 i.e., 5,4,3,2,1. Illustrate the concept of function overloading with the help of an example How are arguments sent to the base constructors in multiple inheritance? Whose responsibility is it? How are protected members different from public and private members of a class ? What are bitwise and bit shift operators? How are protected members different from public and private members of a class ? create a webpage to display a table as given below: Create an HTML document to display the following text in the title bar of the browser. “Welcome to the world of computers”

Explain the use of <BLOCKQUOTE> with an example. Give an example for header tags {<H1> TO <H6>} What is the role of the following tags: - <pre> <tt> Insert an image in an HTML document and align the text to the right side of the image Write HTML to produce a table having background image image.gif stored in pictures folder of E:drive and having height of 250 pixels and width of 150 pixels What is XML structure? How does XML make SGML simpler and still let you define your own document types? How are SGML, HTML, and XML related? Create an XML document to represent a set of Objective questions with four possible options but there is only one correct option. Define following terms: (1) Application server (2) Network Media Differentiate between web browser and web server? Which event get fired:

(1) user presses enter in a text field. (2) user presses in a password field. (3) knob of scroll bar is dragged.

Page 115: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 115

(4) A radio button is clicked. Create XML document to represents your marksheet. (1) create stylesheet for this and open it on browser. (2) check whether your XML document well-formed or not. UNIT – 3 RELATIONAL DATABASER MANAGEMENT SYSTEM: Write a SQL command for creating a table student who structure is given below

Field name Datatype Size constraint

Rno Number 3 Part of primary key

Class Varchar2 5 Part of primary key

Percentage Number 5,2 >0 and <=100

(ii) Write a command for adding a field remarks to the above created table whose data type is varchar2 and size is 40 with not null constraint. (iii)Write a command for creating view student1 on the student table which contain those student records who got 75 and above percentage. (iv) Write command for giving select and update privileges on the above table to the demo user with grant

option. (v) Write command for removing view student1 from the database. Answer the questions based on the table Student given below: Table Name : Student

Column Name Data Type Size Description Constraint

RollNumber NUMBER 2 Student’s Roll Number Primary Key

Name VARCHAR2 25 Name of Student NOL NULL

Class VARCHAR2 3 Class of Student

Stream VARCHAR2 15 Stream opted by the Student

TotalMarks NUMBER 8,2 Total Marks scored by the Student

Grade VARCHAR2 1 Grade scored by the student Can be ‘A’ or ‘B’ or ‘C’

(a) Write SQL command to display Roll numbers, names, Total marks and grades of all the students in “Nonmedical” stream sorted by Total marks in descending order.

(b) Write SQL command to display the details of all the students in stream “ Medical” with Total marks is between 500 and 1000.

(c) Write SQL command to display name of students whose name contain ‘S’ as first alphabet and ‘L’ as third alphabet

(d) Create table CLUB given below:

Table : CLUB

Write the SQL query commands based on following table: Table : Book

Book_id Book name Author_name Publisher Price Type Quantity

C0001 Fast Cook Lata Kapoor EPB 355 Cookery 5

F0001 The Tears William First Publi. 650 Fiction 20

Column Name Data Type Size Description Constraint

Member_No NUMBER 4 Member number Primary Key

Member_name VARCHAR2 30 Name of the member NOL NULL

Address VARCHAR2 30 Address of the member

Age NUMBER 3 Age of the member >=18

Page 116: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 116

Hopkins

T0001 My First c++ Brain & Brooke FPB 350 Text 10

T0002 C++ Brain works

A.W. Rossaine TDH 350 Text 15

F0002 Thunderbolts Anna Roberts First Publ. 750 Fiction 50

Table : issued

Book_Id Quantity Issued

T0001 4

C0001 5

F0001 2

Write SQL query for (a) to (f)

(h) To show book name, Author name and price of books of First Pub. Publisher (i) To list the names from books of text type (j) To Display the names and price from books in ascending order of their prices. (k) To increase the price of all books of EPB publishers by 50. (l) To display the Book_Id, Book_name and quantity issued for all books which have been issued (m) To insert a new row in the table issued having the following data. ‘F0003’, 1 (n) Give the output of the following

i. Select Count(*) from Books ii. Select Max(Price) from books where quantity >=15

iii. Select book_name, author_name from books where publishers=’first publ.’ iv. Select count(distinct publishers) from books where Price>=400

A database for a local garage is needed. The database contains data items for customer's name, customer's address, customer's home telephone number, customer's work telephone number, the vehicle's make, the vehicle's model, description of the work done, cost of the work, date of work done, part number, part name, cost of each part and the total cost. Draw an Entity-Relationship

Diagram to depict this enterprise, noting any assumptions made.

Use an Entity-Relationship Diagram to depict the following requirements for a restaurant: The restaurant employs a number of chefs. A record is kept of each chef’s name, address, phone number and salary. Each chef can prepare a number of meals. The name of the meal and the price of the meal is recorded. Each meal consists of a number of ingredients. The name of the ingredient and the quantity required for that particular meal is recorded. These meals are ordered by customers. A record is kept of the customers name, address and phone number. A record is kept of the time and date the meal is ordered. State any assumptions made in the design of the E-R diagram. What is meant by the term ‘relationship between entities’ ? Explain the different types of relationships that can exist with example. As updates to an online order entry system are processed, the updates are recorded on a transaction tape and a hard copy transaction log. At the end of the day, the order entry files are backed up on tape. During the backup procedure, a drive malfunctions and the order entry files are lost. Which of the following are necessary to restore these files?

Page 117: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 117

A. The previous day's backup file and the current transaction tape B. The previous day's transaction file and the current transaction tape C. The current transaction tape and the current hard copy transaction log D. The current hard copy transaction log and the previous day's transaction file

Discuss the user view and system view of a transaction. Explain the meaning of the expression ACID transaction. Define rollback and roll forward. 1. Write the result of the follwoting queries: a) SELECT ROUND(150.79, -2) from DUAL b) SELECT LTRIM(‘NATASHA’, ‘NAT’) from DUAL c) SELECT ADD_MONTHS(’30-DEC-2007’, 2) FROM DUAL d) SELECT NEXT_DAY(SYSDATE, 'MONDAY') FROM DUAL 1. Write the result of the follwoting queries: a) SELECT ROUND(150.79, -2) from DUAL b) SELECT LTRIM(‘NATASHA’, ‘NAT’) from DUAL c) SELECT ADD_MONTHS(’30-DEC-2007’, 2) FROM DUAL d) SELECT NEXT_DAY(SYSDATE, 'MONDAY') FROM DUAL UNIT – 4 IT APPLICATIONS: Define the following: E-Governance, E-Business with example What is E-learning? What are its Social impacts? Mention 2 E-learning websites. What is Front end and Back end technique? What specifications should be meet by GUI front-end? What is Front-end and Database Connectivity? What are benefits of Database Connectivity?

Question Bank for Home Assignments XI CS

Sunil Kumar

PGT – Comp. Sc.

K.V. Suranussi 1. Write a program to input square matrix and interchange rows to column and column to rows. 2. Write a program to reverse a number. 3. Find the syntax error(s), if any, in the following program:

# include(iostream.h) void main ( ) int X,Y; cin>>X; for(Y=0,Y<10, Y++) if X= =Y

Page 118: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 118

cout<<Y+X; else cout>>Y; }

4. Write a program to transpose the matrix of size M*N? 5. Differentiate between unions and structures with help of an example. 6. Write a program to sort an array on N numbers in ascending order. 7. Write a program to check if a string is palimdrome or not. 8. WAP to read sales of 5 salesmen in 12 months and to print total sales made by each salesman. 9. WAP to find reverse of a string 10. What do you mean by array? Explain different types types of array. 11. What are characteristics of a good programming? 12. Mention the steps you would follow while writing a program. 13. What is the role of comments and indentation in a program? 14. What are the different methods to initialize an array? 15. Define function prototype? 16. What care should be taken while declaring a default argument variable? 17. Differentiate between call by value and call by reference with example. 18. Differentiate between built in function and user defined function. Give example of each. 19. What is variable scope? What is life-time of a variable? 20. Differentiate between actual and formal parameters with example? 21. What is constant argument? How is it useful in programming? 22. Predict the output of the following code:

void execute( int & x,int y=200) { int temp; temp+=y; x+=temp; if( y==200) cout<< temp<<x<<y; } void main( ) { int a=50,b=20; execute(b); cout<< a<<b<<endl; execute(a,b); cout<< a<<b<<endl; }

23. Determine the number of bytes required to store an array A[5][15] of base type integer. Assuming the

integer data type has size 4 bytes. 24. How many ways can an array are passed to a function. Explain with example. 25. Write a function to find the sum of the elements of the main diagonal elements of a matrix. 26. Write a program to find the largest element in a one dimensional array of integers. 27. WAP in C++ to enter and display the record of 10 students using a structure. 28. Write a program to find transpose of a matrix. 29. Program to find the position of a pattern string in main string. 30. Write a program to find the reverse of the string. 31. Write a program to evaluate the factorial of a number . 32. Program to read sales of 5 salesman in 12 months and to print total sales made by each salesman.

Page 119: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 119

33. Write a program to print Fibonacci series i.e. 0 1 1 2 3 5 8…. 34. WAP in C++ to find H.C.F of two inputed numbers . 35. What are the difference between a keyword and an identifier? 36. Write a program in C++ to accept marks in five subjects for a student and display the average mark. 37. Write the following real constants in exponent form: 17.251, 151.02, 0.00031, 0.452. 38. What is the difference between Runtime and Syntax errors? 39. What will be the character size of the following constants: ‘\a’, “\a”, “sachin\’s bat”. 40. Which one condition every c++ program must fulfill? 41. What do you understand by code generation? 42. What type of constants are the following: 14,011, 3.123, 0xA. 43. Predict and rectify errors:

int main() { cout<<enter the two numbers; cin>>num>>auto; float area= length*breadth; cout<<area is<<area }

44. Write a program in c++ to convert temperature in Celcious to Fahrenheit? 45. Define prettyprinting? 46. Define inheritance and polymorphism? 47. What stylistic guidelines would you follow for naming identifiers in your program? 48. What is the significance of Null character in C++? 49. Why some characters though not nongraphic still typed using escape sequence? 50. Correct the errors if any in the following expressions: a. cout<<”a” a; b. cout>>”you are a fool”; c. int a; b ; d. include<conio.h> 51. If a reference to cerr is producing an error, what could be the possible reasons for it? 52. Define the term Paradigm. 53. What output will be the following code fragment produce?

int val, res, n=1000; cin>>val; res = (n+val) >1750 ? 400 : 200; cout<<res; i) if the input is 2000 ii) if the input is 500

54. Evaluate X=a++ + --a; if a=20 initially? 55. Write a c++ program to input two numbers and print their quotient and reminder ? 56. What will be the result of the following if ans is 6 initially: a. ans= ans / 6; b. cout<<ans; 57. Write the corresponding c++ statement for aX2+bX+c=0; 58. Predict the output: a. unsigned int a; b. cout<<sizeof(a); 59. What is unary operator? How unary + is different from binary + operator? 60. Suppose value is an identifier of int type having value 25, after the statement

float chks=value ; What does the variable chks stores?

61. Compare the two statements:

Page 120: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 120

a. char pcode= 75; b. char pcode=’k’; 62. Determine the order of evaluation of the following expression 63. !a+3&&++4||(x/y==2) 64. Write a c++ program to compute the simple interest on a given amount and time. 65. If the time is 2 years or more calculate it with 3% rate of interest and 5% otherwise. 66. What data type is required for a variable to store 34000? 67. Predict the output: a. cout<<setprecision(3)<<12.3456789; 68. Identify the error if any : a. const y; 69. What is the difference between ‘a’ and “a”? 70. Define the following: 71. i) array ii) pointer 72. Write a program in c++ to check wheather a number is even or odd? 73. Find out errors, if any, in the following C++ statements: 74. i) cout<<”a=” a; ii) cin>>y;>>j; iii) break = x*y; 75. If the file iostream.h is not included in a program, what happens? 76. What will be the output of the following: 77. cout<< ++a<< ++a<<a; 78. if a is 20 initially? 79. What will happen if you put a semicolon after an if statement? 80. Give an example to illustrate the same. 81. What is dangling else problem? How is it overridden? Give example to support your answer. 82. Write an alternative code for the following using switch-case construct:

char wish; if( wish== ‘a’) cout<< “ YOU WILL GETT 40 OUT OF 40”; else if( wish== ‘b’) cout<< “ MY FRIEND WILL GET 40 OUT OF 40”; else if( wish== ‘c’) cout<< “ TEACHER WILL NOT GIVE 40 OUT OF 40”; else cout<<”NO ONE WILL GET 40 OUT OF 40”;

83. What will happen if you forget to put a break statement after each case statement in a switch block? 84. Use _______ loop when you have to repeat a block of statements repeatedly specific number of time. 85. Predict the out put :

for (int a=10;a>=0;a-=3); cout<<a; for( int outer=1;outer<10;outer+=4) { for(int inner = 1;inner<=outer;inner+=2) cout<<outer<< “ ”<<inner<<endl; }

86. What will be the output of the following code: int a=0; start: cout<< “\n”<<++a; if(a<50) goto start;

87. Differentiate between a break and a continue statement?

Page 121: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 121

88. Write a program to check whether a number is prime or not. 89. Write aprogram to print the reverse and sum of all the digits of a number entered through keyboard.. 90. Correct the following code so that it is fully functional:

value=4; do{ total+=value; cout total; while value<=8;

91. Predict the output: if(0)

cout<< “Have you answered correctly”; cout<< “ It will be known after the exam”;

92. Rewrite the following code using do while looping construct: i=100; while(i) cout<<i- -; cout<< “ Thank you”;

93. Identify the error(s) in the following code fragment. Discuss reason(s) for error(s). Also correct the code. { int a,b; goto end; char ch; cin>>ch; if( ch!=’\n’) cout<< “ not a newline”; end: }

94. Predict the output of the following codes: //version 1 //version 2 int f=1,i=2; int f=1,i=2; while(++i<5) do{ f*=I; f*=I; cout<<f; }while(++i<5) . cout<<<<f;

95. Predict the output: for( int i= 0;i<=50;i++) j=i/2; cout<<j;

96. Write equivalent while loop for the following for loop: const int SZ=25; for( int i=0,sum=0;i<SZ;i++) sum+=I; cout<< sum;

97. Write a program to find the sum of the following series: 98. s = x+ 2x/2! +3x/3!+ 4x/4!................................... . 99. Name the header files required for the following standard library functions:

i) ceil( ) ii) exit ( ) iii) getch( ) iv) setw ( )

100. If a function does not return a value, declare the result type as ________ .

Page 122: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 122

101. Define function prototype? Given the following function. int fun(int,char);

102. Why the following will not work? void func( ) { int res; fun(1,2); }

103. What care should be taken while declaring a default argument variable? A function returning by __________ can appear on the left hand side of an assignment statement. Differentiate between call by value and call by reference with example.

104. Differentiate between built in function and user defined function. Give example of each. 105. What is variable scope? What is life-time of a variable? 106. Write a function which will take the height of the person in inches and return the height in feet and

inches in two separate variables?(No main function) 107. Differentiate between actual and formal parameters with example? 108. What is constant argument? How is it useful in programming? 109. Identify the problem with the following code. Suggest a way to correct the code.

void large ( int & a, int & b); int main ( ) { large(5,7); } void large ( int & a, int & b) { if(a>b) a=-1; else b=-1; }

110. What will be the output of the following code fragment: float interest ( float prnc,int time=2,float rate=0.10); int main( ) { cout<<interest(6100,1)<<” \n”; cout<<interest(5000,2)<<” \n”; cout<<interest(5000,3,0.12)<<” \n”; cout<<interest(5000)<<” \n”; } float interest(float prnc,int time, float rate) { return prnc*time*rate:}

111. Write a function definition that takes an int argument and doubles it. The function does not return a value.( No need to write main function)

112. Write a program using function calc( ) that takes two integer and one character arguments and returns the result of the corresponding arithmetic operation depicted by the character passed on the two variables? ( FOUR FUNCTION CALCULATOR)

113. Write a program using function to swap the content of two variables without using a third variable.( No need to write main function)

114. Write a statement that defines a 1-D array Exam of type double that holds 10 elements. 115. Can any dimension of an array be skipped at its declaration time?

Page 123: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 123

116. Element amount [9] is which element of the array? 117. An array name is itself a ________ to the first element of the array. 118. What will be the output of the following statement: 119. cout.write( “Vidyalaya”,5); 120. How C++ does view a string as? What character marks the end of the string? 121. What will be the output of the following code snippet:

#include<iostream.h> #include<conio.h> void main() { clrscr(); int b=0; int C[10]={1,2,3,4,5,6,7,8,9,10}; for( int i=0;i<10;i++) { if(c[i]%2==0) b+=c[i]; } cout<< “b=”<<b; }

122. Determine the number of bytes required to store an array A[5][15] of base type integer. Assuming the integer data type has size 4 bytes.

123. How many ways can an array are passed to a function. Give one example to describe one of them. 124. Give the output of the following program:

#include<iostream.h> #include<conio.h> void main() { clrscr(); char *str= “NAVODAYA”; for( int i=0;str[i]!= ‘\0’;i++) { for(int j=0;j<=i;j++) cout<<str[j]; cout<<endl; } }

125. What is the output of the following code fragment? int num=0; char ch; while(cin.get(ch)!= ‘.’) num++; cout<<num;

126. If the input contains: Do you like C++. 127. Define a two dimensional array MAT of 4X5 of type integer. Also initialize all the elements of MAT

with value 0. Construct one statement to assign the value 100 to cell in row 3 and column 4. 128. Write a function to reverse the content of a vector (Use temporary variable if you like). 129. Write a function to find the sum of the elements of the main diagonal elements of a matrix.

Write a function to check whether a string is palindrome or not. 130. Write a c++ function to find the product of two matrices if they are multiple compatible. 131. 17. Write a program to find the largest element in a one dimensional array of integers. 132. Explain different programming paradigms

Page 124: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 124

133. Explain basic concepts of Object oriented Programming. 134. What are the advantages and disadvantages of OOPs? 135. Explain the transitive nature of inheritance. 136. Explain the following with examples:- 137. Keywords b.identifiers c.punctuators d.literals 138. What are operators? Explain different type of operators. 139. What do you mean by header files? 140. Explain the comments in C++? 141. Explain the role of compiler in C++. 142. Write a programme in C++ to input a students’s marks in three subjects and print the percentage marks.

143. What do you mean by data types? 144. Explain the fundamental data types in detail. 145. Explain the derived data types in C++ with examples. 146. Write a programme in C++ to find a number is even or odd. 147. Write a programme in C++ to compute compound interest.

148. Define Software and its types. 149. Differentiate between the logical errors and runtime errors with one example each? 150. What is the use of comments in a program and its types? 151. What are the characteristics of a good program? 152. Expand ASCII, ISCII 153. What is the difference between the ‘a’ and “a”? 154. Write any four escape sequence characters? 155. What will be the result of the following two expressions if i=10 initially? i. ++i<=10 ii)i++<=10 156. Explain tokens in details with example. 157. Find errors if any in the following statements.

cout<<”X=”;X; cin>>x;>>y; cout<<”Enter a number”; cin>>x;

158. Define operators and its types? 159. Write the output of the following program.

#include<iostream.h> int func(int &x,int y=10) { if (x%y= = 0) return ++x; Else return y- -; } void main( ) { int p=20,q=23; q=func(p,q); cout<<p<<q<<endl; p=func(q);cout<<p<<q<<endl; q=func(p); cout<<p<<q<<endl; }

160. Write a program in C++ to find a string is palindrome or not. 161. Write a program in C++ to find the position of a pattern string in main stri 162. Write a program in C++ to read and display the record of 10 students using a structure. 163. Why do Computers use Binary Number System? 164. Write a program to print Fibonacci series i.e. 0 1 1 2 3 5 8…. 165. WAP in C++ to create a matrix of order 3 x 3 and find the sum of the diagonal elements . 166. Write a program to evaluate the factorial of a number using a function. 167. Differentiate between primary memory and secondary memory with examples. 168. Expand the following:

Page 125: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 125

169. i)CPU ii) ROM iii)MICR iv)UPS 170. Explain briefly the functions of ALU. 171. Differentiate object oriented programming and procedural programming with examples. 172. Distinguish between if and switch statement. 173. Find the 1’s and 2’s complement of 128. Convert

i.(AC.20)16= (?)2= (?)8 ii.(4A56)16= (?)10= (?)8 174. What stylistic guidelines would you follow for naming identifiers in your program? 175. Differentiate between actual and formal parameters with example? 176. What is constant argument? How is it useful in programming? 177. What will be the output of the following code fragment:

float interest ( float prnc,int time=2,float rate=0.10); int main( ) { cout<<interest(6100,1)<<” \n”; cout<<interest(5000,2)<<” \n”; cout<<interest(5000,3,0.12)<<” \n”; cout<<interest(5000)<<” \n”; } float interest(float prnc,int time, float rate) { return prnc*time*rate:}

178. How many ways can an array are passed to a function with examples 179. Write a program using function to swap the content of two variables. 180. Define function prototype?

Question Bank for Home Assignments XII CS

Dinesh Narwal

PGT – Comp. Sc.

K.V. Suranussi .

a) What do you mean by jump statements? Name some jump statements? Differentiate between break and continue statements.

b) What is the difference between Global Variable and Local Variable? c) What is the difference between Auto variables and Static variables? Give an example to illustrate the

same. d) Write the major differences between Object Oriented Programming and Procedural pogramming. e) What is the need of defining a MACRO using #define directive. Explain with suitable example. f) how #define different from const explain with suitable example? g) Write the names of the header files to which the following belong:

(i) frexp() (ii) isalnum() (iii) setw() (iv) randomized() (v)getc() (vi) fabs() (vii) exit( ) (viii) isalpha( ) (ix)gets( ) (x) strcmp()

h) Name the Header file(s) that shall be needed for successful compilation of the following C++ code void main() { int a[10]; for(int i=0;i<10;i++)

Page 126: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 126

{ cin>>a[i]; if(a[i]%2==0) a[i]=pow(a[i],3); else a[i]=sqrt(a[i]); if(a[i]>32767) exit(0); } getch(); }

i) Find out the output of the following:-

i. Write the output of the following program: int a =3; void demo(int &x, int y, int *z) { a+= x; y*=a; *z = a+y; cout<< a << “”<< x << “”<<y << “”<<z <<endl; } void main( ) { clrscr( ); int a = 2, b =5; demo(::a,a, &b); cout<< ::a<< “”<<a<< “”<< b<<endl; }

ii . Find the ouptput of the following :

void main( ) { char *Name= “IntRAneT”; for(int x =0; x<strlen(Name); x++) { if(islower(Name[x]) ) Name[x]=toupper(Name[x] ); else if(isupper(Name[x]) ) if (x%2 = =0) Name[x]=tolower(Name[x]); else Name[x]=Name[x-1]; } puts(Name); }

iii. Give the output of the following program:

void main() {

Page 127: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 127

int x [] = { 10, 20, 30, 40, 50}; int *p, **q, *t; p = x; t = x + 1; q = &t; cout << *p << “\t” << **q << “\t” << *t++;

iv. What will be the output of the program( Assume all necessary header files are included) : #include<iostream.h> void print (char * p ) { p = "pass"; cout<<"value is "<<p<<endl; } void main( ) { char * x = "Best of luck"; print(x); cout<<"new value is "<<x<<endl; }

v. What will be the output of the following program

void changestring(char text[], int &counter) { char *ptr = text; int length=strlen(text); for(;counter<length-2;counter+=2, ptr++) { *(ptr+counter) = tolower(*(ptr+counter)); } } void main() { clrscr(); int position = 0; char message[]= “POINTERS FUN”; changestring(message, position); cout<<message<< “@” <<position; }

vi. Find the output of the following program : #include<iostream.h>

void main() { int Numbers[] = {2,4,8,10}; int *ptr = Numbers; for (int C = 0; C<3; C++) { cout<< *ptr << “@”; ptr++; }

Page 128: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 128

cout<<endl; for(C = 0; C<4; C++) { (*ptr)*=2; --ptr; } for(C = 0; C<4; C++) cout<< Numbers [C]<< “#”; cout<<endl; }

vii. What is the output of the following program if all the necessary header files have been included:

char *Name= “a ProFile”; for(int x =0; x<strlen(Name); x++) { if(islower(Name[x]) ) Name[x]=toupper(Name[x] ); else if(isupper(Name[x]) ) if (x%2!=0) Name[x]=tolower(Name[x-1]); else Name[x]--; } cout<<Name<<endl;

viii. Find the output of the following program:

void main( ) { int U=10,V=20; for(int I=1;I<=2;I++) { cout<<”[1]”<<U++<<”&”<<V – 5 <<endl; cout<<”[2]”<<++V<<”&”<<U + 2 <<endl; } }

ix. Find the output of the following program:

void main( ) { randomize( ); char City[ ][10]={“DEL”,”CHN”,”KOL”,”BOM”,”BNG”}; int Fly; for(int I=0; I<3;I++) { Fly=random(2) + 1; cout<<City[Fly]<<”:”; } } Outputs:

Page 129: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 129

(i) DEL : CHN : KOL: (ii) CHN: KOL : CHN: (iii) KOL : BOM : BNG: (iv) KOL : CHN : KOL:

x. Find the output of the following program.

#include<iostream.h> void Withdef(int HisNum=30) { for(int I=20;I<=HisNum;I+=5) cout<<I<<”,”; cout<<endl; } void Control(int &MyNum) { MyNum+=10; Withdef(MyNum); } void main() { int YourNum=20; Control(YourNum); Withdef(); cout<<”Number=”<<YourNum<<endl;

xi. Find the output of the following program:

#include<iostream.h> void main( ) { long NUM=1234543; int F=0,S=0; do { int R=NUM % 10; if (R %2 != 0) F += R; else S += R; NUM / = 10; } while (NUM>0); cout<<F-S; }

xii. Give the output of the following program:

int g=20; void func(int &x,int y) { x=x-y; y=x*10; cout<<x<<’,’<<y<<’\n’; }

Page 130: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 130

void main( ) { int g=7; func(g,::g); cout<<g<<’,’<<::g<<’\n’; func(::g,g); cout<<g<<’,’<<::g<<’\n’; }

xiii. Find the output of the following program:

#include<iostream.h> struct Box { int Len, Bre, Hei; }; void Dimension(Box B) { cout << B.Len << “ X ” << B.Bre << “ X ”; cout << B.Hei << endl; } void main ( ) { Box B1 = {10, 20, 8}, B2, B3; ++B1.Hei; Dimension (B1); //first calling B3= B1; ++B3.Len; B3.Bre++; Dimension (B3); // second function calling B2= B3; B2.Hei += 5; B2.Len - = 2; Dimension (B2); // third function calling }

xiv. Find the output of the following program:

struct PLAY { int Score, Bonus; }; void Calculate(PLAY &P, int N=10) { P.Score++;P.Bonus+=N; } void main() { PLAY PL={10,15}; Calculate(PL,5); cout<<PL.Score<<”:”<<PL.Bonus<<endl; Calculate(PL); cout<<PL.Score<<”:”<<PL.Bonus<<endl; Calculate(PL,15); cout<<PL.Score<<”:”<<PL.Bonus<<endl; }

Page 131: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 131

xv. In the following C++ program , what will the maximum and minimum value of r generated with the help of random function.

#include<iostream.h> #include<stdlib.h> void main() { int r; randomize(); r=random(20)+random(2); cout<<r; }

xvi. Study the following program and select the possible output from it:

const int Max=3; void main( ) { randomize(); int Number; Number=50+random(Max); for(int P=Number; P >=50;P- -) cout<<P<<”#”; cout<<endl; } (i) 53#52#51#50# (ii) 50#51#52# (iii) 50#51# (iv) 51#50#

xvii. Find the output of the following program:

#include<iostream.h> void main() { int A[]={10,20,30,40,50}; int *p=A; while(*p<30) { if(*p%3!=0) *p = *p+2; else *p=*p+1; *p++; } for(int J=0;J<=4;J++) { cout<<A[J]<< "@"; if(J%3 == 0) cout<<endl; } cout<<A[4]*3<<endl;

Page 132: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 132

} xviii. Find the output of the following program:

#include <iostream.h> void Changethecontent(int Arr[ ], int Count) { for (int C=1;C<Count;C++) Arr[C-1]+=Arr[C]; } void main( ) { int A[ ]={3,4,5},B[ ]={10,20,30,40},C[ ]={900,1200}; Changethecontent(A,3); Changethecontent(B,4); Changethecontent(C,2); for (int L=0;L<3;L++) cout<<A[L]<<’#’; cout<<endl; for (L=0;L<4;L++) cout<<B[L] <<’#’; cout<<endl; for (L=0;L<2;L++) cout<<C[L] <<’#’; }

xix. In the following program, if the value of Guess entered by the user is 65, what will be the expected output(s) from the following options (i), (ii), (iii) and (iv)?

#include <iostream.h> #include <stdlib.h> void main() { int Guess; randomize(); cin>>Guess; for (int I=1;I<=4;I++) { New=Guess+random(I); cout<<(char)New; } } (i) ABBC (ii) ACBA (iii) BCDA (iv) CABD

xx. Find the output of the following program: #include <iostream.h>

void Secret(char Str[ ]) { for (int L=0;Str[L]!='\0';L++); for (int C=0;C<L/2;C++) if (Str[C]=='A' || Str[C]=='E') Str[C]='#'; else { char Temp=Str[C];

Page 133: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 133

Str[C]=Str[L-C-1]; Str[L-C-1]=Temp; } } void main() { char Message[ ]="ArabSagar"; Secret(Message); cout<<Message<<endl; }

xxi . Find the output of the following code.

#include<iostream.h> #include<conio.h> void main( ) { clrscr( ); int a =32; int *ptr = &a; char ch = 'D'; char *cho=&ch; *cho+=a; *ptr += ch; *ptr *= 3; ch=ch-30; cout<< a << "" <<--ch<<endl; }

xxii. Give the output of the following program. #include<iostream.h> void main( ) { char *p="Difficult"; char c; c=*p++; cout<<c<<c++<<++c<<"\n"; char d =c+1; cout<<d++<<"\n"; cout<<d<<"\n"; cout<<*p; }

j) Rewrite the following program after removing all the syntactical errors underlining each correction. #include<iostream.h>

#include<stdio.h> #include<string.h> class club { int memnum=23; char mname[30]; char mtype[ ]; public: void inclub( )

Page 134: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 134

{ cin>>memnum>>mname>>mtype; } void outclub( ) { cout<<memnum<<mname<<mtype<<endl; } }; void main( )

{ club p1,*p2; strcpy(p1.mname,”Sunayna”); p1.inclub( ); club p2=p1; outclub( ).p1; }

k) Rewrite the following program after removing the syntactical errors (s), if any. Underline each correction.

#include<iostream.h> void main( ) {int P[ ]={90,10,24,15}; Q, Number = 4; Q = 9; for[int I=Number-1;I>=0,I- -] switch(I) {case 0; case 3:cout>>P[I]*Q<<endl; break; case 1: case 2: cout<<P[I]+Q; } }

l) Rewrite the following program after removing the syntax error(s), if any. Underline each correction

#include<iostream.h> int main() { struct student { int. rno, mark; }stu; student stuA= (1001,49); student stuB= stuA; if (stuA!= stuB) stuA.mark= 55; else stuB.mark= 25; cout<<stuA.mark<<stub.mark; }

m) Rewrite the following program after removing all the error(s), if any: Underline each correction. include<iostream.h>

#define MAX 10 void main() { int AY[MAX]=(5,10,15,20,25); const int loop 5; for[int m=0; m<loop,m++] switch(m):

Page 135: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 135

{ case 0: case 4: cout<<AY[m]*5 case 2: case 1 cout>>AY[m]>>endl; } }

n) Rewrite the given snippet after removing the syntactical error(s), if any. Underline each correction

#include<iostream.h> void main() { char str[25]; str=”Preboard Exam 2009”; rev(&str); puts(str); } void rev(char *s) { char temp; for(int x=0,j=strlen(s)-1;x<strlen(s);x++,j--) { temp =s[x]; s[x]=s[j]; s[j]=temp; }

} o) Rewrite the following program after removing the syntactical errors (if any). Underline each correction.

#include [iostream.h] class PAYITNOW {

int Charge; PUBLIC: void Raise(){cin>>Charge;} void Show{cout<<Charge;} }; void main() {

PAYITNOW P; P.Raise(); Show();

}

p) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. #include <iostream.h> struct Pixels { int Color,Style;} void ShowPoint(Pixels P) { cout<<P.Color,P.Style<<endl;} void main() {

Page 136: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 136

Pixels Point1=(5,3); ShowPoint(Point1);

Pixels Point2=Point1; Color.Point1+=2;

ShowPoint(Point2); }

2. a. Explain with suitable examples how to create the object by calling the constructor implicitly and

explicitly. b. When will you make a function inline and why ? c. Observe the relationship between a parent class and a child class. If a base class and a derived class each

include a member function with the same name and arguments, which member function will be called by the object of the derived class if the scope operator is not used?

d. Why do you think function overloading must be a part of an object oriented program? e. What is copy constructor ? Give an example in C ++ to illustrate copy constructor . f. Differentiate between private and protected visibility modes in context of object oriented programming

using a suitable example illustrating each. g. Differentiate between constructor and destructor function in context of classes and objects using C++. h. Define Multilevel and Multiple inheritance in context of Object Oriented Programming. Give suitable

example to illustrate the same. i. What is this pointer ? Give an example to illustrate the use of it in C++. j. Illustrate the use of “ self referential structures” with the help of an example. k.Write the 0utput of the following program.

#include<iostream.h> class Counter { private: unsigned int count ; public: Counter ( ) { count=0; } void inc_Count( ) { count ++; } int get_Count( ) { return count ; } }; void main( ) { Counter C1, C2; cout<< “\n C1=”<<C1.get_Count( ); cout<< “\n C2=<< C2.get_Count( ); C1.inc_Count( ); C2.inc_Count( ); C2.inc_Count( ); cout<< “\nC1=”<< C1.get_Count( ); cout<< “\nc2=”<< C2. get_Count( ); }

l. Give the output of the following program : #include<iostream.h> #include<string.h> class per { char name [20];

Page 137: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 137

float age; public: per( char *s, float a) { strcpy( name, s); age=a ; } per & GR( per & x) { if( x.age>=age) return x; else return *this ; } void display( ) { cout<< “ Name:”<<name << “\n”; cout<< “ Age:”<<age<< “\n”; } }; void main( ) { per p1( “ Ramu”, 27.5), p2(“Raju”, 53), p3(“Kalu”,40); per p(‘\0’, 0); p=p1.GR(p3) ; p.display( ); p=p2.GR (p3) ; p.display( ); }

m. class cat

{ public: cat(int initialAge) { itsAge=initialAge; } ~cat() { } int getAge() { return itsAge; } void setAge(int Age) { itsAge=Age; } void Meow() { cout<< “Meow\n”; } private: int itsAge; }; void main() { cat Friskey(5); _____________ //Statement 1 cout<< “Friskey is a cat who is”; cout<<_______________ << “years old\n”; //Statement 2

Page 138: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 138

______________ //Statement 3 Friskey.setAge(7); cout<< “\n Now Friskey is”; cout<<______________ << “years old\n”; //Statement 4 } Observe the program given above carefully and fill the blanks marked as Statement 1, Statement 2, Statement 3 and Statement 4 to produce the following output: Meow Friskey is a cat who is 5 years old Meow Now Friskey is 7 years old

n. Answer the questions ( i) and ( ii) after going through the following class : class work { int workid ;char worktype ; public: ~ work( ) //function 1 { cout<< “un-allocated”<<endl ; } void status ( ) //function 2 { cout<<workid << “:”<<worktype<<endl; } work( ) //function 3 { workid =10; worktype = ‘T’ ; } work( work & w) //function 4 { worked=w.workid+12 ; worktype=w.worktype+1 ; } };

(I ) Which member function out of function 1 , function 2, function 3 and function 4 shown in the above definition of class work is called automatically , when the scope of an object gets over ? Is it known as constructor or destructor or overloaded function or copy constructor ? ( ii) work w; //statement 1 work y(w) ; //statement 2 which member function out of function 1, function 2, function 3 and function 4 shown in the above definition of class work will be called an execution of statement written as statement 2 ? What is this function specifically known as out of destructor or copy constructor or default constructor ?

o. Answer the questions (i) and (ii) after going through the following program:

#include <iostream.h> #include<stdio.h> #include<string.h> class shares { char company[20]; int no_of_shares; public: shares() / / function 1 { strcpy(company,” “); no_of_shares = 0; }

Page 139: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 139

shares(char factory[], int n) / / function 2 { strcpy(company,factory); no_of_shares = n; } void read_data() / / function 3 { gets(company); cin>>no_of_shares; } ~shares() / / function 4 { cout<<”Share market holiday”<<endl; } };

(i) Write the statements to call function 1 and function 2. (ii) What is the role of function 3 and function 4 in this class shares? p. Define a class TEST with the following specification:

Private members Testcode of type integer Description of type string NoCandidate of type integer A member function CALCNTR( ) to calculate and return the number of centers as ( NoCandidate / 100 + 1)

Public members constructor function to initialize Testcode as 12. A function IN_DATA( ) to accept values for Testcode, Description, NoCandidate And call function CALCNTR( )

A function OUT_DATA( ) to display all the data members q. Answer the questions ( i) and ( ii) after going through the following class:

class Maths { char chapter[20]; int marks; public: Maths( ) //Member Function 1 { strcpy(chapter , “Geometry”); marks=10; Cout<< “Chapter Initialised” ; } ~ Maths( ) //Member Function 2 { cout<< “ Chapter Over”; }

Page 140: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 140

}; ( i) Name the specific features of class shown by Member Function1 and Member Function 2 in the above example. ( ii) How would Member Function1 and Member Function 2 get executed ?

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

class CUSTOMER { int Cust_no; char Cust_Name[20]; protected:

void Register(); public: CUSTOMER(); void Status(); }; class SALESMAN { int Salesman_no; char Salesman_Name[20]; protected: float Salary; public: SALESMAN(); void Enter(); void Show(); }; class SHOP : private CUSTOMER , public SALESMAN { char Voucher_No[10]; char Sales_Date[8]; public: SHOP(); void Sales_Entry(); void Sales_Detail(); }; (i) Write the names of data members which are accessible from objects belonging to class

CUSTOMER. (ii) Write the names of all the member functions which 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?

s. Answer the questions (i) to (iv) based on the following code : class DRUG

{ char catg[10]; char DOF[10], comp[20]; public: DRUG( ); void endrug( );

Page 141: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 141

void showdrug( ); };

class TABLET : public DRUG {

protected: char tname[30],volabel[20]; public: TABLET( ); void entab( ); void showtab( ); }; class PAINKILLER : public TABLET {

int dose, usedays; char seffect[20]; public : void entpain( ); void showpain( ); };

i) How many bytes will be required by an object of TABLET? ii) Write names of all the member functions of class PAINKILLER. iii) Write names off all members accessible from object of class PAINKILLER. iv) Write names of all data members accessible from functions of class PAINKILLER.

t. Answer the questions(i) and (ii) after going through the following program :

class number { float M; char str[25]; public: number( ) //constructor 1 { M=0;

str=’\0’;} number(number &t); //constructor 2

};

i) Write c++ statement such that it invokes constructor 1. ii) Complete the definition for constructor 2.

u. Define a class SalesCounter with folloeing specifications:

Data members: Net_amt, Amount – Real values ClothType - string( 30), Pay_mode string (30) Member functions

o Constructor – to initialize the Amount as 0, ClothType as “Cotton”, Pay_mode as “Cash”, Net_amt as 0

o Calc_net () – to calculate discount and net_amt . The Company offers discount scheme on each purchase to the customer. The scheme is as follows

� For Cotton Purchase above 5000 and avail discount of 10%

Page 142: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 142

Purchase above 7500 and avail discount of 15% � For Silk

Purchase above 5000 and avail discount of 5% Purchase above 7500 and avail discount of 10%

� For Synthetic Purchase above 5000 and avail discount of 15% Purchase above 7500 and avail discount of 25% Now if the customer is paying by Cash an additional 2% discount will be given to them. If by Cheque no discount will be given, if payment mode is credit card 2.5% tax has to be paid by the customer on the total purchase.

o Purchase () – The Salesman will enter the detail of the purchasing made by the customer and will also enter the payment mode(CASH/CHEQUE/CREDIT CARD ) , and will invoke the Calc_net() to calculate the net amount

o Show() – The function will generate the bill to the customer along with the purchase details and the amount to be paid

v. Define a class Tour in C++ with the description given below :

Private Members:- Tcode of type string NoofAdults of type integer Noof Kids of type integer Kilometers of type integer TotalFare of type float

Public Members:

A constructor to assign initial values as follows : Tcode with the word “NULL” NoofAdults as 0 Noof Kids as 0 Kilometers as 0 TotalFare as 0

• A function AssignFare( ) which calculates and assigns the value of the data member TotalFare as follows For each Adult.

For each kid the above fare will be 50% of the Fare mentioned in the above table For example: If kilometers is 850 , NoofAdults=2 and NoofKids=3 Then TotalFare should be calculated as NoofAdults *300+NoofKids*150 ie 2*300+3*150=1050

• A function EnterTour( ) to input the values of the datamembers Tcode, NoofAdults, NoofKids and kilometers , and invoke the AssignFare( ) function.

• A function ShowTour( ) which displays the content of all the data members for a Tour. w. Define a class named DRAMA in C++ with the following description

Private members SHOW_NO integer NAME_OF_THE_DRAMA Array of characters (String) DAY integer (Total number of days the same drama is shown) DAILY_COLLECTION float TOTAL_COLLECTION float

Public Members input_data : A user defined function to read an object of ENTRY type print_data : A function to display the details of an object update_data: A function to update the total collection and daily collection once the day

Fare (Rs) For Kilometers

500 >=1000

300 <1000 & >=500

200 <500

Page 143: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 143

changes. Total collection will be incremented by daily collection and daily collection is made Zero

x. Define a class ELECTION in C++ with the following descriptions:

Private members:

Name 25 characters Age integer Address 30 characters Symbol 1 character Public members:

A function Newcontestant() which allows the user to enter Name, Age, Address and call the Assignsymbol( ) function to assign a symbol. A function Assignsymbol(), which assign the value for Symbol as per the following conditions:

Age Symbol <18 or >60 0 >=18 and <=40 1 >40 and <=60 2

A function Showelection() to display the content from all data members on screen. y. Answer the questions (i) to (iv) based on the following code:

class vehicle { int wheels; protected: int passenger; public: void inputdata(); void outputdata();

}; class heavyvehicle : public vehicle { int diesel_petrol; protected: int load; public: void readdata(int, int); void writedata(); }; class bus : private heavyvehicle { char make[20]; public: void fetchdata(); void displaydata(); }; i) Name the base class and derived class of bus class. ii) Name the data member(s) that can be accessed from the function readdata(). iii) How many bytes will be required by an object of vehicle and bus classes respectively? iv) Is the member function outputdata() accessible to the objects of the class heavyvehicle

z. Consider the following C++ declaration and answer the questions given below: class A

{void any();

Page 144: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 144

protected: int a,b; void proc();

public: A( ); void get( ); void put( ); }; class B : protected A {int c,d; protected: int e,f; void get2( ); public: B( ); void put2( ); }; class C : private B {int p; protected: int q; void get3( ); public: void show3( ); }; (i)Name all the members which are accessible by the objects of class C. (ii)How many bytes does as object belonging to class B require? (iii)Which class constructor will be called first at the time of declaration of an object of class C (iv) Is the member function proc() which can be accessed form the objects of class C

aa. Answer the questions (i) to (iv) based on the following code class engineering { private: char streamcode[5]; protected: int seats; void allot(); public: engineering(); void streamread(); void streamwrite(); }; class dept : protected engineering { char deptname[20]; int strength; public: dept(); void deptread();

Page 145: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 145

void deptwrite(); }; class course: public dept { char coursename[20]; float fees; public: course(); void courseread(); void coursewrite();

}; (i) Which type of inheritance is shown in the above example? (ii) How many bytes will be required by an object of the class dept and course? (iii) Write the name of all the data members accessible from member functions of the class course. (iv) Write the members which are accessible from the object of the class dept.

3. a. Write a function in C++ to combine the contents of two equi-sized arrays A and B by computing their

corresponding elements with the formula 2*A[i]+3*B[i]; where value i varies from 0 to N-1 and transfer the resultant content in the third same sized array.

b. 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.

c. Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real

numbers. d. Write a function in C++ to find sum of rows from a two dimensional array. e. Evaluate the following postfix notation of expression:

True, False, AND, True, True, NOT, OR, AND f. A 2-d array defined as A[4..7, -1..3] requires 2 words of storage space for each element stored in row major

order. Calculate the address of A[7,0] and base address if the location of A[6,2] as 126. g. 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.

h. Write a function in c++ to find and display the sum of each row and each column of 2 dimensional array.

Use the array and its size as parameters with int as the data type of the array. i. 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; };

Page 146: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 146

j. Write a c++ function to shift all the negative numbers to left and positive number in the right side. k. Define a function SWPCOL() in C++ to swap ( interchange) the first column elements with the last column

elements, for a two dimensional array passed as the argument of the function. Example : if the two dimensional array contains

2 1 4 9 1 3 7 7 5 8 6 3 7 2 1 2

After swapping of the content of 1st and last column, it should be 9 1 4 2 7 3 7 1 3 8 6 5 2 2 1 7

l. Write a function in C++ to insert an element in a dynamically allocated Queue containing nodes of the

following given structure: struct Book { char BName[20]; Book *Next; };

m. 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; };

n. An array M[-3…18][-8….37] is stored in the memory along the column with each of its elements occupying 8 bytes. Find out the base address and the address of an element M[2][5], if the element M[5][10] is stored at address 4000.

o. Write a function to insert and delete a set of integer values in a circular queue and display them. p. Evaluate the following postfix notation of expression showing stack contents after execution of each

operation. 4, 10, 5, +, *, 15, 3, /, - q. Given two dimensional array A[10][20], base address of A being 100 and width of each element is 4

bytes, find the location of A[8][15] when the array is stored as a) column wise b)ow wise. r. Write a user defined function in C++ to insert an element from a dynamically allocated Queue where each

node contains the long integer (schoolno) as data. Assume the following definition of SCHOOL for the same.

struct SCHOOL {

long scno; SCHOOL * link;

};

s. Convert the expression (TRUE && ! FALSE)|| (FALSE && TRUE) to postfix expression. Show the contents of the stack at every step.

t. Given the following class:

char *msg[]={“OVER FLOW”,”UNDER FLOW”}; class stack

Page 147: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 147

{ int top; stk[5]; void err_rep(int e_num) {cout<<msg[e_num];} // report error message

public: void init() {top=0;} void push(int); // put the new value in to stk void pop(); // get the top valued from stk }; Define pop outside the stack. In your definition take care of underflow condition. Function pop has to invoke err_rep to report over flow. u. Convert A+(B*C-(D/E^F)*G)*H into postfix form showing stack status after every step. v. Write a user defined function in C++ to display those elements of 2 dimensional array T[4][4] which are

divisible by 100. Assume the content of the array is already present and the function prototype as follows void Display(int T[4][4]);

w. Evaluate the following postfix expression using stack and show the contents after execution of each

operations 470,5,4,^,25,/,6,*,+,81,- x. Write a C++ function RevDup(int [], int) to remove the duplicate occurrence of the value Present in an

integer array, passed to the function as a parameter. for e.g. If array initially is X[] = { 1,1,1,7,5,2,2,6} After removing duplicate values the array will be X {} = {1, 7, 5, 2, 6}

4. a. Observe the program segment given below carefully and answer the question that follows

class school { private : char name[25]; int numstu; public: void inschool( ); void outschool( ); int retnumstu( ) { return numstu; } }; void modify(school A) { fstream INOUT; INOUT.open(“school.dat”,ios::binary|ios::in|ios::ate); school B; int recread=0, found=0; while(!found && INOUT.read((char*)&B,sizeof(B)) { recread++; if(A.retnumstu( )= = B.retnumstu( )) {

__________________//missing statement

INOUT.write((char*)&A,sizeof(A)); Found=1;

Page 148: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 148

} else INOUT.write((char*)&B,sizeof(B)); } if(!found) cout<<”\nRecord for modification does not exist”; INOUT.close( ); }

If the function modify( ) is supposed to modify a record in file school.dat with the values of school A passed to its argument, write the appropriate statement for missing statement using seekp( ) or seekg( ), whichever needed, in the above code that would write the modified record at its proper place. b. Observe the program segment given below carefully and fill the blanks marked as Statement 1 and

Statement 2 using seekp() and seekg() functions for performing the required task. #include <fstream.h> class Item {

int Ino;char Item[20]; public:

//Function to search and display the content from a particular //record number 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(); }

c. Write a function in C++ to add 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:

Page 149: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 149

void Enter() { cin>>Rno;gets(Name); } void Display(){cout<<Rno<<Name<<endl;} };

d.Write a function in C++ to read and display the detail of all the members whose membership type is ‘L’ or

‘M’ from a binary file “CLUB.DAT”. Assuming the binary file “CLUB.DAT” is containing objects of class CLUB, which is defined as follows:

class CLUB { int Mno. char Mname[20]; char Type; //Member Type: L Life Member M Monthly member G Guest public: void Register( ); void Display( ); char whatType( ) { return type; } };

e. Write a function in c++ to read and display the records of computers that cost more than Rs. 20000 from the binary file “COMP.DAT”, assuming that the binary file is containing the objects of the following class : class COMPUTER

{ int srno; char model[25]; float price; public: float Retpr( ) { return price; } void Enter( ){ cin>>srno>>price; gets(model); } void Display( ){ cout<<rno<<Name<<price<<endl;} };

f. Write a function in c++ to count the number of capital vowels present in a text file FILE.TXT g.Write a function in C++ to count the number of lines present in a text file “STORY.TXT”.

h.Write a function in C++ to search for a BookNo from a binary file “BOOK.DAT”, assuming the binary

file is containing the objects of the following class. class BOOK { int Bno; char Title[20]; public: int RBno(){return Bno;} void Enter(){cin>>Bno;gets(Title);} void Display(){cout<<Bno<<Title<<endl;} }; i. Write a function RevText() to read a text file “ Input.txt “ and Print each word in reverser order .

Example : If value in text file is : INDIA IS MY COUNTRY

Output will be: AIDNI SI YM YRTNUOC

Page 150: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 150

j. Following program intends to display a text file with each word in new line.

#include <fstream.h> void main() { ifstream fin(“Text.txt”); char word[50]; while(___________) { ____________________ cout<<word<<endl; } ___________________ }

Complete the above program by providing missing functionality.

k.Assuming the class COLLEGE, write functions in C++ to perform the following. (i)Write the objects of COLLEGE to a binary file. (ii)Reads the objects of COLLEGE from binary file and display them on the screen.

class COLLEGE {

char name[20]; char place[20]; public: void getdata() {

cin>>name; cin>>place; }

void display() { cout<<name; cout<<place; }

}; l. Given the binary file ITEM.DAT, containing the records of the following structure:

struct item { int item_no; char item_name[20]; int stock; };

Implement the function AddStock( item x, int n), which updates a record by adding the existing stock for the item x in the file.

5.

a. What do you understand by the terms Candidate key and Cardinality of a relation? b. What is the CHAR and VARCHAR data types . c. What are the rules for SQL commands d. What is the difference between column constraint and the table constraint .

Page 151: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 151

e. What do you understand by aggregate function f. A view , VU1 is created as Select * from Tab1 . Now two new columns are added into tables tab1 , will

the view VU1 be automatically changed to have all the columns ? g. Describe any three clauses, which can be used with select statements . h. Explain the IN operator in SQL. Specifying its syntax and usage. i. What is the use of a sub query ? Which query gets executed first , the parent query or the sub query j. How do we restrict duplicate rows in SQL select query ? Give example . k. What are candidate keys in a table ? Give a suitable example of candidate keys in a table. l. What is the purpose of the key in a table ? Give an example of a key in a table . m. Differentiate between candidate key and primary key in context of RDBMS . n.What is an alternate key in RDBMS. o.Explain Cartesian product of two relations . p.What do you mean by domain ? q.What is relation ? What is the difference between a tuple and an attribute ? r. Differentiate between DROP TABLE and DROP VIEW . s. Define DBMS ? List some advantages of the DBMS . t. Write the role of DBA . u.Define view ? What are its advantages ? v. Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements ( i) to

(iv) and give outputs for SQL quires (v) to (viii)

GARMENT

GCODE DESCRIPTION PRICE FCODE READYDATE

10023 PENCIL SKIRT 1150 F03 19-DEC-08

1001 FORMAL SHIRT 1250 F01 12-JAN-08

10012 INFORMAL SHIRT 1550 F02 06-JUN-08

10024 BABY TOP 750 F03 07-APR-07

10090 TULIP SKIRT 850 F02 31-MAR-07

10019 EVENING GOWN 850 F03 06-JUN-08

10009 INFORMAL PANT 1500 F02 20-OCT-08

10007 FORMAL PANT 1350 F01 09-MAR-08

10020 FROCK 850 F04 09-SEP-07

10089 SLACKS 750 F03 31-OCT-08

FABRIC

i.To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE. ii.To display the details of all the GARMENTs which have READYDATE in between 08-DEC-07 and 16-

JUN-08 ( inclusive of both the dates).

iii.To display the average PRICE of all the GARMENTS which are made up of FABRIC with FCODE as F03.

iv.To display FABRIC wise highest and lowest price of GARMENTS from GARMENT table.( Display FCODE of each GARMENT along with highest and lowest price).

FCODE TYPE

F04 POLYSTER

F02 COTTON

F03 SILK

F01 TERELENE

Page 152: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 152

v.Select sum ( price) from GARMENT where FCODE = ‘F01’; vi.Select DESCRIPTION , TYPE FROM GARMENT, FABRIC where GARMENT .FCODE= FABRIC.

FCODE and GARMENT. PRICE >=1260; vii.Select Max( FCODE) from FABRIC ;

viii.Select Count( DISTINCT Price) from GARMENT ;

w. 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 earliar than 01/01/2004 in

ascending order of ParticipantNum. 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;

x. Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements ( a) to (f) and give outputs for SQL quires (v) to (viii)

PRODUCT

P_ID Product Name Manufacturer Price

TP01 Talcom Powder LAK 40

FW05 Face Wash ABC 45

BS01 Bath Soap ABC 55

SH06 Shampoo XYZ 120

FW12 Face Wash XYZ 95

CLIENT

C_ID ClientName City P_ID

01 Cosmetic Shop Delhi FW05

Page 153: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 153

06 Total Health Mumbai BS01

12 Live Life Delhi SH06

15 Preety Woman Delhi FW12

16 Dreams Banglore TP01

i. To display the details of those Clients whose city is Delhi ii. To display the details of products whose price is in the range of 50 to 100

iii. To display the ClientName, City from table Client , ProductName and Price from table product, with their corresponding matching P_Id.

iv. To increase the price of all products by 10. v. Select Distinct city from CLIENT ;

vi. Select Manufacturer, Max(price) , Min(price) , count(*) from product Group by Manufacturer ; vii. Select Clientname, ManufacturerName from PRODUCT, CLIENT Where CLIENT.Prod_Id=

PRODUCT.P_Id ; viii. Select Productname , price*4 from Product ;

y. Consider the following tables

BOOKs

Book_Id Book_Name Author_Name Publishers Price Type Qty

C001 FAST COOK LATA KAPOOR EPB 355 COOKERY 5

F001 THE TEARS WILLIM HOPKINS FIRST PUBL.

650 FICTION 20

T001 MY FIRST C++ BRAIN & BROOK EPB 350 TEXT 10

T002 C++ BRAINWORKS A.W. ROSSAINE TDH 350 TEXT 15

F002 THUNDERBOLTS ANNA ROBERTS FIRST PUBL.

750 FICTION 50

ISSUED

BOOK_ID QUANTITY_ISSUED

T001 4

C001 5

F001 2

� To show Book name, Author name and price of books of First Publ. publishers. � To list the names from books of text type. � To display the names and price from books in ascending order of their price. � To increase the price of all books of EPB publishers by 50. � To insert a new row in the table issued having the following data :- F001, 1. � To display the book_Id , Book_Name, and Quantity_Issued for all books which have been issued � Select Count( *) from Books � Select Max( Price) from Books where Quanitity >=15 � Select Book_Name, Author_Name from Books where publishers = “EPB”; � Select Count( Distinct Publishers) from Books where price>=400 ;

z. Write SQL commands for( a) to ( f) and write the output for (g) on the basis of table HOSPITAL HOSPITAL

No Name Age Department DateofAdm Charges Sex

1 Arpit 63 Surgery 21/01/98 300 M

2 Zarina 22 ENT 12/12/97 250 F

3 Kareem 32 Orthopedic 19/02/98 200 M

4 Arun 12 Surgery 11/01/98 300 M

Page 154: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 154

5 Zubin 30 ENT 12/01/98 250 M

6 Ketaki 16 ENT 24/02/98 250 F

7 Ankita 29 Cardiology 20/02/98 800 F

8 Zareen 45 Gynecology 22/02/98 300 F

9 Kush 19 Cardiology 13/01/98 800 M

10 Shilpa 23 Nuclear Medicine 21/02/98 400 F

� To select all the information of patients of cardiology department. � To list the names of female patients who are in ENT department. � To list names of all patients with their date of admission in ascending order. � To display patients Name, Charges, Age for only female patients. � To count the number of patients with age <30. � To insert a new row in the HOSPITAL table with the following data : 11, “Aftab”, 24, “Surgery”, {25/02/98}, 300, “M” � Give the output of following SQL statements :

(i) Select COUNT(DISTINCT charges) from HOSPITAL ; (ii) Select MIN( Age) from HOSPITAL where Sex= ‘F’ (iii) Select SUM( Charges) from HOSPITAL where Department = ‘ENT’; (iv) Select AVG(charges) from HOSPITAL where DateofAdm < {12/08/98 }

aa. Write SQL commands for( a) to ( f) and write the output for (g) on the basis of table HOSPITAL

TEACHER

No. Name Age Department Date of Join Salary Sex

1 Jugal 34 Computer 10/01/97 12000 M

2 Sharmila 31 History 24/03/98 20000 F

3 Sandeep 32 Maths 12/12/96 30000 M

4 Sangeeta 35 History 01/07/99 40000 F

5 Rakesh 42 Maths 05/09/97 25000 M

6 Shyam 50 History 27/06/98 30000 M

7 Shiv Om 44 Computer 25/02/97 21000 M

8 Shalakha 33 Maths 31/07/97 20000 F

i. To show all information about the teacher of history department ii. To list the names of female teachers who are in hindi department

iii. To list names of all teachers with their date of joining in ascending order. iv. To display teacher’s Name, salary, Age for male teacher only. v. To count the number of teachers with age <23

vi. To insert a new row in the Teacher table with the following data : 9, “Raja”, 26, “ computer” , { 13/05/95} , 2300, “ M” vii. Give the output of following SQL statements :

� Select Count( distinct department ) from TEACHER � Select MAX( Age) from TEACHER where Sex= “F” � Select AVG( Salary) from TEACHER where Date of join {12/07/96 } ; � Select Sum(Salary) from TEACHER where date of join < {12/07/96};

bb. Given the following Lab relation : Write SQL command for questions ( a) to (f) LAB

No Item Name CostPerItem Quantity DateofPurchases Warranty Operational

1 Computer 60000 9 21/05/96 2 7

2 Printer 15000 3 21/05/97 4 2

3 Scanner 18000 1 29/08/98 3 1

4 Camera 21000 2 13/06/96 1 2

Page 155: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 155

5 Hub 8000 1 31/10/99 2 1

6 UPS 5000 5 21/05/96 1 4

7 Plotter 25000 2 11/1/2000 2 2

i.To select the ItemName purchased after 31/10/97 ii.To list the ItemName, which are within the warranty period till present date.

iii.To list the Itemname in ascending order of the date of purchase where quantity is more than 3. iv.To display Itemname , CostPerItem, and Quantity whose Warrenty is over. v.To count the number of Items whose cost is more than 10000

vi.To insert a new record in the lab table with the following data : 1. 8, “VCR “, 10000, 2 {2/2/2000},1,2

vii.Give the output of the following SQL commands :

• Select MIN(Distinct Quantity) from Lab

• Select MIN( Warranty) from Lab where Quantity =2

• Select SUM(CostPerItem) from LAB where quantity >2

• Select AVG( CostPerItem) From LAB where dateofPurchase < {1/1/99}.

cc. Consider the following tables EMPLOYEE and DESIG. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)

EMPLOYEE

W_ID FIRSTNAME LASTNAME CITY

102 SAM TONES PARIS

105 SARAH ACKERMAN NEW YORK

144 MANILA SENGUPTA NEW DELHI

210 GEORGE SMITH HOWARD

255 MARY JONES HUSTON

300 ROBERT SAMUEL WASHINGTON

335 HENRY WILLIAMS BOSTON

400 RONNY LEE NEW YORK

451 PAT THOMPSON PARIS

DESIG

W_ID SALARY BENEFITS DESIGNATION

102 75000 15000 MANAGER

105 85000 25000 DIRECTOR

144 70000 15000 MANAGER

210 75000 12500 MANAGER

255 50000 12000 CLERK

300 45000 10000 CLERK

335 40000 10000 CLERK

400 32000 7500 SALESMAN

451 28000 7500 SALESMAN

i. Display FirstName and City of Employee having salary between 50,000 and 90,000

ii. Display details of Employees who are from “PARIS” city. iii. Increase the benefits of employee having W_ID = 210 by 500. iv. Count number of employees whose name starts from character ‘S’. v. Select MAX(salary) from desig;

vi. Select FirstName from employee, design where designation = ‘MANAGER’ AND employee.W_ID = desig.W_ID;

vii. Select COUNT (DISTINCT designation) from desig; viii. Select designation, SUM(salary) from desig

Page 156: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 156

Group by designation Having count (*) > 2;

6. a) State and verify Demorgan’s Laws. b) State and Verify idempotent law in Boolean algebra. c) State and algebraically verify Absorbtion Laws. d) Write the equivalent POS expression of following SOP for F (x,y,z)= ∑ (0,2,4,6) e) Draw the Logical circuit of the following expression with the help of NAND gate only x+yz f) Write the equivalent Boolean Expression for the following Logic Circuit

g) Write the SOP form of a Boolean function G, which is represented in a truth table as follows:

P Q R G

0 0 0 0

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

h) Write the equivalent Boolean Expression for the following Logic Circuit

(c) 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

P Q

U

V

Page 157: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 157

1 1 1 1

(d) Interpret the following logical circuit as Boolean expression

(e) Design (A+B).(C+D) using NAND Gate (f) Simplify the following Boolean Expression using Boolean postulates and laws of Boolean Algebra.

Z=(a’+a).b’.c+a.b’.c’+a.b.(c+c’) (g) Prove x’.y’+y.z = x’yz+x’yz’+xyz+x’yz algebraically. (h) Prove that (a’+b’)(a’+b)(a+b’)=a’b’. (i) Reduce the following Boolean expression using K-Map:

F(A,B,C,D)= ∏ (0,1,2,4,5,8,9,10,11) (j) Reduce the following Boolean expression using K – Map

F (A, B, C, D) =S (0,2,3,4,6,7,8,10,12) (k) Reduce the following Boolean Expression using K-Map:

F(A,B,C,D)= ∏(0,1,2,4,5,6,8,10) (l) Obtain a simplified form for a boolean expression

F(U,V,W,Z)= ∏ (0,1,3,5,6,7,10,14,15) (m) Reduce the following boolean expression using K-Map

F(A,B,C,D) = ∏ (5,6,7,8,9,12,13,14,15) (n) Obtain the simplified form of a Boolean expression using K-Map.

F(a,b,c,d)=∑(0,1,2,3,4,7,11,12,14) (o) Reduce the following Boolean Expression using K-Map:

F(A,B,C,D)=Σ(0,1,2,4,5,6,8,10) 7.

i. What is the significance of cyberlaw? ii. Expand the following terminologies :

i) PSTN ii) I MAP iii) CDMA iv) GSM v)HTML vi ) XML iii. Differentiate between GSM and CDMA ? iv. What is baud? v. Define the term Bandwidth. Give unit of Bandwidth

vi. Define the term firewall. vii. What is the importance of URL in networking?

viii. Which network is easy to expand? ix. In which network there is no server? x. What is the difference between repeater and bridge?

xi. What are virus? How it spread? xii. What is Web Scripting?

xiii. What is the significance of ARPANET in the network? xiv. Give two major reasons to have network security. xv. What is the purpose of using a Web Browser? Name any one commonly used Web Browser.

xvi. Knowledge Supplement Organisation has set up its new center at Mangalore for its office and web based activities. It has 4 blocks of buildings as shown in the diagram below:

Page 158: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 158

Center to center distances between various blocks

Black A to Block B 50 m

Block B to Block C 150 m

Block C to Block D 25 m

Block A to Block D 170 m

Block B to Block D 125 m

Block A to Block C 90 m

Number of Computers

Black A 25

Block B 50

Block C 125

Block D 10

e1) Suggest a cable layout of connections between the blocks. e2) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable

reason. e3) Suggest the placement of the following devices with justification

(i) Repeater (ii) Hub/Switch

e4) The organization is planning to link its front office situated in the city in a hilly region where cable connection is not feasible, suggest an economic way to connect it with reasonably high speed?

xvii. SUNBEAM INSTITUTE OF TECHNOLOGY is located in Varanasi and is planning to go in for networking of four wings for better interaction. The details are as shown below :

StudentWing

AdminWing

AdmissionWing

Hoste lWing

The distance between various wings are :

Block A Block C

Block B

Block D

Page 159: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 159

Student to Admin 265m

Student to Admission 495m

Student to Hostel 525m

Admission to Admin 200m

Admission to Hostel 195m

Admin to Hostel 325m

Number of computers are :

Student Wing 312

Admission Wing 156

Admin Wing 26

Hostel Wing 125

i. Suggest the type of networking (LAN, MAN, WAN) for connecting Hostel Wing to Admin Wing.

Justify your answer. ii. Suggest the most suitable place to house the server, with a suitable reason. iii. Suggest the placement of the following devices with reasons: i) Repeater ii) Switch iv. The Institute is planning to link its another branch in Mumbai. Suggest a way to connect it with

reasonably high speed, cost is not the factor. Justify your answer.

xviii. Global Village Enterprises has following four buildings in Hyderabad city.

Computers in each building are networked but buildings are not networked so far. The company has now decided to connect building also.

(a) Suggest a cable layout for these buildings. (b) In each of the buildings, the management wants that each LAN segment gets a dedicated bandwidth i.e bandwidth must not be shared. How can this be achieved?

(c) The company also wants to make available shared Internet access for each of the buildings. How can this be achieved? (d) The company wants to link its head office in GV1 building to its another office in Japan. (i) Which type of transmission medium is appropriate for such a link? (ii) What type of network would this connection result into?

Page 160: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 160

Question Bank for Home Assignments XI IP

Manoj Kumar

PGT – Comp. Sc.

K.V. Leh Q.1.What is the function of main memory? What are the measuring units of memory? Q.2.Briefly explain (i)MICR (ii) OCR (iii) OMR (iv) VDU Q.(3)What is a port? Name some port types briefly. Q.(4)Name two ports that allow wireless connection of devices. Q.(5)What are the differences between hardware, software and firmware ? Q.(6)Give an example of mark -sensing. When is mark sensing is useful, when it is difficult to use? Q.(7)What is an impact printer? Give one example. Q.(8)What is a non impact printer? Give one example. Q.(9)What are language processors? Explain its types. Q.(10)Differentiate between a compiler and interpreter. Q.(11)Why is disk fragmentor useful? Q.(12)How is backup utility useful? Is it necessary to take back-up of data? Q.(13)What is operating system? What is its function? Q.(14)Write short notes on the following: (a)Java Byte Code (ii)JVM (iii)RAD (iv)GUI Q.(15)How is ordinary compilation process different from Java compilation? Q.(16)What is the similarity and difference between option buttons and check boxes? Q.(17)What are containers or container controls? Give some examples. Q.(18)What do you understand by a message and an event? Q.(19)What is type conversion ?Explain its both types. Q.(20)Distinguish between Unary, binary and ternary operator. Give examples of Java operators for each one of them. Q.(21)Assuming that abs starts with the value 25,what will the following code fragment print out? System.out.println(abs--); System.out.println(++abs); Q.(22)Given the following code fragment: i=2; start: System.out.println(i); i+=2; if (i<51) goto start; System.out.println(“Thank you”); Rewrite the above code using a while loop. Q.(23)Rewrite following code using while loop int sum=0; for (int i=1;i<=5;++i) { sum=sum+c; } Q.(24)Write one limitation and one advantage of a switch statement. Q.(25)What is the difference between a while and do-while loop? Q.(26)Differentiate between a container and a component. Q.(27)What are various categories of Swing controls? Give examples for each of them. Q.(28)Discuss briefly about JFC and its constituent APIs. Q.(29)Discuss briefly about different layout managers offered by Swing API. Q.(30)What are top level containers? What is their significance? Q.(31)Write some common properties of Label.

Page 161: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 161

Q.(32)What is the usage of icon property of label? Q.(33)Can you display text along with an image in a label? How? Q.(34)Which property would you set for setting the password character as ‘$’? Q.(35)Which method returns the password entered in a password field? Q.(36)What is the difference between a check box and a radio button? Q.(37)What is focus? What are the focus related events? Q.(38)If the miniumSize property of a frame is [0,0] what would happen? Q.(39)What is the difference between a text field and a text area? Q.(40)How can you display multiple lines of un-editable text? Q.(41)What is the significance of following properties of a text area? (a) lineWrap (ii) wrapStyleWord Q.(42)What are events? What major events are associated with the following? (i)Text Field (ii) Password Field (iii) Check Box (iv)Radio Button (v) Scroll Bar (vi) Slider Q.(43)What are the similarities and differences between a scrollbar and a slider? Q.(44)Name the Swing API classes that create (i) a list (ii) a combo box. Q.(45) Which method would you use to determine which index has been selected in a list? Q.(46)Compare and contrast a list box and a combo box. Q.(47)Write code to obtain list of selected items from a list namely List1. Q.(48)Write code to add item “Ajmer” to list CityList Q.(49)Write code remove item at 3rd index in list CityList. Q.(50)Why does a combo box fire Item event twice ? Q.(51)Write code to generate random numbers in the rage 20…50. Q.(52)What is this keyword? What is its significance? Q.(53)Write a short note on significance of constructors in OOP classes. Q.(54)Differentiate between Call by Value and Call by Reference. Q.(55)Write advantages of using methods in programs? Q.(56)What is a constructor ?Explain parameterized and non –parameterized constructors. Q.(57)What are the differences between constructors and methods? Q.(58)Explain the difference between a formal parameter and an argument. Q.(59)Write a method that takes a number as argument and displays the sum of all the digits in the number. For example if the argument passed is 354, the procedure should display 12(i.e. 3+5+4).Implement the method through a GUI application that obtains a number in a text field, compute the sum of its digits and displays in a label. Q.(60)Write a program to find the area of a circle using method. Q.(61)Write a program in Java to obtain principal amount and time and then calculate simple interest as per the following specifications: Principal amount Rate of interest >=100000 8.5% Between 100000 -500000 6% <50,000 5% Q.(62)Write a program that will ask the user to enter integer numbers a and b. If a is greater than b, print square of both the numbers otherwise print cube of both the numbers. Q.(63)Write a program which allows user to enter a century year and find out if it is a leap year or not. [A leap year is one which is either (divisible by 4 and not by 100) or (divisible by 400)] Q.(64)Write a program that will allow user to enter three numbers and print largest of these numbers. Q.(65)What is debugging? Q.(66)What is testing? Q.(67)What is error or bug? What are main errors types? Which types are most dangerous and why? Q.(68)What do you mean by Syntax errors and Semantics errors? Q.(69)Why are logical errors harder to locate?

Page 162: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 162

Q.(70)Mention the steps you would follow while writing a program. Q.(71)What are various levels of data abstraction in database system? Q.(72)Define the following: (i) Primary key (ii) candidate key (iii) Alternate key (iv) foreign key Q.(73)Define the following terms: (i)Tuple (ii)Degree (iii)Cardinality (iv)Attribute (v)Relation Q.(74) What is SQL? What are different categories of commands available in SQL? Q.(75)Differentiate between DDL and DML commands. Q.(76)What is the use of SQL in mySQL? Q.(77)Write SQL commands for the following on the basis of given table STUDENT Table:STUDENT

StudentNo. Class Name GAME Grade1 SUPW Grade2

10 7 Sameer Cricket B Photography A

11 8 Sujit Tennis A Gardening C

12 7 Kamal Swimming B Photography B

13 7 Veena Tennis C Cooking A

14 9 Archana Basket Ball A Literature A

15 10 Arpit Cricket A Gardening C

(i) Display the names of the students who are getting a grade ‘C’ in either GAME or SUPW. (ii) Display the different games offered in the school. (iii)Display the SUPW taken up by the students, whose name starts with ‘A’. (iv)Display all information of student with their in descending order. (v) List the names of those students who are in class 7 sorted by Grade1. Q.(78)What is a function? Explain single row function and multiple row function with examples. Q.(79)Create table Employee with the following structure Name of Column Type Size ID NUMBER 4 First_Name VARCHAR 30 Last_Name VARCHAR 30 User_ID VARCHAR 10 Salary NUMBER 9,2 Pincode NUMBER 10 Ensure the following specification in created table.

(i) ID should be declared as Primary key. (ii) User_ID should be unique. (iii) Salary must be greater than 5000. (iv) First_Name & Last_Name must not reamin blank.

Q.(80)Write a mySQL command to Drop the Primary key of the Employee table. Q.(81)Write a mySQL command to Drop the Last_Name column of the Employee table. Q.(82)Write a mySQL command to add one column Email of data type VARCHAR and size 30 to the table employee. Q.(83)Change the data type of column pincode to VARCHAR(10) in the table Employee. Q.(84)What is a constraint ? Name some constraint that you can apply to enhance database integrity. Q.(85)What is UNIQUE constraint? How is PRIMARY Key constraint different from UNIQUE constraint? Q.(86)How has e-governance benefited the common man? Q.(87)How is e-learning proved useful for a trainer?

Page 163: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 163

Q.(88)Define e-governance. Q.(89)Define e-business. Q.(90)Define e-learning. Q.(91)Why do you think e-learning courses have high dropout rate? Q.(92)Write a program in which user is asked to enter a number and then print its multiplication table. Q.(93)Write a program to find the roots of a quadratic equation. Q.(94)Write a program to find bigger number from given two numbers by using a method. Q.(95)Write a program using method to compute sum of two numbers and then display it. Q.(96)Write a program using method to find the area of a circle. Q.(97)Create a program to find the factorial of a number using Function. Q.(98)Create a program using method that allow the user to enter a positive integer and determine whether it is even or odd. Q.(99)Write a loop to print first 15 natural numbers and their sum. Q.(100)What will be the output of the following code: If(aNumber>=0) If(aNumber = =0) System.out.println(“First string” ); Else System.out.println(“Second String”); System.out.println(“Third String”); Q.(101)What do you think is most outstanding feature of e-learing. Q.(102)What benefits does an e-business offer to the customers?

Question Bank for Home Assignments XII IP

SN Meena

PGT – Comp. Sc.

K.V. Manauri Allahbad

CHAPTER-1: Computer Networking

Q.1. What is difference between MAN and WAN? Q.2 . Write the two advantage and two disadvantage of bus topology in network? Q.3. What is the role of Modem in electronic communications? Q.4. Define network what is need? Q.5 What do you understand Domain Name Resolution ? CHAPTER-2: Open source concepts

Q.1 Expand the following terms:

(1) OSS (2) SDLC (3) GNU Q.2 Write shorts note on: (1) Linux (2) Mozilla (3) Apache (4) PHP Q.3 What is Unicode? What is ISCII ? Q.4 What are open source based software ? Q.5 What is ODF ? Discuss Brifly? Q.6 Differentiate the following terms: (1) Freeware and Shareware (2) Freeware and Free Software CHAPTER-3: Java GUI Programming(Revision tour-I)

Q.1 What are RAD tools in java ? Q.2 Is java case sensitive? What is meant by term ‘case sensitive’? Q.3 What is wrong with the following while loop ?

Page 164: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 164

int ctr=1; While (ctr<100) { System.out.println(ctr); Ctr….; } Q.4 Write code to display the following: (1) 1 (2) * 2 2 * * 3 3 3 * * * 4 4 4 4 * * * * Q. 5 Find out the output of the following given code: Int I, j, k; for(i=0;i<=4;++i) { for( k=1,j=I;k<=I;k++,j+=2){ System.out.println(“ “+j); System.out.println(); } CHAPTER-4: Java GUI Programming(Revision tour-II) Q.1 Define GUI. How can you create a GUI application on java platform? Q.2 Which event get fired: (1) user presses enter in a text field. (2) user presses in a password field. (3) knob of scroll bar is dragged. (4) A radio button is clicked. Q.3 How is swing related to GUI programming? Q.4 Name the swing API classes that creates: (1) a list (2) a combobox Q.5 What is difference between a getText() and getPassword() methods ? CHAPTER-5 Java GUI Programming Revision tour-III Q.1 Difference between call by value and call by reference? Q.2 What is actual and formal parameters of function? Q.3 How do you invoke a constructor? Q.4 Design a class to represent a bank account. Include the following members: (1) Name of Depositor (2) Account Number (3) Type of Account (4) Balance in account Q.5 Write a program to implement a student class. Have a result method as member of the class. This method should take marks in three subjects as parameters and display result of the students. CHAPTER-6 More about classes and Libraries

Q.1 What is friendly access of class members? Q. 2 How are protected members different from public and private members of a class ?

Page 165: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 165

Q.3 Write a program, which will read a text and count all occurrences of a particular word. Q.4 How do we design a package ? Q.5 How does a class enforce information hiding ?

CHAPTER-7 Concept of inheritance

Q.1 How are arguments sent to the base constructors in multiple inheritance? Whose responsibility is it? Q.2 Illustrate the concept of function overloading with the help of an example. Q.3 Why do you think function overloading be a part of an object orientation programming ? Q.4 What is role of function’s signature in disambiguation process ?

CHAPTER-8 GUI Dialogs and tables

Q.1 What all classes can you use to create dialogs in java? Name them? Q.2 How many dialogs types does java supports ? Q.3 create a java application that obtains sales value of a salesman and then displays the commission.

Sales Commission

<1000 1000-2000 2000-3000 3000-4500 >4500

0 10% 15% 20% 25%

Q.4 Can you insert/remove rows from an existing tables?

CHAPTER-9 Database connectivity to Mysql

Q.1 How database connectivity useful? Q.2 Expand terms : (1) ODBC (2) JDBC Q.3 What are the steps to connect to a database from with java application? Q.4 Design a GUI application that fetches data like Emp_ID, Emp_name and Emp_address from EMP table ? Q.5 Name two commonly used drivers used for database connectivity from java application? CHAPTER-10 Web Application Development

Q.1 What do understand by the following terms: (1) URL (2) Multimedia Q.2 What is protocol? How do protocol effects internet? Q.3 Differentiate between web browser and web server? Q.4 What is WWW? How does it function? Q.5 What is URL? What are its components ? Q.6 define following terms: (1) Application server (2) Network Media

CHAPTER-11 HTML-I: Basic HTML Elements Q.1 What is HTML? What are its uses? Q.2 What is the difference between container tags and empty tags? Q.3 What are logical and physical text styles ?

Page 166: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 166

Q.4 Difference between <BR> tag and <P> tag?

Q.5 Differentiate between <TITLE> and <HEAD> tags? CHAPTER-12 HTML-II: Lists, Tables and forms Q.1 Differentiate between <UL> and <OL> tags? Q.2. How is a password text box different from ordinary text box? Q.3 What are <TH> and <TR> tags used? Q.4 Which attributes are used to give border to a table ? Q.5 create a webpage to display a table as given below: CHAPTER-13 XML-Extensible Markup Language

Q.1 Write some feature of XML ? Q.2 What is XML ? Q.3 Can you interchange attributes and elements? How? Why? When? Q.4 What do you understand by a well formed documents? Q.5 What is DTD? Explain it? Q.6 Create XML document to represents your mark sheet. (1) create stylesheet for this and open it on browser. (2) check whether your XML document well-formed or not. CHAPTER-14 My SQL Revision Tour

Q.1 What is Mysql server and client? Q.2 What does Data dictionary consists of? Q.3 Differentiate between DDL and DML? Q.4 How foreign key command are different from the primary key commands ? Q.5 increase salary of employee records by 10% (table of employee)? CHAPTER-15 Database transactions Q.1 What do understand by Database transaction? Q.2 What does transaction ROLLBACK indicates? Q.3 What does following commands do: (1)COMMIT (2) ROLLBACK (3) SAVEPOINT Q.4 Why do you use ROLLBACK statement? Explain in brief with the help of example?

Decimal English Hindi Spanish Korean

1 One Ek Uno hanna

2 Two Dou Dos dool

3 Three Tin Tres Set

4 Four Chaar Quarto Net

5 five Panch cinco daset

Page 167: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 167

Q.5 Discuss the user view and system view of a transaction? CHAPTER-16 More in SQL-Grouping Record and Table Joins

Q.1 what are different type of SQL functions? Q.2 Answer the questions based on the table Student given below: Table Name : Student

Column Name Data Type Size Description Constraint

RollNumber NUMBER 2 Student’s Roll Number Primary Key

Name VARCHAR2 25 Name of Student NOL NULL

Class VARCHAR2 3 Class of Student

Stream VARCHAR2 15 Stream opted by the Student

TotalMarks NUMBER 8,2 Total Marks scored by the Student

Grade VARCHAR2 1 Grade scored by the student Can be ‘A’ or ‘B’ or ‘C’

(e) Write SQL command to display Roll numbers, names, Total marks and grades of all the students in “Nonmedical” stream sorted by Total marks in descending order.

(f) Write SQL command to display the details of all the students in stream “ Medical” with Total marks is between 500 and 1000.

(g) Write SQL command to display name of students whose name contain ‘S’ as first alphabet and ‘L’ as third alphabet

Q.3. Write the resulting output of the following: (a) SELECT MONTH_BETWEEN(’12-DEC-98’,’25-JUN-98’) FROM DUAL; (b) SELECT LENGTH(‘AMIT SHARMA’),SUBSTR(‘AMIT SHARMA’,-5,4) FROM DUAL;

(c) SELECT MOD(ROUND(120.60,1),5) FROM DUAL Q.4 What is the significance of GROUP by clause in SQL query? CHAPTER-17 Tables and Integrity constraints

Q.1 what do you understand by constraints? What is their significance? Q.2 What is significance of NOT NULL constraints? Q.3 Create table namely(city, state, pin)? Q.4 Create table CLUB given below: Table : CLUB

Q.5 Can you have multiple foreign keys in your table?

Column Name Data Type Size Description Constraint

Member_No NUMBER 4 Member number Primary Key

Member_name VARCHAR2 30 Name of the member NOL NULL

Address VARCHAR2 30 Address of the member

Age NUMBER 3 Age of the member >=18

Page 168: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 168

Programs for Practical Assignments XI IP

Sushil Mishra

PGT – Comp. Sc.

K.V. New Cantt. Allahbad Chepter 3

1) Create a GUI application that display Hello Text1.setText(“Hello”);

2) Create a GUI application that display Sum of 2 Number String s1=text1.getText(); String s2=text2.getText(); Int A=Integer.parseInt(s1); Int B=Integer.parseInt(s2); Int C=A+B; Result.setText(“”+C);

3) Create a GUI application that solve Simple Interest Problem. String s1=text1.getText(); String s2=text2.getText(); String s3=text3.getText(); Int P=Integer.parseInt(s1); Int R=Integer.parseInt(s2); Int T=Integer.parseInt(s3); Float SI=(P*R*T)/100; Result.setText(“”+SI); Chapter 4

4) Create a GUI application that display Maximum in 2 Number String s1=text1.getText(); String s2=text2.getText(); Int A=Integer.parseInt(s1); Int B=Integer.parseInt(s2); If(A>B) Result.setText(“A ix Max”); Else Result.setText(“B ix Max”);

5) Create a GUI application that display Maximum in 3 Number String s1=text1.getText(); String s2=text2.getText(); String s3=text2.getText(); Int A=Integer.parseInt(s1); Int B=Integer.parseInt(s2); Int C=Integer.parseInt(s3); If(A>B && A>C) Result.setText(“A ix Max”); Else { If(B>C) Result.setText(“B ix Max”); Else Result.setText(“C ix Max”);

} Chapter 5

Page 169: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 169

6 Create a GUI application that display Factorial of given 2 Number String s1=text1.getText(); int N=Integer.parseInt(s1); int i=1; While(N>0) { i=i*N; N--; } Fact.setText(“”,i);

7 Create a GUI application that display Net Salary of Employee.

String s1=text1.getText(); Float Basic=Integer.parseInt(s1); Float DA=Basic*.2; Float HRA=Basic*.35; Float TA=800+800*.35; Float Netsalary=Basic+DA+HRA+TA; Result.setText(“”+Netsalary”); Chapter 6

8) Create a GUI application that display a Person is Eligible for Vote or not String s1=text1.getText(); Int Age=Integer.parseInt(s3); If(Age>18) Result.setText(“Eligible for Vote”); Else Result.setText(“Not Eligible for Vote”); 9) Create a GUI application that display a Number is Odd/Even String s1=text1.getText(); Int Number=Integer.parseInt(s1); If(Number%2==0) Result.setText(“Even”); Else Result.setText(“Odd”); 10) Create a GUI Application that Perform All Airthmetic Operation String s1=text1.getText(); String s2=text2.getText(); Int A=Integer.parseInt(s1); Int B=Integer.parseInt(s2); Add.setText(A+B); Sub.setText(A-B); Mul.setText(A*B); Div.setText(A/B); Mod.setText(A%B); Chapter 7

11) Write A method to print qube of given number. Double calccube(double a) { Double X=a*a*a; Return X;

Page 170: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 170

} This method we call by this way Int n=Integer.parseInt(text1.getText()); Double cube=calccube(n); Result.setText(“”+cube); 12) Write a method 2 swap 2 number Void swap(int n1,int n2) { Int n=n1; n1=n2; n2=n; Text1.setText(n1); Text2.setText(n2); } This method we call by this way Int A=Integer.parseInt(text1.getText()); Int B=Integer.parseInt(text2.getText()); Text1.setText(A); Text2.setText(B); Swap(A,B);

Chepter -8

1) Write SQL commands for the following on the basis of table STUDENT

Student No. Class Name Game Grade1 SUPW Grade2

10 7 Sameer Cricket B Photography A

11 8 Sujit Tennis A Gardening C

12 7 Kamal Swimming B Photography B

13 7 Veena Tennis C Cooking A

14 9 Archana Basket Ball A Literature A

15 10 Arpit Cricket A Gardening C

Q 1 Display the names of the student who are getting a grade ‘C’ in either Game or SUPW Q 2 Display the different game offered in the School. Q 3 Display the SUPW taken up by the students, whose name start with ‘A’. Q 4 Display the record in Decending Order by Name. Q 5 How many students play Game Cricket. Answer 1) Select name from Student Where Grade1=’C’ and Grade2=’C’; 2) Select distinct Game from Student; 3) Select SUPW from Student Where name like ‘A%’; 4) Select * from Student Order by Name Desc; 5) Select count(Name) from Student where Game=’Cricekt’; 2) Write SQL commands for the following on the basis of table Library

S.No. Title Author Types Pub Qty Price

1 Data Sturucture Lipschutz DS McGraw 4 217

2 Computer Studies French FND Galgotia 2 75

3 Advanced Pascal Schildt PROG McGraw 4 350

Page 171: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 171

4 Dbase Dummies Palmer DBMS PustakM 5 130

5 Mastering C++ Gurewich PROG BPB 3 295

6 Guide Network Freed NET Zpress 3 200

7 Mastering Foxpro Seigal DBMS BPB 2 135

8 DOS Guide Norton OS PHI 3 175

9 Basic for Beginners Morton PROG BPB 3 40

10 Mastering Window Cowart OS BPB 1 225

Q 1 Select all the PROG type pubilished by BPB from Library. Q 2 Display a list of all books with price more then 130 and sorted by QTY. Q 3 Display all the books sorted by Price in ascending order. Q 4. Add new column Date of Purchase. Q 5 Add 1 new record Answer

1) Select Type, Pub from Library Where Types=’PROG’ and Pub=’BPB’; 2) Select * from Library Sorted by QTY where price>130; 3) Select * from Library Sorted by Price; 4) Alter Table Library Add(Dateofpurchase date)); 5) Insert into Library (11,’Informatics Practices’, ‘Sumita Arora’, ‘PROG/DBMS’, Dhanpat Rai’,1,280);

Chepter -9

1) Given the following table

S.No. Name Stipend Stream Avgmark Grade Class

1 Karan 400 Medical 78.5 B 12B

2 Divakar 450 Commerce 89.2 A 11C

3 Divya 300 Commerce 68.6 C 12C

4 Arun 350 Humanities 73.1 B 12C

5 Sabina 500 Non Medical 90.6 A 11A

6 John 400 Medical 75.4 B 12B

7 Robert 250 Humanities 64.4 C 11A

8 Rubina 450 Non Medical 88.5 A 12A

9 Vikas 500 Non Medical 92.0 A 12A

10 Mohan 300 Commerce 67.5 C 12C

Give the output of following SQL satement.

1. Select Truncate(Avgmark) from Student where Avgmark<75. 2. Select Sum(Stipend) from Student. 3. Select Count(Stipend) from Student. 4. Select Concat(Name,Stream) from Student. 5. Select Right(stream, 2) from Student. 6. Select Max(Avgmark) from Student. 7. Select Sum(Stipend) from Sudent Group By Stream. 8. Select MOD(Stipend,3) from Student where Name =’Karan’; 9. Select Upper(Name) from Student; 10. Select Length(Name) from Student where Class=’12B’Select Length(Name) from Student where

Class=’12B’; Write SQL command for the following

Page 172: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 172

1) Create the table Department table based on the following table instance chart

Column Name DeptID Name

Data Type Number Varchar

Length 8 25

2) Drop Table Department 3) Add one more column salary of data type number and size 6 to the table Deparment. 4) Insert any 3 Record to table Deparment . 5) Create View dept on table Department where Salary>10000. 6) Delete record from table Department where Name=Account. 7) Add Salary 1000 to all employees 8) Drop the view dept. 9) To set Primary Key to column DeptID. 10) Display All Record in Decending order by Salary.

Question Paper/Marking Scheme/Blueprint XI CS

Kirtika Tomar

PGT – Comp. Sc.

K.V. Andrewsganj, Delhi

XI COMPUTER SCIENCE

Set-I

Time: 3 Hrs . Marks:70 1. Define Software and its types. 2 2. Write two types of Micro Computers? 2 3. Differentiate between the logical errors and runtime errors with one example each? 3 4. What is the difference between the ‘a’ and “a”? 1 5. Write how c++ represents the following? 4 (i) Backspace (ii) Newline (iii) Horizontal tab (iv) Null 6. What will be the result of the following two expressions if i=30 initially? 3 1) i++<=30 2) ++i<=30 7. Differentiate between keyword and Identifier with example. 3 8. Define operators and its types? 3 9. void main( ) 2 { int val,res,n=1000; cin>>val; res=n+val >1750 ?400:200; cout<<res; } 1. If val=750; the res=? 2. Name of the operator used in the program? 10. Generate the series 0,1,1,2…N 3 11. Write a program to transpose the matrix of size M*N? 5 12. Explain various types of Constants with example. 3 13. Write a program to compare two strings without using functions. 5 14. Write a program to find the factorial of 10 using recursion? 3 15. Write the output of the following program. 3

Page 173: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 173

#include<iostream.h> int func(int &x,int y=10) { if (x%y= = 0) return ++x; Else return y- -; } void main( ) { int p=20,q=23; q=func(p,q); cout<<p<<q<<endl; p=func(q);cout<<p<<q<<endl; q=func(p); cout<<p<<q<<endl; } 16. Base of Octal and Hexadecimal is ___ and ___. 1 17. Find the 1’s and 2’s complement of 128. 2 18. 1.(AC.20)16= (?)2= (?)8 2 2.(4A56)16= (?)10= (?)8 2 19. Rewrite the following program after removing the syntactical error(s) if any. 3 Underline each correction. #include<iostream.h> int main { struct movie { char movie_name[20]; char movie_type; int ticket_cost=100; }movie; gets(movie_name); gets(movie_type); } 20. What will be the output of the following program? 2 int main() {i nt i=0,x=0; for(i=1;i<10;i*=2) { x++; cout<<x; } cout<<”\n”<<x; } 21. What will be the result of the following two expressions if i=10 initially? 3 i)cout<<i<<i++<<++i; ii)cout<<i<<i+1<<++i; 22. Write the names of the header files of the following functions. 4 i)getch() ii) isalpha() iii)strcpy() iv)sqrt() 23. Write a program that store information of 20 students and display only those students whose marks > 40%. struct student { int roll; char name[20]; char grade; int class;

Page 174: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 174

int marks;//(out of 100) }; Use functions readinfo() and displayinfo() 6

Solution Set-I Q.1 A. Software: Software represents the set of programs that govern the operation of a computer System and make the hardware run. Eg: Dos, MS-Word, C++,Visual Basic,Paint Brush, etc. Software can be classified broadly into two categories: (i)System Software: a)Operating System b) Language Processors (ii) Application Software Q.2 A. Types of Micro Computers:

i) PDA ( Personal Digital Assistants). ii) Desktop Computers and Laptop (Notebook) Computers. iii) Workstations. Q.3 A. Logical Error: A logical error is that error which causes a program to produce incorrect or undesired output. For instance, if we are trying to print the table of a number 3 and if we say ctr=1; while(ctr>10) { cout<<n*ctr; ctr=ctr+1; } Here the loop would not be executed even once as the condition(ctr>10) is not fulfilled at all. Runtime Error (Execution Error):A run time error is that occurs during the execution of a program. It is caused of some illegal operation taking place or unavailability of desired or required conditions for the execution of the program. Eg: Division by zero, Trying to open a file which does not exist or it could not be opened, If enough memory is not available. Q.4 A. ‘a’ is a character literal so it takes 1 Byte to represent. “a” is a string literal so it takes 2 Bytes to represent. Q.5 A (i)\b - Backspace (ii)\n – Newline (iii) \t - Horizontal tab (iv) \0 – Null Q.6 A. (i) True (ii) False Q.7 A (i) Keywords: Keywords are the words that convey a special meaning to the language

Page 175: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 175

compiler. These are reserved for special purpose and must not be used as normal identifier names. Original C++ consists 48 keywords and ANSI C++ consists 63 keywords. Eg: int, switch, while, etc. (ii)Identifiers:Identifiers are the names given variables, objects, classes, functions,arrays, etc. Eg: rno, myfile, etc. Q.8 A. Operators :The operations (specific tasks) are represented by operators and the objects of the operation(s) are referred to as operands. They can be classified into 3 categories depending on number of operands it is working: (a) Unary operators: Works on single operand. Eg (i) ++ (Increment operator). Used to increment ‘one’ to the existing value. A=10; A++; After the execution of above statement, A value will becomes as 11. (ii) - - (Decrement Operator). Used to decrement ‘one’ to the existing value. (iii) sizeof( ): This is used to return the number of bytes for the given data type or variable. int a; sizeof(a); //returns 2 since a is of type int. (iv) Unary + : It will give the value with same sign. A=10; +A will gives 10 only. A= -10; +A will gives -10. (v) Unary - : It will give the value with opposite sign. A=10; -A will gives – 10. A=-10; -A will gives 10. (vi) !: Not (b) Binary operators: Works on two operands. Eg: Arithmetic Operators: + , - , * , / , % + for addition on two operands. - for subtraction * for multiplication / for quotient % for remainder. Relational Operators: < , <=, >, >=, !=, = =. Logical Operators: &&, | | Etc., (c)Ternary operator: Works on three operands. Eg: Conditional operators. (exp1)?exp2:exp3 Here when the expression 1 becomes true expression 2 will be executed and if it becomes false, then expression 3 will be executed. Q.9 A.1 200 A.2 Conditional Operator Q.10 //Program to generate fibonacci numbers. #include<iostream.h> #include<conio.h> void main( ) {clrscr( );

Page 176: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 176

int first,second,third,i,n; cout<<"\nHow many numbers you want to generate the fibonacci numbers.."; cin>>n; first=0; second=1; cout<<endl<<first<<"\t"<<second<<"\t"; for(i=3;i<=n;i++) { third=first+second; cout<<third<<"\t"; first=second; second=third; } getch( ); } Q.11 //program to find transpose of M*N Matrix #include<iostream.h> #include<conio.h> void main( ) { int A[10][10],B[10][10]; int M,N,i,j; cout<<"\nEnter the number of Rows: "; cin>>M; cout<<"\nEnter the number of Columns: "; cin>>N; cout<<"\nEnter "<<M*N<<" elements...\n"; for(i=0;i<M;i++) for(j=0;j<N;j++) { cin>>A[i][j]; B[j][i]=A[i][j]; } cout<<"\nThe entered Array..........\n"; for(i=0;i<M;i++) { for(j=0;j<N;j++) cout<<A[i][j]<<"\t"; cout<<endl; } cout<<"\nThe transpose of the matrix.......\n"; for(i=0;i<N;i++) { for(j=0;j<M;j++) cout<<B[i][j]<<"\t"; cout<<endl; } getch( ); } Q.12 A. Constants (Literals): are data items that never change their value during a program run. Different types of literals… (i) Integer constant (ii) Floating Constant (iii) Character Constant (iv) String Constant.

Page 177: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 177

(i) Integer Constant: Integer constants are whole numbers without any fractional part. Three types of integer constants. (a)Decimal integer constants (b) Octal Integer Constants (c) Hexadecimal integer Constants Eg: 789 – Decimal integer constant 032 – Octal integer constant 0xFA2 – Hexadecimal integer constant. (ii) Floating Constants (Real Constants): Real constants are numbers having fractional Form. These may written in fractional form or exponential form. Eg: 17.45 - Fractional form 0.1745E2 – Exponential form (iii)Character Constants: It is a single character kept in between pair of ‘ ‘. Any ASCII Character can be represented as a character constant. An escape sequence, which consists non-graphic characters can be represented through a character constant. Eg: ‘n’, ‘\n’, ‘z’,’\a’, ‘\t’, ‘k’, etc. (iv) String Constants: Multiple character constants are treated as string literals. A string Literal is a sequence of characters surrounded by double quotes. Each string literal is by default added with a special character ‘\0’. Eg: “abc” - size is 4. “Navodaya” – size is 9. Q.13 A. //Program to compare two strings. #include<iostream.h> #include<conio.h> #include<stdio.h> #include<process.h> void main() {char str1[10],str2[10]; int l1=0,l2=0,i,flag=0; clrscr( ); cout<<"\nEnter the first string: "; gets(str1); cout<<"\nEnter the second string: "; gets(str2); for(i=0;str1[i]!='\0';i++); l1=i; for(i=0;str2[i]!='\0';i++); l2=i; if(l1!=l2) { cout<<"\nBoth strings are not the same..."; getch( ); exit(0); } for(i=0;str1[i]!='\0';i++) { if(str1[i]!=str2[i]) { flag=1; break; } } if(flag= =0) cout<<"\nEntered strings are identicle..."; else

Page 178: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 178

Praise The Lord Any Doubt? Contact:[email protected] MRK 11 Computer Sample – 2 6 cout<<"\nEntered strings are not identicle..."; getch( ); } Q.14 A. #include<iostream.h> #include<conio.h> long f=1; long factorial(int n) {if (n==0) return f; else f=n*factorial(n-1); } void main( ) { clrscr( ); cout<<"\nThe factorial of the number 10 = "<<factorial(10); getch( ); } Q.15 A. 2023 1023 1111 Q.16 A. Base of Octal = 8 Base of Hexadecimal = 16 Q.17 A) Binary Equivalent of 128 = 10000000 1’s Complement of 128 = 01111111 +1 2’s Complement of 128 = 10000000 Q.18 A) (AC.20)16 Binary equivalent of A = 1010 Binary equivalent of C = 1100 Binary equivalent of 2 = 0010 Binary equivalent of 0 = 0000 So, (AC.20)16 = (10101100.00100000) 2

(10101100.00100000) 2 = = (254.100) 8 A)(4A56)16 = 4 X 163 + 10 X 162 + 5 X 161 + 6 X 160

Page 179: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 179

=4 X 4096 + 10 X 256 + 5 X 16 + 6 X 1 = 16384 + 2560 + 80 + 6 = (19030) 10 (4A56)16 =(0100 1010 0101 0110) 2

= = (45126) 8 Q.19 A) #include<iostream.h> #include<stdio.h> void main( ) { struct movie { char movie_name[20]; char movie_type; int ticket_cost; }Movie; Movie.ticket_cost=100; gets(Movie.movie_name); cin>>Movie.movie_type; } Q.20 A) 1234 4 Q.21 A) 121111 A) 111211 Q.22 A) (i) getch( ) - conio.h (ii)isalpha( ) – ctype.h (iii)strcpy( ) - string.h (iv)sqrt( ) - math.h Q.23. struct student { int roll; char name[20]; char grade; int class; int marks;//(out of 100) }s[20]; Void readinfo() { for(int i=0; i<20; i++) { cout<<”Enter information for student”<<i+1<<”\n” ; cout<<”Enter roll :”; cin>>s[i]. roll;

Page 180: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 180

cout<<”\n” ; cout<<”Enter name :”; cin>>s[i]. name; cout<<”\n” ; cout<<”Enter grade :”; cin>>s[i]. grade; cout<<”\n” ; cout<<”Enter class :”; cin>>s[i]. class; cout<<”\n” ; cout<<”Enter marks :”; cin>>s[i]. marks; cout<<”\n”; } } Void displayinfo() { for (int i=0; i<20; i++) { if(s[i].marks >40) { cout<<”Roll :”; cout<<”s[i]. roll; cout<<”\n” ; cout<<”Name :”; cout<<”s[i]. name; cout<<”\n” ; cout<<”Grade :”; cout<<”s[i]. grade; cout<<”\n” ; cout<<”Class :”; cout<<”s[i]. class; cout<<”\n” ; cout<<”Marks Obtained :”; cout<<”s[i]. marks; cout<<”\n”; } } #include<iostream.h> #include<conio.h> Void main() { Clrscr(); Void readinfo();\ Voiddisplayinfo(); getch() }

Page 181: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 181

XI COMPUTER SCIENCE

Set-II

Time: 3 Hrs Max.Marks:70

1. Differentiate between primary memory and secondary memory.. Give examples of each type of memory. 2 2. Expand the following: 2 i)CPU ii) ROM iii)MICR iv)CD-R 3. Explain briefly the functions of ALU. 3 4. What is the difference between semantics error and syntax error? Give an example of each. 3 5. What is data abstraction? Explain the concept with the help of an example. 2 6. i) How many bytes are in a terabyte? 1 ii) Write the names of two popular system softwares. 1 7. i) What do you meant by a lexical unit? Give an example. 2 ii) In each of the following cases show how the comment can be placed in a program: 1 a)Add a comment sum of three numbers to the statement: sum=a+b+c; b) Add the comment End of Function with the ‘}’. 8. Differentiate between unions and structures with help of an example. 3 9.Differentiate between object oriented programming and procedural oriented programming with the help of examples of each. 3 10. Distinguish between if and switch statement. 2 11. Differentiate between call by value and call by reference with help of an example. 3 12. Write the names of the header files of the following functions. 4 i)getch() ii) isalpha() iii)strcpy() iv)sqrt() 13. Write a program to print the diagonal (left & right) elements of an NN matrix. 5 14. Write a program to find the factorial of a number recursive function. 3 15. Write a program to find the total number of characters, lines and words in a paragraph of text. 5 16. Write a program to sort an array on N numbers in ascending order. Avoid

Page 182: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 182

duplication of elements. 3 17. Write a program to find the roots of a quadratic equation. 3 18. Write a program to convert the temperature reading in Fahrenheit to Celsius. 3 19. What is the difference between ‘=’ and ‘==’? 2 20. What will be the result of the following two expressions if i=10 initially? 2 (i) cout<<i<<i++<<++i; (ii) cout<<i<<i+1<<++i; 21. What will be the output of the following program? 3 int main() {i nt i=0,x=0; for(i=1;i<10;i*=2) { x++; cout<<x; } cout<<”\n”<<x; } 22. Rewrite the following program after removing the syntactical error(s) if any. Underline each correction. 2 #include<iostream.h> int main { struct movie { char movie_name[20]; char movie_type; int ticket_cost=100; }movie; gets(movie_name); gets(movie_type); } 23. Generate the series 0,1,1,2…N 4 24. Write the output of the following program. 3 #include<iostream.h> int func(int &x,int y=10) { if (x%y= = 0) return ++x; Else return y- -; } void main( ) { int p=20,q=23; q=func(p,q); cout<<p<<q<<endl; p=func(q);cout<<p<<q<<endl; q=func(p); cout<<p<<q<<endl; }

Page 183: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 183

Solution XI Set-II Ans 1. The memory inside the CPU is primary memory (main memory) and the memory outside it is known as secondary(auxiliary) memory. Primary Memory: RAM (Random Access Memory) and ROM (Read only Memory) comes under primary memory. RAM is volatile memory and ROM is non volatile memory. All the data and programs must be stored in RAM for execution. But the content of RAM is not permanent. Eg: RAM, ROM. Secondary Memory: Since primary memory has a limited storage capacity and is not permanent, secondary storage devices are used to store large amount of data permanently. There are various types of secondary devices available these days. Eg: Hard disks, Floppy disks ----- Magnetic Media CD ROMS, DVDs ----- Optical Media Ans 2. (i) CPU - Central Processing Unit (ii)ROM - Read Only Memory (iii)MICR – Magnetic Ink Character Reader (iv)CD –R – Compact Dist Recordable Ans 3. The Arithmetic and Logic Unit performs all the four arithmetical (+,-,*,/) and some logical (<,<=,>,>=,< >) operations. When two numbers are required to be added, these numbers are sent from memory to ALU where addition takes place and the result is put back in the memory. In the same way other arithmetic operations are performed. For logical operations also, the numbers to be compared are sent from memory to ALU where the comparison takes place and the result is returned to the memory. The result of a logical operation is either TRUE or FALSE. These operations provide the capability of decision-making to the computer. Ans 4. 1.Syntax Errors: Syntax errors occur when rules of a programming language are misused. Syntax refers to formal rules governing the construction of valid statements in a language. Eg: int a,b //Did not keep ; (semicolon) at the end of statement. 2.Semantics Error: Semantic errors occur when statements are not meaningful. Semantics refers to the set of rules which give the meaning of a statement. Eg: X * Y = Z; (Siva plays Guitar is Syntactically and Semantically correct but Guitar plays Siva is Syntactically correct but Semantically incorrect). Ans 5. Abstraction: Abstraction refers to the act of representing essential features without including the background details or explanations. Eg: If you talk about student details, complete details are his rollno, admissionno, name, m1, m2, m3, total, avg, grade, fathername, address, pin, etc…… But abstraction about his marks are… Rollno,admissionno,name,m1,m2,m3,total,avg,grade. Ans 6. i) 1024 X 1024 X 1024 X 1024 Bytes

Page 184: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 184

(or) 210 X 210 X 210 X 210 Bytes (or) 24 0 Bytes ii) Operating Systems: DOS, Windows XP, Unix,Solaries. Language Processors: Assembler, Compiler, Interpreter. Ans 7. i) Token: The smallest individual unit in a program is known as a token (Lexical Unit). There are 5 types of tokens. (i) Keywords (ii) Identifiers (iii) Literals (iv) Punctuators (v) Operators ii) a) sum = a+b+c; //sum of three numbers b) } //End of Function Ans 8. Structure: A structure is a collection of elements(variables) of different data types. The keyword struct is used to construct a structure.

Syntax: struct structtag { datatype variable; datatype variable. ----- ----- }structure variables; Eg: struct student { int rollno; car name[26]; int m[3]; int total; float avg; }s1,s2; struct s3;

Referencing Structure variables: Structurevariable.elementname; Eg: s1.rollno; s2.name; s3.marks[2]; Union: A union is a memory location that is shared by two or more different variables (generally

Page 185: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 185

shared by two or more different times). Eg: union share { int i; char ch; }; union share us; us.i = 20; cout<<us.ch; At any point, you can refer to the data stored in a us as either an integer or a character.

Difference between a union and a structure: A union is a memory location that is shared by two or more different variables. A structure have separate memory location for every variable. In the above example for structure variable S1, 40 Bytes will be reserved and For union variable us, 2 bytes will be reserved. Ans 9. Procedure Oriented Programming: A program in a procedural language is a list of instructions where each statement tells the computer to do something. The focus is on the processing. There is no much security for the data. Object Oriented Programming: The object oriented approach views a problem in terms of objects involved rather than procedure for doing it. In object oriented programming, object represents an entity that can store data and has its interface through functions.

All data is openly available to all Data and functions enclosed within objects. functions in the program New objects communicate with one another. OOP is so closer to the real life. And also it consists many features like 1.Data Abstraction 2.Data Encapsulation 3.Modularity 4.Inheritance 5.Polymorphism 6. Data hiding. Ans 10. The if-else and switch both are selection statements and they both let you select

Page 186: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 186

an alternative out of given many alternatives by testing an expression. But there are some differences in their operations. (i) The switch statement differs from the if statement in that switch can only test for equality whereas if can evaluate a relational or logical expression. Ie multiple conditions. (ii) The switch statement selects its branches by testing the value of same variable whereas the if else construction lets you use a series of expressions that may involve unrelated variables and complex expressions. (iii) The if-else can handle ranges whereas switch cannot. Each switch case label Must be a single value. (iv) The if-else statement can handle floating point tests also where as switch cannot handle floating point tests. (v) The switch case label value must be a constant. So, if two or more variables are to be compared, use if-else. Ans 11. (i)In call by value, actual arguments will be copied into the formal parameters. In call by reference, formal parameters are references to the actual arguments. (ii)In call by value, if any modification is occurred to the formal parameter, that change will not reflect back to the actual argument. In call by reference, if any modification is occurred to the formal parameter (reference to the actual argument), the actual argument value will be changed. (iii) We should go for call by value when we don’t want to modify the original value. We should go for call by value when we want to modify the original value. (iv) Example: void Change(int a, int &b) { a= 2*a; b=20; } Here a is called by “call by value” method and b is called by “call by reference” So as the value of a is changed, actual argument for a will not be changed, as the value of b is changed, actual argument for b will be changed. Ans 12. (i) getch( ) - conio.h (ii)isalpha( ) – ctype.h (iii)strcpy( ) - string.h (iv)sqrt( ) - math.h Ans 13. //Program to print the left and right diagonal element of an NXN matrix #include<iostream.h> #include<conio.h> #include<iomanip.h> void main( ) { int A[10][10]; int i,j,N; clrscr( ); cout<<"\nHow many rows and columns required for matrix: "; cin>>N; cout<<"\nEnter "<<N*N<<" elements: "; for(i=0;i<N;i++) { cout<<"Enter the elements into Row "<<i+1<<": "; for(j=0;j<N;j++)

Page 187: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 187

cin>>A[i][j]; } clrscr( ); cout<<"\nThe entered elements in the matrix are: \n"; for(i=0;i<N;i++) { for(j=0;j<N;j++) cout<<A[i][j]<<"\t"; cout<<endl; } cout<<"\n\n\nThe elements which are belongs to only diagonals...\n"; for(i=0;i<N;i++) { for(j=0;j<N;j++) if((i==j)||((i+j)==(N-1))) cout<<setw(6)<<A[i][j]; else cout<<" "; cout<<endl; } getch( ); } Ans 14. #include<iostream.h> #include<conio.h> long f=1; long factorial(int n) { if (n==0) return f; else f=n*factorial(n-1); } void main( ) { clrscr( ); long num; cout<<"\nEnter the number to which you want to find factorial: "; cin>>num; cout<<"\nThe factorial of the number = "<<factorial(num); getch( ); } Ans 15. #include<iostream.h> #include<conio.h> #include<stdio.h> void main( ) { char str[300]; int i,charcount=0,words=1,lines=1; clrscr(); cout<<"\nEnter the Paragraph ie message: \n"; gets(str); for(i=0;str[i]!='\0';i++) { charcount++;

Page 188: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 188

if(str[i]==' ') words++; if (charcount%80==0) lines++; } cout<<"\nNumber of Characters in the entered message: "<<charcount; cout<<"\nNumber of Words in the entered messge: "<<words; cout<<"\nNumber of Lines in the entered message: "<<lines; getch( ); } Ans 16. #include<iostream.h> #include<conio.h> void main( ) { clrscr( ); int A[20],N,i,j,temp; cout<<”\nEnter the number of elements:”; cin>>N; for(i=0;i<N;i++) cin>>A[i]; //Bubble sort technique for(i=0;i<N;++i) for(j=0;j<(N-1)-i ;j++) if(A[j]>A[j+1]) { Temp=A[j]; A[j]=A[j+1]; A[j+1]=Temp; } cout<<"The Elements in the array after sorting…. "; for(i=0;i<N;i++) cout<<A[i]<<'\t'; } Ans 17. #include<iostream.h> #include<conio.h> #include<math.h> void main( ) { clrscr( ); double d1,d2,b,a,c,d; cout<<"\nEnter the value of b,a and c: "; cin>>b>>a>>c; d=(b*b-sqrt(4*a*c)); if(d==0) cout<<"\nRoots are equal or distinct"; else if(d>=0) cout<<"\nRoots are Real"; else cout<<"\nRoots are complex..ie Imaginary"; d1=(-b+d)/(2*a);

Page 189: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 189

d2=(b+d)/(2*a); cout<<"\nD1: "<<d1; cout<<"\nD2: "<<d2; getch( ); } Ans 18. #include<iostream.h> #include<conio.h> void main( ) { double c,f; clrscr( ); cout<<"\nEnter the temperature in Fahrenheit: "; cin>>f; c=(5/9.0)*f-32; cout<<"\nThe equivalent temperature in Celcius: "<<c; getch( ); } Ans 19. = is assignment operator. This operator stores the right side value into left side variable. = = is relational operator. It will check whether right side and left side operands are equal or not and returns a true(1) when both are equal, false(0) otherwise. Ans 20. (i) 121111 (ii) 111211 Ans 21. Output is : 1234 4 Ans 22. #include<iostream.h> #include<stdio.h> void main( ) { struct movie { char movie_name[20]; char movie_type; int ticket_cost; }Movie; Movie.ticket_cost=100; gets(Movie.movie_name); cin>>Movie.movie_type; } Ans 23. //Program to generate fibonacci numbers. #include<iostream.h> #include<conio.h> void main( )

Page 190: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 190

{clrscr( ); int first,second,third,i,n; cout<<"\nHow many numbers you want to generate the fibonacci numbers.."; cin>>n; first=0; second=1; cout<<endl<<first<<"\t"<<second<<"\t"; for(i=3;i<=n;i++) { third=first+second; cout<<third<<"\t"; first=second; second=third; } getch( ); } Ans 24. Output are: 2023 1023 1111

Question Paper/Marking Scheme/Blueprint XII CS

Anup Kumar

PGT – Comp. Sc.

Ambuja Public School, Rabariyawas SET - 1

Class XII Subject : Computer Science Time: 3hrs

Max. Marks: 70 Note : All the questions are compulsory.

Give corresponding numbering to Answers according to questions

1.

(a) What is the difference between Global Variable and Local Variable? 2 (b) Write the names of the header files to which the following belong: 1

(i) strcmp() (ii) fabs() (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction.

2 #include [iostream.h]

class PAYITNOW

{

int Charge;

PUBLIC:

void Raise(){cin>>Charge;}

void Show{cout<<Charge;}

};

void main()

{

PAYITNOW P;

P.Raise();

Show();

}

(d) Find the output of the following program: 3

Page 191: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 191

#include <iostream.h>

struct PLAY

{ int Score, Bonus;};

void Calculate(PLAY &P, int N=10)

{

P.Score++;P.Bonus+=N;

}

void main()

{

PLAY PL={10,15};

Calculate(PL,5);

cout<<PL.Score<<”:”<<PL.Bonus<<endl;

Calculate(PL);

cout<<PL.Score<<”:”<<PL.Bonus<<endl;

Calculate(PL,15);

cout<<PL.Score<<”:”<<PL.Bonus<<endl;

}

(e) Find the output of the following program: 2 #include <iostream.h>

#include <ctype.h>

void Encrypt(char T[])

{

for (int i=0;T[i]!='\0';i+=2)

if (T[i]=='A' || T[i]=='E') T[i]='#';

else if (islower(T[i])) T[i]=toupper(T[i]);

else T[i]='@';

}

void main()

{

char Text[]="SaVE EArtH";//The two words in the string Text

//are separated by single space

Encrypt(Text);

cout<<Text<<endl;

}

(f) In the following program, if the value of N given by the user is 15, what maximum and minimum values the program could possibly display? 2

#include <iostream.h>

#include <stdlib.h>

void main()

{

int N,Guessme;

randomize();

cin>>N;

Guessme=random(N)+10;

cout<<Guessme<<endl;

}

2. (a) What do you understand by Data Encapsulation and Data Hiding? 2

(b) Answer the questions (i) and (ii) after going through the following class: 2 class Seminar

{

int Time;

public:

Seminar() //Function 1

{

Time=30;cout<<”Seminar starts now”<<end1;

}

void Lecture() //Function 2

{

cout<<”Lectures in the seminar on”<<end1;

}

Seminar(int Duration) //Function 3

{

Time=Duration;cout<<”Seminar starts now”<<end1;

}

~Seminar() //Function 4

{

cout<<”Vote of thanks”<<end1;

Page 192: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 192

}

};

i) In Object Oriented Programming, what is Function 4 referred as and when does it get invoked/called? ii) In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example

illustrating the calls for these functions. (c) Define a class TEST in C++ with following description:

4 Private Members

a. TestCode of type integer b. Description of type string c. NoCandidate of type integer d. CenterReqd (number of centers required) of type integer e. 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

(d) Answer the questions (i) to (iv) based on the following: 4 class PUBLISHER

{

char Pub[12];

double Turnover;

protected:

void Register();

public:

PUBLISHER();

void Enter();

void Display();

};

class BRANCH

{

char CITY[20];

protected:

float Employees;

public:

BRANCH();

void Haveit();

void Giveit();

};

class AUTHOR:private BRANCH,public PUBLISHER

{

int Acode;

char Aname[20];

float Amount;

public:

AUTHOR();

void Start();

void Show();

};

(v) Write the names of data members, which are accessible from objects belonging to class AUTHOR. (vi) Write the names of all the member functions which are accessible from objects belonging to class BRANCH. (vii) Write the names of all the members which are accessible from member functions of class AUTHOR. (viii)How many bytes will be required by an object belonging to class AUTHOR?

3.

(a) 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. 4

(b) 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. 4

(c) Write a function in C++ to perform Insert operation in a dynamically allocated Queue containing names of students. 4

Page 193: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 193

(d) Write a function in C++ to find the sum of both left and right diagonal elements from a two dimensional array (matrix). 2

(e) Evaluate the following postfix notation of expression: 2 20,30,+,50,40,-,*

4.

(a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekp() and seekg() functions for performing the required task. 1 #include <fstream.h>

class Item

{

int Ino;char Item[20];

public:

//Function to search and display the content from a particular //record number

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();

}

(b) Write a function in C++ to count the number of lines present in a text file “STORY.TXT”. 2 (c) Write a function in C++ to search for a BookNo from a binary file “BOOK.DAT”, assuming the binary file is containing the objects of the

following class. 3 class BOOK { int Bno; char Title[20]; public: int RBno(){return Bno;} void Enter(){cin>>Bno;gets(Title);} void Display(){cout<<Bno<<Title<<endl;} };

5. (a) What do you understand by Degree and Cardinality of a table? 2

(b) 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) 6

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

Page 194: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 194

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 earliar than 01/01/2004 in ascending order of ParticipantNum. (ix) 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; 6. (a) State and verify Demorgan’s Laws. 2 (b) Write the equivalent Boolean Expression for the following Logic Circuit 2

(p) Write the POS form of a Boolean function F, which is represented in a truth table as follows: 1

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

(q) Reduce the following Boolean Expression using K-Map:

3

F(A,B,C,D)=Σ(0,1,2,4,5,6,8,10)

7.

a) What is the significance of ARPANET in the network? 1

b) Expand the following terminologies: 1 (i) CDMA (ii) GSM

c) Give two major reasons to have network security. 1

d) What is the purpose of using a Web Browser? Name any one commonly used Web Browser.

1

e) Knowledge Supplement Organisation has set up its new center at Mangalore for its office and web based

activities. It has 4 blocks of buildings as shown in the diagram below:

P

Q

Page 195: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 195

Center to center distances between various blocks

Black A to Block B 50 m

Block B to Block C 150 m

Block C to Block D 25 m

Block A to Block D 170 m

Block B to Block D 125 m

Block A to Block C 90 m

Number of Computers

Black A 25

Block B 50

Block C 125

Block D 10

e1) Suggest a cable layout of connections between the blocks. 1 e2) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable

reason. 1 e3) Suggest the placement of the following devices with justification 1

(iii) Repeater (iv) Hub/Switch

e4) The organization is planning to link its front office situated in the city in a hilly region where cable connection is not feasible, suggest an economic way to connect it with reasonably high speed? 1

Block A

Block C

Block B

Block D

Page 196: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 196

Marking Scheme Set - 1

Max. Marks: 70

Duration: 3 Hours

Q1.

(a) What is the difference between Global Variable and Local Variable? 2

Answer:

Global Variable Local Variable

• It is a variable, which is declared outside all the functions

• It is accessible throughout the program

• It is a variable, which is declared with in a function or with in a compound statement

• It is accessible only within a function/compound statement in which it is declared

#include <iostream.h>

float NUM=900; //NUM is a global

variable

void LOCAL(int T)

{

int Total=0; //Total is a local

variable

for (int I=0;I<T;I++)

Total+=I;

cout<<NUM+Total;

}

void main()

{

LOCAL(45);

}

(1/2 Mark for each point of difference)

(1/2 Mark for example of Global Variable)

(1/2 Mark for example of Local Variable)

OR (Full 2Marks to be awarded if the difference is explained with the help of suitable example)

(d) Write the names of the header files to which the following belong: 1

(i) strcmp() (ii) fabs() Answer:

(i) string.h (ii) math.h

(1/2 Mark for mentioning name of each header file)

(e) Rewrite the following program after removing the syntactical errors (if any). Underline each

correction.

2

#include [iostream.h]

class PAYITNOW

{

int Charge;

Page 197: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 197

PUBLIC:

void Raise(){cin>>Charge;}

void Show{cout<<Charge;}

};

void main()

{

PAYITNOW P;

P.Raise();

Show();

}

Answer:

#include <iostream.h>

class PAYITNOW

{

int Charge;

public:

void Raise(){cin>>Charge;}

void Show(){cout<<Charge;}

};

void main()

{

PAYITNOW P;

P.Raise();

P.Show();

}

(1/2 Mark for correcting each error)

OR (1 Mark for identifying all the 4 errors with no correction)

(d) Find the output of the following program:

3 #include <iostream.h>

struct PLAY

{ int Score, Bonus;};

void Calculate(PLAY &P, int N=10)

{P.Score++;P.Bonus+=N;

}

void main()

{ PLAY PL={10,15};

Calculate(PL,5);

cout<<PL.Score<<”:”<<PL.Bonus<<endl;

Calculate(PL);

cout<<PL.Score<<”:”<<PL.Bonus<<endl;

Calculate(PL,15);

cout<<PL.Score<<”:”<<PL.Bonus<<endl;

}

Answer:

11:20

12:30

13:45

(1 Mark for each correct line of output)

Page 198: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 198

Note:

Deduct ½ Mark for not showing : in the output

Deduct ½ Mark for not considering endl

(e) Find the output of the following program:

2 #include <iostream.h>

#include <ctype.h>

void Encrypt(char T[])

{

for (int i=0;T[i]!='\0';i+=2)

if (T[i]=='A' || T[i]=='E') T[i]='#';

else if (islower(T[i])) T[i]=toupper(T[i]);

else T[i]='@';

}

void main()

{

char Text[]="SaVE EArtH";//The two words in the string Text

//are separated by single space

Encrypt(Text);

cout<<Text<<endl;

}

Answer:

@a@E@E#rTH

(1 Mark for writing all alphabets at correct positions)

(1/2 Mark for writing @ at correct positions)

(1/2 Mark for writing # at correct position)

(g) In the following program, if the value of N given by the user is 15, what maximum and minimum

values the program could possibly display? 2

#include <iostream.h>

#include <stdlib.h>

void main()

{

int N,Guessme;

randomize();

cin>>N;

Guessme=random(N)+10;

cout<<Guessme<<endl;

}

Answer:

Maximum Value: 24 Minimum Value: 10

(1 Mark for writing correct minimum value)

(1 Mark for writing correct maximum value)

Q2.

(a) What do you understand by Data Encapsulation and Data Hiding?

2 Answer:

Data Encapsulation: Wrapping up of data and function together in a single unit is known as Data Encapsulation. In a class, we wrap up the data and function together in a single unit. Data Hiding: Keeping the data in private visibility mode of the class to prevent it from accidental change is known as Data Hiding.

Page 199: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 199

class Computer

{

char CPU[10];int RAM;

public:

void STOCK();

void SHOW();

};

(1 Mark for each definition and explanation)

OR

(Full 2 marks for explaining both with the help of an example)

(c) Answer the questions (i) and (ii) after going through the following class: 2 class Seminar

{

int Time;

public:

Seminar() //Function 1

{

Time=30;cout<<”Seminar starts now”<<end1;

}

void Lecture() //Function 2

{

cout<<”Lectures in the seminar on”<<end1;

}

Seminar(int Duration) //Function 3

{

Time=Duration;cout<<”Seminar starts now”<<end1;

}

~Seminar() //Function 4

{

cout<<”Vote of thanks”<<end1;

}

};

iii) In Object Oriented Programming, what is Function 4 referred as and when does it get

invoked/called? Answer:

Destructor, it is invoked as soon as the scope of the object gets over.

( ½ Mark for mentioning “Destructor”)

( ½ Mark for correctly answering to remaining part of the question)

iv) In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions.

Answer:

Constructor Overloading (Polymorphism) Seminar S1,S2(90);

( ½ Mark for mentioning “Constructor Oveloading” OR “Polymorphism”)

( ½ Mark for example)

Data Hiding

Data Encapsulation

Page 200: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 200

(e) Define a class TEST in C++ with following description:

4

Private Members

a. TestCode of type integer

b. Description of type string

c. NoCandidate of type integer

d. CenterReqd (number of centers required) of type integer

e. 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 Answer:

class TEST

{

int TestCode;

char Description[20];

int NoCandidate,CenterReqd;

void CALCNTR();

public:

void SCHEDULE();

void DISPTEST();

};

void TEST::CALCNTR()

{

CenterReqd=NoCandidate/100 + 1;

}

void TEST::SCHEDULE()

{

cout<<”Test Code :”;cin>>TestCode;

cout<<”Description :”;gets(Description);

cout<<”Number :”;cin>>NoCandidate;

CALCNTR();

}

void TEST::DISPTEST()

{

cout<<”Test Code :”<<TestCode<<endl;

cout<<”Description :”<<Description<<endl;

cout<<”Number :”<<NoCandidate<<endl;;

cout<<”Centres :”<<CenterReqd<<endl;;

}

(1 Mark for correctly declaring Data Members)

(1 Mark for correctly defining CALCNTR())

( ½ Mark for correctly defining SCHEDULE())

( ½ Mark for calling CALCNTR() from SCHEDULE())

( ½ Mark for correctly defining DISPTEST())

( ½ Mark for correct syntax of class)

Page 201: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 201

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

4 class PUBLISHER

{

char Pub[12];

double Turnover;

protected:

void Register();

public:

PUBLISHER();

void Enter();

void Display();

};

class BRANCH

{

char CITY[20];

protected:

float Employees;

public:

BRANCH();

void Haveit();

void Giveit();

};

class AUTHOR:private BRANCH,public PUBLISHER

{

int Acode;

char Aname[20];

float Amount;

public:

AUTHOR();

void Start();

void Show();

};

(x) Write the names of data members, which are accessible from objects belonging to class

AUTHOR.

(xi) Write the names of all the member functions, which are accessible from objects belonging to

class BRANCH.

(xii) Write the names of all the members which are accessible from member functions of class

AUTHOR.

(xiii) How many bytes will be required by an object belonging to class AUTHOR? Answer:

(i) None of data members are accessible from objects belonging to class AUTHOR. (ii) Haveit(), Giveit() (iii)Data members: Employee, Acode, Aname, Amount Member function: Register(), Enter(), Display(), Haveit(), Giveit(), Start(), Show(), (iv) 70

( 1 Mark for each correct answer)

Note:

Page 202: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 202

No marks to be given for partial answers

3.

(a) 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.

4 Answer:

void AddNSave(int A[],int B[],int C[],int N,int M, int &K)

{

int I=0,J=M-1;

K=0;

while (I<N && J>=0)

{

if (A[I]<B[J])

C[K++]=A[I++];

else

if (A[I]>B[J])

C[K++]=B[J--];

else

{

C[K++]=A[I++];

J--;

}

}

for (int T=I;T<N;T++)

C[K++]=A[T];

for (T=J;T>=0;T--)

C[K++]=B[T];

}

( ½ Mark for function header with desired parameters)

( ½ Mark initialising counters)

(1 Mark for correct formation of loop)

(1 Mark for correct comparison of elements)

(1 Mark for transferring remaining elements in resultant array)

(f) 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. 4 Answer:

Given, W=2 N=40 M=30 Loc(S[15][5])=5500 Row Major Formula: Loc(S[I][J]) =Base(S)+W*(M*I+J) Loc(S[15][5]) =Base(S)+2*(30*15+5)

5500 =Base(S)+2*(450+5)

Page 203: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 203

Base(S) =5500- 910 Base(S) =4590 Loc(S[20][10]) =4590+2*(30*20+10) =4590+2*(600+10) =4590+1220 =5810

(1/2 Mark for correct formula/substitution of values in formula)

(1 ½ Mark for correctly calculating Base Address)

(2 Mark for correctly calculating address of desired location)

(g) Write a function in C++ to perform Insert operation in a dynamically allocated Queue containing

names of students.

4 Answer:

struct NODE

{

char Name[20];

NODE *Link;

};

class QUEUE

{

NODE *R,*F;

public:

QUEUE();

void Insert();

void Delete();

};

void QUEUE::Insert()

{

NODE *Temp;

Temp=new NODE;

gets(Temp->Name);

Temp->Link=NULL;

if (Rear==NULL)

{

Rear=Temp;

Front=Temp;

}

else

{

Rear->Link=Temp;

Rear=Temp;

}

}

( ½ Mark for appropriate function header)

( ½ Mark for declaring a Temporary pointer - TEMP)

(1 Mark for correct use of input/assignment of Temporary pointer- TEMP)

(1 Mark for checking FRONT as NULL and assigning REAR and FRONT as – TEMP) (1 Mark for

connecting TEMP to link part of REAR and assigning REAR as TEMP)

Page 204: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 204

(h) Write a function in C++ to find the sum of both left and right diagonal elements from a two

dimensional array (matrix).

2 Answer:

void DiagSum(int A[100][100],int N)

{

int SumD1=0,SumD2=0;

for (int I=0;I<N;I++)

{

SumD1+=A[I][I];SumD2+=A[N-I-1][I];

}

cout<<”Sum of Diagonal 1:”<<SumD1<<endl;

cout<<”Sum of Diagonal 2:”<<SumD2<<endl;

}

( ½ Mark for initialization of desired variables)

( ½ Mark for correct formation of loop)

( ½ Mark for statement to add left diagonal elements)

( ½ Mark for statement to add right diagonal elements)

(i) Evaluate the following postfix notation of expression:

2

20,30,+,50,40,-,* Answer:

Step 1: Push

20

Step 2: Push

30

20

Step 3: +

Push

Pop Pop

Op2=30 Op1=20

Op2=30

20 50

Step 4: Push

50

50

Step 5: Push

40

50

50

Page 205: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 205

Step 6: -

Push

Pop Pop

Op2=40 Op1=50

50 Op2=40 10

50 50 50

Step 7: *

Push

Pop Pop

Op2=10 Op1=50

Op2=10

50 500

Step 8: Pop

Result

500

( ½ Mark for showing stack position for each operation +,- and *)

( ½ Mark for correctly evaluating the final result)

Q4.

(a) Observe the program segment given below carefully and fill the blanks marked as Statement 1

and Statement 2 using seekp() and seekg() functions for performing the required task.

1

#include <fstream.h>

class Item

{

int Ino;char Item[20];

public:

//Function to search and display the content from a particular

//record number

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;

Page 206: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 206

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();

}

Answer:

File.seekg(RecNo*sizeof(Item)); //Statement 1

File.seekp(RecNo*sizeof(Item)); //Statement 2

( ½ Mark for each correct statement)

(b) Write a function in C++ to count the number of lines present in a text file

“STORY.TXT”.

2 Answer:

void CountLine()

{

ifstream FIL(“STORY.TXT”);

int LINES=0;

char STR[80];

while (FIL.getline(STR,80))

LINES++;

cout<<”No. of Lines:”<<LINES<<endl;

FIL.close();

}

( ½ mark for opening the file in ‘in’ mode)

( ½ mark for initializing the variable for counting lines to 0)

( ½ mark for reading each line)

( ½ mark for incrementing and displaying/returning value of variable)

(c) Write a function in C++ to search for a BookNo from a binary file “BOOK.DAT”, assuming the

binary file is containing the objects of the following class. 3

class BOOK

{

int Bno;

char Title[20];

public:

int RBno(){return Bno;}

void Enter(){cin>>Bno;gets(Title);}

void Display(){cout<<Bno<<Title<<endl;}

};

Answer:

void BookSearch()

Page 207: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 207

{

fstream FIL;

FIL.open(“BOOK.DAT”,ios::binary|ios::in);

BOOK B;

int bn,Found=0;

cout<<”Enter Book Num to search…”;

cin>>bn;

while (FIL.read((char*)&S,sizeof(S)))

if (B.RBno()==bn)

{

B.Display();

Found++;

}

if (Found==0) cout<<”Sorry! Book not found!!!”<<endl;

FIL.close();

}

( ½ mark for correct syntax of function header and body)

( ½ mark for opening the file in ‘in’ mode)

( ½ mark for reading content from file into the object of B)

( ½ mark for appropriate loop)

( ½ mark for correct condition for searching)

( ½ mark for displaying the content of the object)

Q5.

(a) What do you understand by Degree and Cardinality of a table?

2 Answer:

Degree of a table is total number of attributes. Cardinality of a table is total number of rows.

(1 mark for definition of Degree)

(1 mark for definition of Cardinality) (b) 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) 6

Table: ACTIVITY

ACode ActivityName ParticipantsNu

m

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

Page 208: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 208

2 Ravinder 1008

3 Janila 1001

4 Naaz 1003

(i) To display the name of all activities with their Acodes in descending order. Answer:

SELECT ActivityName, ACode FROM ACTIVITY ORDER BY Acode DESC;

( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of ORDER BY)

(ii) To display sum of PrizeMoney for each of the Number of participants groupings (as shown in

column ParticipantsNum 10,12,16) Answer:

SELECT SUM(PrizeMoney),ParticipantsNum FROM ACTIVITY GROUP BY

ParticipantsNum;

( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of GROUP BY)

(iii) To display the coach’s name and ACodes in ascending order of ACode from the table

COACH Answer:

SELECT Name, ACode FROM COACH ORDER BY ACode;

( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of ORDER BY)

(iv) To display the content of the ACTIVITY table whose ScheduleDate earlier than 01/01/2004 in

ascending order of ParticipantsNum. Answer:

SELECT * FROM ACTIVITY WHERE ScheduleDate<’01-Jan-2004’ ORDER BY

ParticipantsNum;

( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of ORDER BY)

(xiv) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY; Answer:

3

( ½ mark for correct output)

(vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY; Answer:

19-Mar-2004 12-Dec-2003

( ½ mark for correct output)

(vii) SELECT SUM(PrizeMoney) FROM ACTIVITY;

Page 209: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 209

Answer:

54000

( ½ mark for correct output)

(viii) SELECT DISTINCT ParticipantsNum FROM ACTIVITY; Answer:

16

10

12

( ½ mark for correct output)

Q6.

(a) State and verify Demorgan’s Laws.

2

Answer:

(X+Y)’ =X’.Y’ (X.Y)’ =X’+Y’

X Y X+Y (X+Y)’

X’ Y’ X’.Y’ X.Y (X.Y)’

X’+Y’

0 0 0 1 1 1 1 0 1 0

0 1 1 0 1 0 0 0 1 0

1 0 1 0 0 1 0 0 1 0

1 1 1 0 0 0 0 1 0 1

Verified

(1 mark for stating the correct law)

(1 mark for the appropriate verification using truth table OR algebraic method)

(b) Write the equivalent Boolean Expression for the following Logic Circuit

2

Answer:

F(P,Q)=(P’+Q).(P+Q’)

P

Q

Page 210: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 210

(Full 2 marks for obtaining the correct Boolean Expression for the Logic Circuit)

OR

(1 mark correctly interpreting SUM terms)

(r) Write the POS form of a Boolean function F, which is represented in a truth table as follows:

1

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

Answer:

F(U,V,W) = (U+V+W’).(U+V’+W’).(U’+V+W’)

(1 mark for correct POS representation)

(s) Reduce the following Boolean Expression using K-Map:

3

F(A,B,C,D)=ΣΣΣΣ(0,1,2,4,5,6,8,10)

Answer:

A’B’ A’B AB AB’

C’D’ 1 0

1 4

12

1 8

C’D 1 1

1 5

13

9

CD 3

7

15

11

CD’ 1 2

1 6

14

1 10

F(A,B,C,D)=A’C’+A’D’+B’D’

(1 mark for correctly drawing K-Map with 1s represented on right places)

(1 mark for minimizing each Quad)

(1 mark for writing the complete Boolean Expression)

Q7. e) What is the significance of ARPANET in the network? 1

Answer:

The first evolution of network was jointly designed by The Advanced Research Projects Agency (ARPA) and Department of Defence (DoD) in 1969 and was called ARPANET. It was an experimental project, which connected a few computers of some of the reputed universities of USA and DoD. ARPANET allowed access and use of computer resource sharing projects. Later Defence Data Network (DDN) was born in 1983.

Page 211: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 211

(1 marks for mentioning the significance correctly) f) Expand the following terminologies:

1

(i) CDMA (ii) GSM Answer:

(i) Code Division Multiple Access (ii) Global System for Mobile Communication

(½ mark each expansion)

g) Give two major reasons to have network security. 1 Answer:

Two major reasons to have Network Security are

(i) Secrecy: Keeping information out of the reach of unauthorized users. (ii) Authentication: Determining the authorized user before sharing sensitive information with or entering into a business deal.

(½ mark for each appropriate reasons)

h) What is the purpose of using a Web Browser? Name any one commonly used Web Browser.

1 Answer: The Web Browser fetches the page requested, interprets the text and formatting commands that it contains, and displays the page properly formatted on the screen.

Example of a Web Browser:

Mozilla Firefox OR Internet Explorer OR Netscape Navigator OR Safari OR OPERA

(½ mark for mentioning purpose of using a Web Browser)

(½ mark for Example of a Web Browser)

e) Knowledge Supplement Organisation has set up its new center at Mangalore for its office and web based

activities. It has 4 blocks of buildings as shown in the diagram below:

Center to center distances between various blocks

Black A to Block B 50 m

Block B to Block C 150 m

Block C to Block D 25 m

Block A to Block D 170 m

Block B to Block D 125 m

Block A to Block C 90 m

Block A

Block C

Block B

Block D

Page 212: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 212

Number of Computers

Black A 25

Block B 50

Block C 125

Block D 10

e1) Suggest a cable layout of connections between the blocks. 1

Answer: (Any of the following option) Layout Option 1: Layout Option 2: Since the distance between Block A and Block B is quite short

(1 mark for any of the above shown Layout)

e2) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable

reason. 1 Answer:

The most suitable place / block to house the server of this organisation would be Block C, as this block contains the maximum number of computers, thus decreasing the cabling cost for most of the computers as well as increasing the efficiency of the maximum computers in the network.

( ½ mark for mentioning the correct block)

( ½ mark for reason)

e3) Suggest the placement of the following devices with justification 1

(v) Repeater

(vi) Hub/Switch

Block A

Block C

Block B

Block D

Block A

Block C

Block B

Block D

Page 213: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 213

Answer:

(i) For Layout 1, since the cabling distance between Blocks A and C, and that between B and C are quite large, so a repeater each, would ideally be needed along their path to avoid loss of signals during the course of data flow in these routes.

For layout 2, since the distance between Blocks A and C is large so a repeater would ideally be placed in between this path

(1 mark for showing correct placement of repeater)

(ii) In both the layouts, a hub/switch each would be needed in all the blocks, to interconnect the group of cables from the different computers in each block

Layout 1

Block A

Block C

Block B

Block D

Repeate

Repeate

Block A

Block C

Block B

Block D

Repeate

Block A

Block C

Block B

Block D

Repeate

Repeate

Hub Hub

Hub Hub

Page 214: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 214

Layout 2

(1 mark for showing correct placement of hub) e4) The organization is planning to link its front office situated in the city in a hilly region where cable

connection is not feasible, suggest an economic way to connect it with reasonably high speed?

1

Answer:

The most economic way to connect it with a reasonable high speed would be to use radio wave transmission, as they are easy to install, can travel long distances, and penetrate buildings easily, so they are widely used for communication, both indoors and outdoors. Radio waves also have the advantage of being omni directional, which is they can travel in all the directions from the source, so that the transmitter and receiver do not have to be carefully aligned physically.

(1 mark for suggesting the appropriate economic way)

Computer Science (Code 083)

Sample Paper Set –II

Max. Marks: 70

Duration: 3 Hours 1.

(a) What is the difference between Object Oriented Programming and Procedural Programming?

2 (f) Write the names of the header files to which the following belong: 1

(i) frexp() (ii) isalnum()

(g) Rewrite the following program after removing the syntactical errors (if any). Underline each

correction.

2

#include <iostream.h>

struct Pixels

{ int Color,Style;}

void ShowPoint(Pixels P)

{ cout<<P.Color,P.Style<<endl;}

void main()

Block A

Block C

Block B

Block D

RepeateHub Hub

Hub

Hub

Page 215: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 215

{

Pixels Point1=(5,3);

ShowPoint(Point1);

Pixels Point2=Point1;

Color.Point1+=2;

ShowPoint(Point2);

}

(d) Find the output of the following program:

3

#include <iostream.h>

void Changethecontent(int Arr[], int Count)

{

for (int C=1;C<Count;C++)

Arr[C-1]+=Arr[C];

}

void main()

{

int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200};

Changethecontent(A,3);

Changethecontent(B,4);

Changethecontent(C,2);

for (int L=0;L<3;L++) cout<<A[L]<<’#’;

cout<<endl;

for (L=0;L<4;L++) cout<<B[L] <<’#’;

cout<<endl;

for (L=0;L<2;L++) cout<<C[L] <<’#’;

}

(e) Find the output of the following program:

2

#include <iostream.h>

struct Game

{

char Magic[20];int Score;

};

void main()

{

Game M={“Tiger”,500};

char *Choice;

Choice=M.Magic;

Choice[4]=’P’;

Choice[2]=’L’;

M.Score+=50;

cout<<M.Magic<<M.Score<<endl;

Game N=M;

N.Magic[0]=’A’;N.Magic[3]=’J’;

N.Score-=120;

cout<<N.Magic<<N.Score<<endl;

}

Page 216: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 216

(h) In the following program, if the value of N given by the user is 20, what maximum and minimum

values the program could possibly display? 2

#include <iostream.h>

#include <stdlib.h>

void main()

{

int N,Guessnum;

randomize();

cin>>N;

Guessnum=random(N-10)+10;

cout<<Guessnum<<endl;

}

2.

(d) What do you understand by Polymorphism? Give a suitable example of the same. 2

(e) Answer the questions (i) and (ii) after going through the following program: 2 class Match

{

int Time;

public:

Match() //Function 1

{

Time=0;

cout<<”Match commences”<<end1;

}

void Details() //Function 2

{

cout<<”Inter Section Basketball Match”<<end1;

}

Match(int Duration) //Function 3

{

Time=Duration;

cout<<”Another Match begins now”<<end1;

}

Match(Match &M) //Function 4

{

Time=M.Duration;

cout<<”Like Previous Match ”<<end1;

}

};

v) Which category of constructor - Function 4 belongs to and what is the purpose of using it?

vi) Write statements that would call the member Functions 1 and 3

(b) Define a class in C++ with following description:

4

Private Members

• A data member Flight number of type integer

• A data member Destination of type string

Page 217: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 217

• 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

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

4 class CUSTOMER

{

int Cust_no;

char Cust_Name[20];

protected:

void Register();

public:

CUSTOMER();

void Status();

};

class SALESMAN

{

int Salesman_no;

char Salesman_Name[20];

protected:

float Salary;

public:

SALESMAN();

void Enter();

void Show();

};

class SHOP : private CUSTOMER , public SALESMAN

{

char Voucher_No[10];

char Sales_Date[8];

public:

SHOP();

void Sales_Entry();

void Sales_Detail();

};

(xv) Write the names of data members which are accessible from objects belonging to class

CUSTOMER.

(xvi) Write the names of all the member functions which are accessible from objects belonging to

class SALESMAN.

(xvii) Write the names of all the members which are accessible from member functions of class

SHOP.

Page 218: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 218

(xviii) How many bytes will be required by an object belonging to class SHOP?

3.

(a) Write a function in C++ to combine the contents of two equi-sized arrays A and B by computing

their corresponding elements with the formula 2*A[i]+3*B[i]; where value i varies from 0 to N-1

and transfer the resultant content in the third same sized array.

4

(j) 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. 4

(k) Write a function in C++ to perform Push operation on a dynamically allocated Stack containing

real numbers.

4

(l) Write a function in C++ to find sum of rows from a two dimensional array. 2

(m)Evaluate the following postfix notation of expression:

2

True, False, AND, True, True, NOT, OR, AND 4.

(a) 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. 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

int Bytes = ______________________

//Statement 2

int Count = Bytes / sizeof(Item);

File.close();

return Count;

}

Page 219: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 219

(b) Write a function in C++ to count the number of alphabets present in a text file “NOTES.TXT”.

2

(b) Write a function in C++ to add new objects at the bottom of a binary file “STUDENT.DAT”,

assuming the binary file is containing the objects of the following class.

3

class STUD

{

int Rno;

char Name[20];

public:

void Enter(){cin>>Rno;gets(Name);}

void Display(){cout<<Rno<<Name<<endl;}

};

void Addnew()

{

fstream FIL;

FIL.open(“STUDENT.DAT”,ios::binary|ios::app);

STUD S;

char CH;

do

{

S.Enter();

FIL.write((char*)&S,sizeof(S));

cout<<”More(Y/N)?”;cin>>CH;

}

while(CH!=’Y’);

FIL.close();

}

5.

(a) What do you understand by Primary Key & Candidate Keys?

2

(b) 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) 6

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

Page 220: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 220

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)

(xix) 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;

6.

(a) State and algebraically verify Absorbtion Laws.

2

(b) Write the equivalent Boolean Expression for the following Logic Circuit

2

(t) Write the SOP form of a Boolean function G, which is represented in a truth table as follows:

1

P Q R G

0 0 0 0

0 0 1 0

0 1 0 1

0 1 1 0

U

V

Page 221: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 221

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 1

(u) Reduce the following Boolean Expression using K-Map:

3

F(U,V,W,Z)=ΠΠΠΠ(0,1,2,4,5,6,8,10)

7. a) Define the term Bandwidth. Give unit of Bandwidth. 1 b) Expand the following terminologies:

1 (i) HTML (ii) XML

c) Define the term firewall.

1 d) What is the importance of URL in networking?

1

e) 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:

Center to center distances between various buildings is as follows:

Harsh Building to Raj Building 50 m

Raz Building to Fazz Building 60 m

Fazz Building to Jazz Building 25 m

Jazz Building to Harsh Building 170 m

Harsh Building to Fazz Building 125 m

Raj Building to Jazz Building 90 m

Number of Computers in each of the buildings is follows:

Harsh Building 15

Raj Building 150

Fazz Building 15

Jazz Bulding 25

e1) Suggest a cable layout of connections between the buildings. 1 e2) Suggest the most suitable place (i.e. building) to house the server of this organisation with a suitable

reason. 1

Raj Building

Fazz Building

Harsh Building

Jazz Building

Page 222: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 222

e3) Suggest the placement of the following devices with justification: 1

(i) Internet Connecting Device/Modem

(ii) Switch

e4) 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. 1

Computer Science (Code 083)

Sample Paper with Solution Set –II

Max. Marks: 70

Duration: 3 Hours 1.

(a) What is the difference between Object Oriented Programming and Procedural Programming?

2

Answer:

Object Oriented Programming Procedural Programming

• Emphasis on Data

• Follows Bottom-Up approach in program design

• Data hiding feature prevents accidental change in data

• Features like data encapsulation, polymorphism, inheritance are present

• Emphasis on doing things (functions)

• Follows Top-down approach in program design

• Presence of Global variables increase chances of accidental change in data

• Such features are not available

(1/2 Mark for each point of difference – to maximum of 2 marks)

(h) Write the names of the header files to which the following belong: 1

(i) frexp() (ii) isalnum() Answer:

(i) math.h (ii) ctype.h

(1/2 Mark for mentioning name of each header file)

(i) Rewrite the following program after removing the syntactical errors (if any). Underline each

correction.

2

#include <iostream.h>

struct Pixels

{ int Color,Style;}

void ShowPoint(Pixels P)

Page 223: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 223

{ cout<<P.Color,P.Style<<endl;}

void main()

{

Pixels Point1=(5,3);

ShowPoint(Point1);

Pixels Point2=Point1;

Color.Point1+=2;

ShowPoint(Point2);

}

Answer:

#include <iostream.h>

struct Pixels

{ int Color,Style;};

void ShowPoint(Pixels P)

{ cout<<P.Color<<P.Style<<endl;}

void main()

{

Pixels Point1={5,3};

ShowPoint(Point1);

Pixels Point2=Point1;

Point1.Color+=2;

ShowPoint(Point2);

}

(1/2 Mark for correcting each error) OR (1 Mark for identifying all the 4 errors with no correction)

(d) Find the output of the following program:

3 #include <iostream.h>

void Changethecontent(int Arr[], int Count)

{

for (int C=1;C<Count;C++)

Arr[C-1]+=Arr[C];

}

void main()

{

int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200};

Changethecontent(A,3);

Changethecontent(B,4);

Changethecontent(C,2);

for (int L=0;L<3;L++) cout<<A[L]<<’#’;

cout<<endl;

for (L=0;L<4;L++) cout<<B[L] <<’#’;

cout<<endl;

for (L=0;L<2;L++) cout<<C[L] <<’#’;

}

Answer:

7#9#5# 30#50#70#40# 2100#1200#

(1 Mark for each correct line of output)

Page 224: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 224

Note:

Deduct ½ Mark for not showing : in the output

Deduct ½ Mark for not considering endl

(e) Find the output of the following program:

2 #include <iostream.h>

struct Game

{

char Magic[20];int Score;

};

void main()

{

Game M={“Tiger”,500};

char *Choice;

Choice=M.Magic;

Choice[4]=’P’;

Choice[2]=’L’;

M.Score+=50;

cout<<M.Magic<<M.Score<<endl;

Game N=M;

N.Magic[0]=’A’;N.Magic[3]=’J’;

N.Score-=120;

cout<<N.Magic<<N.Score<<endl;

}

Answer:

TiLeP550 AiLJP430

(1 Mark for each line of output)

(i) In the following program, if the value of N given by the user is 20, what maximum and minimum

values the program could possibly display? 2

#include <iostream.h>

#include <stdlib.h>

void main()

{

int N,Guessnum;

randomize();

cin>>N;

Guessnum=random(N-10)+10;

cout<<Guessnum<<endl;

}

Answer:

Maximum Value: 19 Minimum Value: 10

(1 Mark for writing correct minimum value)

(1 Mark for writing correct maximum value)

2.

(a) What do you understand by Polymorphism? Give a suitable example of the same. 2

Page 225: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 225

Answer:

Polymorphism: It is a method of using the same operator or function (method) to work using different sets of input. Function overloading is one of the example of polymorphism, where more than one function carrying same name behave differently with different set of parameters passed to them. void Display() { cout<<”Hello!”<<endl; } void Display(int N) { cout<<2*N+5<<endl; }

(1 Mark for definition)

(1 Mark for example)

OR

(Full 2 marks for explaining both with the help of an example)

(f) Answer the questions (i) and (ii) after going through the following program: 2

class Match

{

int Time;

public:

Match() //Function 1

{

Time=0;

cout<<”Match commences”<<end1;

}

void Details() //Function 2

{

cout<<”Inter Section Basketball Match”<<end1;

}

Match(int Duration) //Function 3

{

Time=Duration;

cout<<”Another Match begins now”<<end1;

}

Match(Match &M) //Function 4

{

Time=M.Duration;

cout<<”Like Previous Match ”<<end1;

}

};

vii) Which category of constructor - Function 4 belongs to and what is the purpose of using it? Answer:

Page 226: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 226

Copy Constructor, it is invoked when an object is created and initialised with values of an already existing object.

( ½ Mark for mentioning “Constructor”)

( ½ Mark for correctly answering to remaining part of the question)

viii) Write statements that would call the member Functions 1 and 3 Answer:

Match M1; //for Function 1 Match M2(90); //for Function 3

( ½ Mark for each example)

(d) Define a class in C++ with following description:

4

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 Answer:

class FLIGHT

{

int Fno;

char Destination[20];

float Distance, Fuel;

void CALFUEL();

public:

void FEEDINFO();

void SHOWINFO();

};

void FLIGHT::CALFUEL()

{

if (Distance<1000)

Fuel=500;

else

if (Distance<2000)

Fuel=1100;

else

Fuel=2200;

Page 227: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 227

}

void FLIGHT::FEEDINFO()

{

cout<<”Flight No :”;cin>>Fno;

cout<<”Destination :”;gets(Destination);

cout<<”Distance :”;cin>>Distance;

CALFUEL();

}

void FLIGHT::SHOWINFO()

{

cout<<”Flight No :”<<Fno<<endl;

cout<<”Destination :”<<Destination<<endl;

cout<<”Distance :”<<Distance<<endl;;

cout<<”Fuel :”<<Fuel<<endl;;

}

(1 Mark for correctly declaring Data Members)

(1 Mark for correctly defining CALFUEL())

( ½ Mark for correctly defining FEEDINFO())

( ½ Mark for calling CALFUEL() from FEEDINFO())

( ½ Mark for correctly defining SHOWINFO())

( ½ Mark for correct syntax of class)

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

4 class CUSTOMER

{

int Cust_no;

char Cust_Name[20];

protected:

void Register();

public:

CUSTOMER();

void Status();

};

class SALESMAN

{

int Salesman_no;

char Salesman_Name[20];

protected:

float Salary;

public:

SALESMAN();

void Enter();

void Show();

};

class SHOP : private CUSTOMER , public SALESMAN

{

char Voucher_No[10];

char Sales_Date[8];

public:

SHOP();

Page 228: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 228

void Sales_Entry();

void Sales_Detail();

};

(xx) Write the names of data members which are accessible from objects belonging to class

CUSTOMER.

(xxi) Write the names of all the member functions which are accessible from objects belonging to

class SALESMAN.

(xxii) Write the names of all the members which are accessible from member functions of class

SHOP.

(xxiii) How many bytes will be required by an object belonging to class SHOP? Answer:

(iv) None of data members are accessible from objects belonging to class CUSTOMER. (v) Enter(), Show() (vi) Data members: Voucher_No, Sales_Date, Salary Member function: Sales_Entry(), Sales_Details(), Enter(), Show(), Register(), Status() (iv) 66

( 1 Mark for each correct answer)

Note:

No marks to be given for partial answers

3.

(a) Write a function in C++ to combine the contents of two equi-sized arrays A and B by computing

their corresponding elements with the formula 2*A[i]+3*B[i]; where value i varies from 0 to N-1

and transfer the resultant content in the third same sized array.

4 Answer:

void AddNSave(int A[],int B[],int C[],int N) { for (int i=0;i<N;i++) C[i]=2*A[i]+3*B[i]; }

(1 Mark for function header with desired parameters)

(1 Mark for correct formation of loop)

(1 Mark for the formula)

(1 Mark for transferring elements in the resultant array)

(n) 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. 4 Answer:

Given, W=4 N=20 M=30 Loc(P[2][20])=5000 Column Major Formula: Loc(P[I][J]) =Base(P)+W*(N*J+I) Loc(P[2][20]) =Base(P)+4*(20*20+2)

Page 229: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 229

5000 =Base(P)+4*(400+2) Base(P) =5000- 1608 Base(P) =3392 Loc(P[5][15]) =3392+4*(20*15+5) =3392+4*(300+5) =3392+1220 =4612

(1/2 Mark for correct formula/substitution of values in formula)

(1 ½ Mark for correctly calculating Base Address)

(2 Mark for correctly calculating address of desired location)

(o) Write a function in C++ to perform Push operation on a dynamically allocated Stack containing

real numbers.

4 Answer:

struct NODE

{

float Data; NODE *Link;

};

class STACK

{

NODE *Top;

public:

STACK();

void Push();

void Pop();

};

void STACK::Push()

{

NODE *Temp;

Temp=new NODE;

cin>>Temp->Data;

Temp->Link=Top;

Top=Temp;

}

( ½ Mark for appropriate function header)

( ½ Mark for declaring a Temporary pointer - TEMP)

(1 Mark for new operation)

(1 Mark for Temp->Link to Top)

(1 Mark for assigning Top as Temp)

(p) Write a function in C++ to find sum of rows from a two dimensional array. 2 Answer:

void MatAdd(int A[100][100],int N,int M)

{ for (int R=0;R<N;R++)

{ int SumR=0;

for (int C=0;C<M;C++)

SumR+=A[C][R];

cout<<SumR<<endl;

}

}

Page 230: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 230

( ½ Mark for initialization of desired variables)

(1 Mark for loops)

( ½ Mark for statement to add rows elements)

(q) Evaluate the following postfix notation of expression: 2

True, False, AND, True, True, NOT, OR, AND Answer:

Step 1: Push

True

Step 2: Push

False

True

Step 3: AND

Push

Pop Pop

Op2=Tru

e

Op1=Fals

e

Op2=Tru

e

True False

Step 4: Push

True

False

Step 5: Push

True

True

False

Step 6: NOT Push

Pop

Op2=Tru

e

False

True True

False False

Step 7: OR

Push

Pop Pop

Op2=Fals

e

Op1=Tru

e

True Op2=Fals

e

True

False False False

Page 231: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 231

Step 8: AND

Push

Pop Pop

Op2=Tru

e

Op1=Fals

e

Op2=Tru

e

False False

Step 9: Pop

Result

False

( 1½ Mark for showing stack position for operations NOT,OR and AND)

( ½ Mark for correctly evaluating the final result) 4.

(a) 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. 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

int Bytes = ______________________

//Statement 2

int Count = Bytes / sizeof(Item);

File.close();

return Count;

}

Answer:

File.seekg(0,ios::end); //Statement 1

File.tellg(); //Statement 2

( ½ Mark for each correct statement)

Page 232: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 232

(b) Write a function in C++ to count the number of alphabets present in a text file “NOTES.TXT”.

2 Answer:

void CountAlphabet()

{

ifstream FIL(“NOTES.TXT”);

int CALPHA=0;

char CH=FIL.get();

while (!FIL.eof())

{

if (isalpha(CH)) CALPHA++;

CH=FIL.get();

}

cout<<”No. of Alphabets:”<<CALPHA<<endl;

FIL.close();

}

( ½ mark for opening the file in ‘in’ mode)

( ½ mark for correct use of eof)

( ½ mark for reading each character)

( ½ mark for correct increment)

(c) Write a function in C++ to add new objects at the bottom of a binary file “STUDENT.DAT”,

assuming the binary file is containing the objects of the following class.

3

class STUD

{

int Rno;

char Name[20];

public:

void Enter(){cin>>Rno;gets(Name);}

void Display(){cout<<Rno<<Name<<endl;}

}; Answer:

void Addnew()

{

fstream FIL;

FIL.open(“STUDENT.DAT”,ios::binary|ios::app);

STUD S;

char CH;

do

{

S.Enter();

FIL.write((char*)&S,sizeof(S));

cout<<”More(Y/N)?”;cin>>CH;

}

while(CH!=’Y’);

FIL.close();

}

Page 233: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 233

( ½ mark for opening the file in ‘app’ mode)

( ½ mark for declaration of desired variables)

( ½ mark for calling the member function Enter correctly)

( 1 mark for writing the content of object to the binary file)

( ½ mark for forming the appropriate loop)

5.

(a) What do you understand by Primary Key & Candidate Keys?

2 Answer:

An attribute or set attributes which are used to identify a tuple uniquely is known as Primary Key. If a table has more than one such attributes which identify a tuple uniquely than all such attributes are known as Candidate Keys.

(b) 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) 6

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 Answer:

SELECT GameName,Gcode FROM GAMES;

(1 mark for correct SELECTion of columns)

(ii) To display details of those games which are having PrizeMoney more than 7000. Answer:

SELECT * FROM GAMES WHERE PrizeMoney>7000 ( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of WHERE)

(iii)To display the content of the GAMES table in ascending order of ScheduleDate. Answer:

SELECT * FROM GAMES ORDER BY ScheduleDate;

( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of ORDER BY)

Page 234: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 234

(vii) To display sum of PrizeMoney for each of the Number of participation groupings (as

shown in column Number 2 or 4) Answer:

SELECT SUM(PrizeMoney),Number FROM GAMES GROUP BY Number;

( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of GROUP BY)

(viii) SELECT COUNT(DISTINCT Number) FROM GAMES; Answer:

2

( ½ mark for correct output)

(vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES; Answer:

19-Mar-2004 12-Dec-2003

( ½ mark for correct output)

(vii) SELECT SUM(PrizeMoney) FROM GAMES; Answer:

59000

( ½ mark for correct output)

(viii) SELECT DISTINCT Gcode FROM PLAYER; Answer:

101

103

108

( ½ mark for correct output)

6.

(a) State and algebraically verify Absorbtion Laws.

2 Answer:

X+X.Y = X L.H.S = X+X.Y = X.1+X.Y = X.(1+Y) = X.1 = X = R.H.S X+X’.Y = X+Y L.H.S. = X+X’.Y = (X+X’).(X+Y) = 1.(X+Y) = X+Y = R.H.S

(1 mark for stating the correct law)

(1 mark for the appropriate verification using algebraic method)

Page 235: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 235

(b) Write the equivalent Boolean Expression for the following Logic Circuit

2

Answer:

F(U,V)=U’.V+U.V’

(Full 2 marks for obtaining the correct Boolean Expression for the Logic Circuit)

OR

(1 mark correctly interpreting Product terms)

(v) Write the SOP form of a Boolean function G, which is represented in a truth table as follows:

1 Answer:

P Q R G

0 0 0 0

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

G(P,Q,R) = P’.Q.R’+P.Q’.R’+P.Q.R’+P.Q.R

(1 mark for correct SOP representation)

(w) Reduce the following Boolean Expression using K-Map:

3

F(U,V,W,Z)=ΠΠΠΠ(0,1,2,4,5,6,8,10) Answer:

U’V’ U’V UV UV’

W’Z’ 0

4

1 12

8

W’Z 1

5

1 13

1 9

WZ 1 3

1 7

1 15

1 11

WZ’ 2

6

1 14

10

F(U,V,W,Z)=UV+WZ+UZ

U

V

Page 236: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 236

(1 mark for correctly drawing K-Map with 1s represented on right places)

(1 mark for minimizing each Quad)

(1 mark for writing the complete Boolean Expression)

7. b) Define the term Bandwidth. Give unit of Bandwidth. 1 Answer:

Bandwidth is the capability of a medium to transmit an amount of information over a distance. Bandwidth of a medium is generally measured in bits per second (bps) or more commonly in kilobits per second (kbps)

( ½ Mark for correct definition and ½ Mark for correct unit) b) Expand the following terminologies:

1 (i) HTML (ii) XML

Answer:

(i) Hypertext Markup Language (ii) Extended Markup Language

( ½ Mark for each correct expansion)

e) Define the term firewall.

1 Answer:

Firewall is a feature used for Network Security. In a Network there is always danger of information leaking out or leaking in. Firewall is a feature which forces all information entering or leaving the network to pass through a check to make sure that there is no unauthorized usage of the network.

(1 Mark for correct definition)

f) What is the importance of URL in networking?

1 Answer:

URL stands for Uniform Resource Locator. Each page that is created for Web browsing is assigned a URL that effectively serves as the page’s worldwide name or address. URL’s have three parts: the protocol , the DNS name of the machine on which the page is located and a local name uniquely indicating the specific page(generally the filename).

(1 Mark for correct significance)

e) 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:

Raj Building

Fazz Building

Harsh Building

Jazz Building

Page 237: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 237

Center to center distances between various buildings is as follows:

Harsh Building to Raj Building 50 m

Raz Building to Fazz Building 60 m

Fazz Building to Jazz Building 25 m

Jazz Building to Harsh Building 170 m

Harsh Building to Fazz Building 125 m

Raj Building to Jazz Building 90 m

Number of Computers in each of the buildings is follows:

Harsh Building 15

Raj Building 150

Fazz Building 15

Jazz Bulding 25

e1) Suggest a cable layout of connections between the buildings. 1 Answer:

Layout 1:

Layout 2: Since the distance between Fazz Building and Jazz Building is quite short

(1 Mark for appropriate layout)

e2) Suggest the most suitable place (i.e. building) to house the server of this organisation with a suitable

reason. 1

Answer:

The most suitable place / block to house the server of this organisation would be Raj Building, as this block contains the maximum number of computers, thus decreasing the cabling cost for most of the computers as well as increasing the efficiency of the maximum computers in the network.

(1 mark for correct placement) e3) Suggest the placement of the following devices with justification: 1

(iii) Internet Connecting Device/Modem

(iv) Switch

Answer:

(i) Raj Building (ii) In both the layouts, a hub/switch each would be needed in all the buildings, to interconnect the group

of cables from the different computers in each block

( ½ Mark for placement of each device correctly)

Raj Building

Fazz Building

Harsh Building

Jazz Building

Raj Building

Fazz Building

Harsh Building

Jazz Building

Page 238: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 238

e4) 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. 1

Answer: The type of network that shall be formed to link the sale counters situated in various parts of the same city would be a MAN, because MAN (Metropolitan Area Networks) are the networks that link computer facilities within a city.

( ½ mark for correct type and ½ mark for correct justification)

List of Projects with detailed specification XI CS

Bhoopendra Navadya

PGT – Comp. Sc.

KV, Basti

No. 1. Matrix Calculator

This project perform various operations on matrix for example 1. Calculate the addition of matrixes 2. Calculate the subtraction of matrixes 3. Perform transform of matrix 4. Calculate the degree of matrix And various task related to matrixes.

No. 2. Banking: This project is used to computerize the all working in a Bank. With the help of this project we can various tasks that are done by manual till now. The project perform the following activates.

• You can create account in bank through computer.

• Manage your account.

• Withdraw

• Deposit

• Check processing

• Information about account holders

• Generate bank statements . This project increases the efficiency of manual system in bank.

No. 3. Telephone billing system: This project is used by Telephone Company to automate the billing system. With the help of this project we can perform various tasks. These tasks are as follows:

• Create account for the different customers: create account for customers to keep records related to various information about the customer for examples registration no, customer name, address and telephone no various information. Also perform addition, modifications and deletion and display of these records.

• Generate bill to the different customers (Rural and Urban): in this section generate bill and also perform modification on this bill.

No. 4. Hotel management system: This project is developed for the hotels to computerize their manual system. This project perform the following function:

• Function for displaying food menu.

• Function for modify (append, delete) the food information

Page 239: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 239

• Function for information about hotel(availability of rooms according to the customers need (A/C room, luxury, double bad, single bad etc)

• Function for generate food and room bill

• Function for handling information about customers (insert, append, delete)

List of Projects with detailed specification XII CS

Kavita

PGT – Comp. Sc.

KV, Rewari

Computer Science C++ Project on Hotel Management for CBSE Class 12

Synopsis of Hotel Management Project In this project that is hospital MANAGEMENT SYSTEM prepared, we are dealing with the concept of the generation of the room status, billing detail status of various patients in the hospital. This system is based on the admission of patients into the hospital. This is principally and solely a final bill generation utility and is a Post Transaction System. This means, that the transaction being fed into the System, have already been executed. We start with the authentication of user for the security purpose. The next step is to enter the record of the patients and then we proceed to renter his room no, ward no and other details. After the medicine and nursing details, and doctors details are recorded, the automated system automatically posts each record to their respective heads. This software records daily expenses incurred on the patient details in form of TRANSACTION ENTRY, classifies these transactions to the respective heads automatically, summarize these transactions in the form of various expenses heads. Beside all these basic requirements of hospital billing it also generates the reports like annual result which is useful to take annual decisions and is helpful to analyze the recovery of the concerned patient. The concerned hospital is one of the premire in providing excellent healthcare and nursing services in areas like mumbai and delhi and is a fast growing hospital organisation with technical tie up from USA, UK, Australia & Germany for providing latest industry related treatments. It maintains excellent rapport and provides fine treatment to its patients. OBJECTIVE OF THE PROJECT The set of the objectives that the software caters to are as stated below:

Electronically handling of patient admission detailsϖ to enhance the accuracy, flexibility, reliability and to remove the human errors.

To permit the indiscipline of entering records at random andϖ to permit easy retrieval of any information.

To provide the accurateϖ information about the patient room no ,modified details,result on the basis of rollno to provide online informationand deletion of records

To keepϖ track of fail students .

To provide annual result cardϖ

To provideϖ the efficient, accurate, reliable, fast, and robust structure that can handle any number of students transactions. DATA FLOW DIAGRAMS (DFDs) ANALYSIS (DFD’S)

Page 240: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 240

A Data Flow Diagram is a tool that traces the flow of data in a system. The Data Flow Diagram is made up of a set of four symbols called as the external entities, data stores, data flows and the processes. The zero level data flow diagram also popularly called as the context level data flow diagram is depicted below for our software.

Library management This project is different from the other projects we have listed in this site. We want you to do the project yourself this time. We will provide you the architecture and design of the project. You have to follow the guidelines and do the development yourself. We believe this is the best training we can provide you. Languages Since you are doing the development yourself, you can choose development language which is most comfortable for you. C# or VB.NET will equally fit for this project. You can choose MS Access or SQL Server as the database backend. Project Requirement study and documentation Let us start with the requirement stage of the project. This is a very critical stage for developing any project. The first step for a developer in any project is to understand the requirements. Communication with customer is very important in this stage. You must communicate with customer as much as possible and document all requirements. It is strongly reccommdended to have a direct, in person communication with the customer to get a feel of his expectations. Some customers may have lot of suggestions, some of them don't even really know what they want. Some customers may simply say 'I want a Library Management System', but they may not even know what kind of features they want in the product. In such cases, you must be able to suggest the features to the customer and let them understand those features before you develop it. Some customers may come up with really stupid ideas. They want to do everything by the computer. It is very critical to make them clearly understand what can be done by the computer and what is not. Some tasks may be very easy for a human to do, but very difficult for a computer. You should not promise a customer something that a computer cannot perform progrmmatically. Some customers may be too smart. They will tell you exactly what they want. And your job would be easier in this case. In all cases, the most important thing is documenting all requirements and getting approval by the customer. Talk to the customer about requirements Document all requirements in a piece of paper or in a word document Send the requirements document to the customer for his review Revise the document based on the customer review and suggestions Get the final approval and signature of the customer on the Requirements Specification Library Management System requirements Let us define the requirements for our Library Management System (LMS): Requirements This software will allow members to register Only registered members will be allowed to lend an item from the system

Page 241: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 241

User can add items (Books, CD etc) to the system System will allow searching for items in the system based on Author name, book name, user name etc Non requirements System will not enforce any security. Anybody who have access to the computer will be able to access this software and perform any operations. There will be no login/password required to access this software. System will not generate any alerts if a member is not returning any items System will not maintain any inventory. System doesn't keep track of damaged items. Users have to manually replace the damaged items with new ones. System will not handle data security and backup. Users have depend on some external or manual backup mechanism to take data backup whenever required. Design phase After completing the requirement study and documentation, it is time to design the software based on the requirements. It is easy to start coding without any design and you may end up developing a product which your customer like. But it may not be easy to maintain. Customers may keep changing their mind. Only after seeing the product, they may say 'we want this to behave in a different way'. And it is very hard to say 'NO' to a customer. First step is identifying all the features you are going to implement in the software. The requirements document is a good guide in identifying the features. According to the requirements specification, we need to develop the following features in the system: Registration Item Management Lending Search for Books Search for Members

List of Projects with detailed specification XI IP

Ashish Kr. Joshi

PGT – Comp. Sc.

KV No.1, Chakeri, Kanpur

Students in group of 2-3 are required to work collaboratively to develop a project using Programming and Database skills learnt during the course. The project should be an application with GUI front-end based on any one of the following domains e-Governance, e-Business and e-Learning 5 Marks.

1 Customer Database Management System The following case study is to be used to develop a team project. A cable company in Delhi is working since 1998. They have about 2 Lac customers in different zones (North, South, East, and West). Company wants to computerize its working which involves Customer Registration, Customer Billing, and Bill Collection on monthly, Develop a Database Handling Software for the company. The software should have option to enter customer data and information of bill collection. The software should allow to store following information of customer and billing

Customer Name Customer Address Customer City

Page 242: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 242

Customer Zone Customer Pin Code Customer Phone Customer Interest (Movies, Games etc) Customer Monthly Income Customer Monthly Installment Customer Joining Date Bill Cycle Bill Collection Date

(Suitable assumptions can be made) The user interfaces should be designed in Netbeans and Database should be stored in My SQL. 2. Create a Project using Java Netbeans and MySQL for Employee Database Management System having forms like Employee Details, attendance information and salary calculations. It stored associated tables in MySQL. 3. Create a Project using Java Netbeans and MySQL for Library Management System having forms like Book Details, Issue details, fine details. It stored associated tables in MySQL. 4. Create a Project using Java Netbeans and MySQL for Railway reservation system having forms like train Details, seat availability, passenger details and reservation. It stored associated tables in MySQL. 5. Create a Project using Java Netbeans and MySQL for Students Information System having forms like student details, marks information. It stored associated tables in MySQL. 6. Create a Project using Java Netbeans and MySQL for Criminals Information System Having a Criminal Table in Relational Database MySQL and a Criminals Data Entry Form in Java Netbeans to enter data into the database. It stored associated tables in MySQL. 7. Create a Project using Java Netbeans and MySQL for Nursing Home Automation System having Linked tables (for example: Patient, Employee, Bill) in Relational Database MySQL and a required Data Entry Forms in Java Netbeans to enter data. It stored associated tables in MySQL.

Question Paper, Marking Scheme, Blue Print XI CS Unit Test I

Shruti Shrivastav

PGT – Comp. Sc.

KV, Panvel

UNIT TEST I (SET-1) (General OOP concept, Getting Started with C++, Data Handling)

TIME: 1.30 Hrs Max Marks: 40

� ALL QUESTIONS ARE COMPULSURY.

� PROGRAMMING LANGUAGE IS C++. GENERAL OOP CONCEPTS

1. What is Polymorphism? 1 2. Which two programming languages are low level languages? 1 3. What is the difference between object and class? 2 4. How is modular programming approach different from procedural programming approach? 2 5. Explain briefly the concept of data abstraction with the help of an example. 3 6. What is base class? What is a subclass? What is the relationship between base class and subclass? 3 GETTING STARTED WITH C++

7. What does the file iostream.h consist of? 1 8. What do you mean by "code generation"? 1

Page 243: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 243

9. What are the literals in C++? How many literals are allowed in C++? 2 10. What is the difference between 'a' and "a" in C++? 2 11. What factors guide the choice of identifiers in a program? 2 12. What type of errors generally occurs while programming? 3 13. Write a C++ program to accept marks in five subjects and output the average marks. 3 DATA HANDLING

14. Why is char often treated as integer data type? 1 15. What is the use of void data type? 1 16. What is the difference between fundamental data types & derived data types? 2 17. What is reference variable? What is its usage? 2 18. How is structure different from a class? 2 19. What is a variable? How many values are associated with it? 3 20. Write a program to find the area of a triangle. 3 _____________________________________________________________________________ MARKING SCHEME Ans. 1 Polymorphism is the ability for a message or data to be processed in more than one form. 1 mark for the correct definition. Ans. 2 Assembly Language and Machine Language are Low level Language. ½ mark for each correct language. Ans. 3 An object is an identifiable entity with some characteristics and behaviour. It represents an entity

that can store data and its associated functions.

A class is group of objects that share common properties and relation ships. It represents a group

of similar objects. 1 mark for definition and 1 mark for difference point. Ans 4

Modular Programming Procedural Programming

1. Decide Which module you want 1. Decide which procedure you want.

2. The focus is on partitioning the

program so that data is hidden in

modules.

2.The focus is on processing, the algorithm

needed to perform the desired

computations.

1 mark for each correct difference points. Ans 5. Abstraction is the act of representing essential features without including the background details

or explanations.

Consider the example of ‘switch board’. We only press the certain switches according to our

requirements. What is happening inside, how it is happening etc. we don’t know. This is the

abstraction, as we know only the essential things to operate on switch board without knowing the

background details of switchboard. 1 mark for correct definition. 1 mark for correct example. 1 mark for explanation. Ans 6. A base class is a class whose properties are inherited by derived class.

A derived class inherits properties from some other class. A derived class has nearly all the properties of base class but the reverse is not possible.

Page 244: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 244

1 mark each for correct definition of base class & derived class. 1 mark for the correct relationship between them. Ans.7 The file iostream.h consists of declaration of standard stream input and output facilities. It also

consists of procedures that predefine a set of operations for handling reading and writing of built-

in data types. 1 mark for correct answer. Ans. 8 After removal of all the errors in a program, compiler compiles the program to translate the

program text in object or assembly instruction set which is understood by the computer. This process of translation is called as ‘code generation’.

1 mark for correct definition. Ans 9 Literals mean constants i.e. the data items that never change their value during a program run.

C++ allows four types of literals:

(i)Integer Literal (ii) Character Literal

(iii) Floating point Literal (iv) String Literal 1 mark for correct definition & 1 mark for correct 4 types.

Ans 10. Characters enclosed in single quotes are character constants in C++. Thus ‘a’ is a character

constant.

Character enclosed in double quotes is string literals which are array of characters. Thus “a” is

a string i.e. in memory “a” is represented as “a\0” where \0 (null) character is the terminator of

the string.

The size of ‘a’ is 1 character whereas the size of “a” is 2 characters. 2 marks for the correct difference. Ans 11. The factors that guide the choice of the identifier are:

(i)An identifier must start with a letter or underscore followed by any number of digits and/or

letters.

(ii) No reserved word or standard identifier should be used.

(iii) No special character (other than underscore) should be used in the identifiers. 2 marks for the correct points.

Ans 12. Three types of errors which are given below:

(i)Syntax errors when rules of programming languages are violated.

(ii) Semantic errors when the program statements are not meaningful.

(iii)Type errors when data/value of unexpected type is passed or input. 1 mark for each error type and its definition.

Ans 13. Program for accepting marks of five subjects and calculate its average marks.

#include<iostream.h>

int main()

{

float m1,m2,m3,m4,m5,avg;

cout<<”\n Enter the marks of five subjects::”;

cin>>m1>>m2>>m3>>m4>>m5;

avg=(m1+m2+m3+m4+m5)/5;

cout<<”\n the average marks are::”<<avg;

return 0;

}

Page 245: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 245

½ mark for correct header file, ½ mark for variable declaration, ½ mark for accepting values, 1 mark for processing the value of avg, ½ mark for output the value. Ans 14. The memory implementation of char data type is in term of the number code (which is integer).

Therefore it is said to be an integer data type. 1 mark for correct answer. Ans 15. Void data type is used as the return type for functions that do not return a value. 1 mark for correct answer. Ans 16.

Fundamental data types Derived data types

1. These data types are not

composed of any other data types.

1. Theses are composed of fundamental

data types.

2. These are five fundamental

data types: int, char, void, double,

float

2. These are: array, pointer, reference,

constants, class, structure, union,

enumeration.

1 mark for each correct difference. Ans 17. A reference variable is an alias name for a previously defined variable. The usage of it is that the

same data object can be referred to by two names and these two names can be used

interchangeably. 1 mark for correct definition,1 mark for correct use.

Ans 18. A class represents data elements as well as their associated functions that manipulate them,

wheras a structure can only represent the data elements. It has no control over the associated

functions of data. 2 marks for the correct answer. Ans 19. A variable is a named storage location that can hold any data value. A variable has two

associated values:

1. rvalue which is its data value i.e. its constants

2. lvalue which is its location value i.e. memory address. 1 mark for correct definition & 1 mark each for correct value associated with it.

Ans 20. Program for finding area of a triangle:

#include<iostream.h>

int main()

{

float b,h,area;

cout<<”\n Enter Breadth & Height of the triangle::”;

cin>>b>>h;

area=(b*h)/2;

cout<<”\n The Area of Traingle is ::”<<area;

return 0;

} ½ mark for correct header file, ½ mark for declaration of variables ½ mark for accepting the values, 1 mark for calculating area, ½ fro printing area.

Page 246: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 246

UNIT TEST I(Set II) (General OOP concept, Getting Started With C++, Data Handling )

TIME: 1.30 Hrs Max Marks: 40

� ALL QUESTIONS ARE COMPULSURY. � PROGRAMMING LANGUAGE IS C++.

GENERAL OOP CONCEPTS

8. What are the two types of programming languages? 1 9. What do you mean by Abstraction & Encapsulation? How are these two terms interrelated? 3 10. Why is C++ called as "middle level language"? 2 11. What do you mean by the transitive nature of inheritance? 2 12. Why are low languages close to the machine? 1 13. What are the advantages & disadvantages of OOPs? 3 GETTING STARTED WITH C++

7. What is the difference between keywords and identifiers? 2 8. Which escape sequence represents the new line character & null character? 1 9. Complete the following incomplete sentence: 1

Stream extraction operator looks like______and it say"______" 10. Write the real constants in exponent form: 2

17.251 151.02 0.00031 0.452

11. Why is function main ( ) special? What would happen if main ( ) is not present in the program? 2 12. What type of errors generally occurs while programming? 3 13. Write a C++ program that reads temperature in Celsius and displays it in Fahrenheit. 3 DATA HANDLING 14. Write the names of all four integer data types. 1 15. How is structure different from an array? 2 16. In how many ways can a variable be declared in C++? 2 17. What are derived data types? Name the user defined data types in C++. 2 18. Write declaration for: 3

I. A pointer to a character & an array of 10 integers. II. A reference to a floating point variable. III. A constant character & a constant integer.

19. Write a program to compute simple interest & compound interest. 4

Page 247: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 247

MARKING SCHEME GENERAL OOP CONCEPTS Ans 1. Low level languages and high level languages. 1 mark for correct answer. Ans 2. Abstraction is the act of representing essential features without including the background details.

Encapsulation is the way of combining both data and the functions that operate on the data under

a single unit.

Encapsulation is the way of implementing abstraction. 1 mark each for definition & 1 mark for explaining relationship between these two.

Ans 3.The low level languages serve only the first aspect i.e., they are close to the machine and the high

level languages serve only the second aspect i.e., they are close to the programmer. However the

language C++

Serve both the aspects, hence can be called as "middle level language". 2 marks for correct explanation. Ans 4. If a class A inherits properties of another class B, then all the subclasses of A will automatically

inherit the properties of B. This property is called transitive nature of inheritance. 2 marks for correct answer. Ans 5. Low level languages are machine oriented and require extensive knowledge of computer circuitry.

Machine language, in which instructions are written in binary code, is the only language the

computer can execute directly and so LLL are close to the machine. 1 mark for correct answer. Ans 6. Advantages:-

(i) It models real world well.

(ii) With OOP programs are easy to understand.

(iii) OOP offers classes reusability.

(iv) OOP facilitates quick development as parallel development of classes is possible.

Disadvantages:-

(i) With OOP, classes tend to be overly generalized.

(ii) The relation among classes becomes artificial at times.

(iii) The OOP program design is tricky.

(iv) To program with OOP, programmer need proper skill such as design skills, programming

skills, thinking in terms of objects etc. 11/2 mark each for advantage and disadvantage.

GETTING STARTED WITH C++

Ans 7. Keyword is a special word that has a special meaning and purpose. Keywords are reserved and

are a few. E.g. - goto, switch, else etc.

Identifier is the user defined name given to a part of program i.e. variable, object, function etc.

Identifiers are not reserved. These are defined by the users but they can have letters, digits and a

symbol of underscore ( _ ). They must begin with a letter or a underscore. Eg: _chk, chess etc. 1 mark each for keyword & identifier.

Page 248: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 248

Ans. 8. Newline character - “\n”

Null character- “\0” ½ mark each for correct character.

Ans 9. Stream extraction operator looks like >> and it say “extract the next value from the stream named

cin and assign to the next named variable". ½ mark each for correct anwer. Ans 10.(i) 17.251 = 0.17251 x 10

2 = 0.17251E02

(ii) 151.02 = 0.15102 x 103 = 0.15102E03

(iii) 0.00031 = 0.31 x 10-3

= 0.31E-03

(iv)0.45 = 0.0452 x 101 = 0.0452E01

½ mark each for correct answer. Ans 11.Every C++ programme must have a function named main ( ). Programme execution begins at

main ( ) and continues by sequentially executing the statements with main ( ). A programme

terminates normally following execution of the last statement of the main ( ). The content of the main

( ), is the first to be executed when a programs start. Hence it is essential to have a main in the programme. 2 marks for correct answer.

Ans 12. Type of errors:

(i) Syntax error: When rules of programming language are violated.

(ii) Semantics error: When programming statements are not meaningful.

(iii) Type errors: When data / value of an expected type is passed or input. 1 mark each for correct error type

Ans 13. Program for conversion of temp. from Fahrenheit to Celsius

#include<iostream.h>

void main()

{

int temp,f;

cout<<"\nenter the temperature in celcius: ";

cin>>temp;

f = (temp*1.8) + 32;

cout<<"\nthe temperature in farenheit is: "<<f; } 1 mark variable declaration,1 for accepting and printing,1 for processing

DATA HANDLING Ans 14.The 4 integer types are:

(i) Signed

(ii) Unsigned

(iii) Long

(iv)Double 1 mark for correct answer.

Page 249: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 249

Ans 15. A structure is a collection of variables of different data types, while array is a collection of

variables of same data types. 1 mark each for correct difference. Ans 16.A variable can be declared in 3 ways:

(i) Initialized variable:

A variable can be initialized in 2 ways:

int i = 12;

int j(5);

(ii)Uninitialised: variable can be declared uninitialised ie the value of the integer need not be specified.

int i ;

(iii)Dynamic initialilsation: a variable can be declared by an expression.

int i= (a+b)/2 ; 2 marks for correct answer. Ans 17. Data types that are derived from the fundamental data types are known as Derived data types.

( i ) Arrays

(ii) Functions

(iii) Pointers

(iv) References

(v) Constants 2 marks for correct answer.

Ans 18. i) char*A;

ii) float A ;

float&B=A;

iii)const char v = ‘a’;

const int t =‘50’; 1 mark each for correct answer. Ans 19. Program for calculating simple interest & compound interest

#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

float ci,si,a,p,r,t;

cout<<”enter the values of p,r,t:”;

cin>>p>>r>>t;

si=(p*r*t)/100;

cout << The amount is: ”<<a<<”\n the simple interest is: ”<<si;

a=p*pow(1 + (r/100),t)

ci= a -p;

cout<<”\n The amount is: ”<<a<<”\n the compound interest is: ”<<ci;

} 1 mark for declaring variables, 1 mark for each for calculating simple interest & compound interest, 1 mark for printing and accepting values.

Page 250: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 250

Question Paper, Marking Scheme, Blue Print XI CS Unit Test II

Kamlesh Amin

PGT – Comp. Sc.

KV, 9 BRD Pune

BLUE PRINT

CLASS XI Set-I & II

Unit Test – II Subject: COMPUTER SCIENCE

S

No. UNIT/Chapters

VSA

(1 MARK)

SA-I

(2 MARKS)

SA-II

(3 MARKS)

LA

(4 MARKS) TOTAL

1 Getting Started

With C++ 2 2 1 - 09

2 Data Handling 1 1 2 09

3 Operators And

Expression 1 1 1 1 10

4 Flow Of Control - 1 2 1 12

TOTAL 4*1=04 5*2=10 6*3=18 2*4=08 40

II UNIT TEST

Class- XI

Subject – Computer Science Set- I

Max.Marks:40 Duration: 90 Min.

� All questions are compulsory � Programming Language - C++

1. Find out errors, if any, in the following C++ statements:

i) cout<< “a = ” a; ii) break = x*y; 2 2. What is the difference between run-time error and syntax error? 3 Give one example for each. 3. If the file iostream.h is not included in a program, what happens? 1

4. Write a C++ program that accepts marks in 5 subjects and prints the average marks. 3

5. What are data types? What all predefined data types are in C++? 3

6. What is a reference variable? How is it defined in C++? 2

7. What do you mean by dynamic initialization of a variable? Give an example. 2

8. What are operators? Give examples of some unary and binary operators? 2 9. Evaluate a+ = a++ + ++a if a=10 initially. 1

10. Write a program to read two numbers and print their quotient and remainder. 3

11. What output will be the following code fragment produce?

int val, res, n=1000;

cin>>val;

res = (n+val) >1750 ? 400 : 200;

cout<<res;

i) if the input is 2000 1 12. What is the function of increment/decrement operators? How many varieties do they come in? How are these two varieties different from one another? 3 13. What is the role of comments and indentation in a program? 2 14. Discuss two entry controlled loops in C++. 2

Page 251: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 251

15. Name the jump statement available in C++? 2 16. How many times is the loop executed? 2

int s=0, i = 0;

while( i < 5 )

s+= i++;

17. What will be the output of the following code: 2

int i, j;

for ( i=1; i <5; ++i)

{

cout<< “\n”;

for (j=1; j<= i; ++j)

cout<< “*”;

}

18. Write a C++ program to print Fibonacci series i.e. 0 1 1 2 3 5 8 ….. 4

*************

Marking Scheme Class XI

Subject : Computer Science Set I

Questions No.

Possible Answer or hint Marks

1 For each error correction i. cout<< “a=” <<a; ii. break is keyword

1 1

2 Correct answer with at least two differences 1½ +1½

3 Correct answer 1

4 proper input Logic Output

1 1 1

5 Correct answer for data types Details of all pre defined data types

1½ 1½

6 Correct answer of Reference variable Syntax of reference variable

1 1

7 Correct answer with example 2

8 Correct answer Unary operators example Binary operators example

1 ½ ½

9 Correct evaluation of value of a 1

10 Proper input Logic Output

1 1 1

11 Output : 400 1

12 Correct answer for increment/decrement op. Post Increment & Pre Increment, Post decrement , pre decrement Difference

1 ½ ½ 1

Page 252: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 252

13 Correct answer 2

14 For Loop and while Loop Explanation with syntax

1 1

15 Jump statements : Break, return, continue, Goto, exit( )

½ for each

16 Loop executed : 5 times 2

17 Output : * * * * * * * * * *

18 Proper Input , output message Correct logic Comment and Indentation

2 1 1

II UNIT TEST

Class- XI

Subject – Computer Science Set- II

Max.Marks:40 Duration: 90 Min.

� All questions are compulsory � Programming Language - C++

1. What is the difference between ‘A’ and “A”? 1 2. What is variable? How many values are associated with it? 2 3. What is the difference between “=” and “= =’ operators? 1 4. Which header file must be included in program 1

i. To make use of C++’s in built Mathematics functions

ii. To make use of C++’s inbuilt functions to handle input and output data.

5. Evaluate (x-y) <z && y+z >x || x-z <=y-x +z 1 If x=4, y=7 & z=10

6. What is the difference between structure and Array? 3 7. Write declaration for 2

i. Reference to a floating point variable

ii. Constant integer number

8. What is the difference between runtime errors and syntax errors? 3 Give 1 example of each.

9. Explain the difference among 0, ‘0’ and “0”? what is significance of Null (\0) 2 character in string.

10. What is the function of increment / decrement operators? How many varieties do they come in? How these varieties are differing from one another? 3

11. Write down the errors in following program. 2 #include [ iostream.h ]

Void main( )

{

cout<< “Enter values for A and B:”;

cin<<A >>B;

int A, B;

Page 253: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 253

return 0;

}

12. What is type conversion? What is meant by Implicit & Explicit type conversion? 3 13. What are operators? Give the classification of operators with example? Also give the 4

precedence order of the operators in C++? 14. What are three constructs are supported by program language? 3 15. Give the output of the following program: 3

#include <iostream.h> void main() { long number = 5532331, result =0; do{ result *= 10; int digit = number % 10; result += digit; number /=10; }while(number); cout<< “Output=” <<result <<endl; }

16. Write a C++ program to check whether a given number is palindrome or not. 4 17. Write an equivalent While loop for the following for loop: 2

for(int i = 2, sum= 0 ; i <=20 ; i = i +2 ) sum += i ;

*************

Marking Scheme Unit Test – II

Class XI Subject: Computer Science

Set II

Questions No.

Possible Answer or hint Marks

1 Correct answer for character constant and string

½ ½

2 Variable definition and correct explanation

1 1

3 Difference between assignment op. and equal op. 1

4 Correct answer i. math.h ii. iostream.h

½ ½

5 Correct answer 1

6 Two difference between structure and Array with syntax 3

7 i. float amount=200.00; float &rupees= amount; ii. const int MAX=50;

1 1

8 Difference between syntax and runtime errors with example

2 1

9 Difference between 0, ‘0’ and “0” Null character ‘\0’ correct answer

1 1

10 Correct answer Their types Difference

1 1 1

Page 254: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 254

11 Errors in program #include < iostream.h >

int main( )

{ int A, B;

cout<< “Enter values for A and B:”;

cin>>A >>B;

return 0;

}

12 Correct answer for type conversion Implicit and Explicit type difference

1½ 1½

13 Correct answer for operators Classification of operators Precedence of op.

1 2 1

14 1. Sequential construct 2. Selective construct 3. Iterative construct with little explanation

1 1 1

15 Correct Output: 3

16 Proper Input , output message Correct logic Comment and Indentation

2 1 1

17 i =2, sum=0;; While( i <= 20) { sum += i ; i= i +2; }

½ ½ ½ ½

*******************

Page 255: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 255

Question Paper, Marking Scheme, Blue Print XII CS Unit Test I

Ramesha K S

PGT – Comp. Sc.

KV,Panvel

COMPUTER SCIENCE (Theory)

Unit-1, Class XII -Blue Print

SL. NO.

UNIT VSA (1 Mark)

SA I ) (2 Marks

SA II (3 Marks)

LA (4 Marks)

TOTAL

1 Review of C++ covered in

Class XI 3 (3) 8 (4) 3 (1) 14 (8)

2

Object Oriented

Programming in C++ a)Introduction to OOP using C++ b) Constructor & Destructor c) Inheritance

2(1) 2(1)

4(1) 4(1)

6(2) 2(1) 4(1)

3 Data Structure & Pointers a) Address Calculation

b) Static Allocation of Objects c) Dynamic Allocation of Objects d) Infix & Postfix Expressions

2(1) 2(1)

3(1) 3(1)

4(1)

3(1) 5(2) 4(1) 2(1)

TOTAL 3(3)

16(8)

9(3) 12(3)

40(17)

SET-1

Time: 01 hours

Marks : 40 Questions

1. (a) What is the difference between Global Variable and Local Variable? Also, give a suitable C++ code to illustrate both. 2 (b) Which C++ header file(s) will be essentially required to be included to run / execute the following C++ code: 1

Page 256: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 256

void main() { char Msg[ ]="Sunset Gardens"; for (int I=5;I<strlen(Msg);I++) puts(Msg); } (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 2 #include [iostream.h] class MEMBER { int Mno;float Fees; PUBLIC: void Register(){cin>>Mno>>Fees;} void Display{cout<<Mno<<" : "<<Fees<<endl;} }; void main() { MEMBER M; Register(); M.Display(); } (d) Find the output of the following program: 3 #include <iostream.h> struct GAME { int Score, Bonus;}; void Play(GAME &g, int N=10) { g.Score++;g.Bonus+=N; } void main() { GAME G={110,50}; Play(G,10); cout<<G.Score<<":"<<G.Bonus<<endl; Play(G); cout<<G.Score<<":"<<G.Bonus<<endl; Play(G,15); cout<<G.Score<<":"<<G.Bonus<<endl; }

(e) Find the output of the following program: 2 #include <iostream.h> void Secret(char Str[ ]) { for (int L=0;Str[L]!='\0';L++); for (int C=0;C<L/2;C++)

Page 257: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 257

if (Str[C]=='A' || Str[C]=='E') Str[C]='#'; else { char Temp=Str[C]; Str[C]=Str[L-C-1]; Str[L-C-1]=Temp; } } void main() { char Message[ ]="ArabSagar"; Secret(Message); cout<<Message<<endl; } (f) In the following program, if the value of Guess entered by the user is 65, what will be the expected output(s) from the following options (i), (ii), (iii) and (iv)? 2 #include <iostream.h> #include <stdlib.h> void main() { int Guess; randomize(); cin>>Guess; for (int I=1;I<=4;I++) { New=Guess+random(I); cout<<(char)New; } } (i) ABBC (ii) ACBA (iii) BCDA (iv) CABD g) Write the names of the header files to which the following belong: 1

(i)strcmp() (ii)fabs() h) Differentiate between a Logical Error and Syntax Error. 1 2. (a) What do you understand by Data Encapsulation and Data Hiding? Also, give a suitable C++ code to illustrate both. 2 (b) Answer the questions (i) and (ii) after going through the following class: 2 class Seminar {

Page 258: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 258

int Time; public: Seminar() //Function 1 { Time=30;cout<<"Seminar starts now"<<end1; } void Lecture() //Function 2 { cout<<"Lectures in the seminar on"<<end1; } Seminar(int Duration) //Function 3 { Time=Duration;cout<<"Seminar starts now"<<end1; } ~Seminar() //Function 4 { cout<<"Vote of thanks"<<end1; } }; i) In Object Oriented Programming, what is Function 4 referred as and when does it get invoked/called? ii) In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions.

(c) Define a class TEST in C++ with following description: 4 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 (d) Answer the questions (i) to (iv) based on the following: 4 class PUBLISHER { char Pub[12]; double Turnover; protected: void Register(); public: PUBLISHER();

Page 259: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 259

void Enter(); void Display(); }; class BRANCH { char CITY[20]; protected: float Employees; public: BRANCH(); void Haveit(); void Giveit(); }; class AUTHOR : private BRANCH , public PUBLISHER { int Acode; char Aname[20]; float Amount; public: AUTHOR(); void Start(); void Show(); }; (i) Write the names of data members, which are accessible from objects belong- ing to class AUTHOR. (ii) Write the names of all the member functions which are accessible from ob- jects belonging to class BRANCH. (iii) Write the names of all the members which are accessible from member func- tions of class AUTHOR. (iv) How many bytes will be required by an object belonging to class AUTHOR? 3. (a) Write a function in C++ to merge the contents of two sorted arrays A & B into 3

third array C. Assuming array A and B are sorted in ascending order and the resultant array C is also required to be in ascending order.

(b) An array S[40][30] is stored in the memory along the row with each of the 3

element occupying 2 bytes, find out the memory location for the element S[20][10], if the Base Address of the array is 5000.

(c) Write a function in C++ to perform Insert operation in a dynamically 4 allocated Queue containing names of students.

(d) Write a function in C++ to find the sum of both left and right diagonal elements 2

from a two dimensional array (matrix).

(e) Evaluate the following postfix notation of expression:

Page 260: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 260

2 20, 30, +, 50, 40, - ,*

*****END*****

Set1:- Marking Scheme 1. (a) Global Variable Local Variable 2

* It is a variable which is declared outside all the functions. It is accessible throughout the program.

• It is a variable which is declared with in a function or within a compound statement. It is accessible only within a function/compound statement in which it is declared. #include <iostream.h> float NUM=900; //NUM is a global variable void LOCAL(int T) { int Total=0; //Total is a local variable for (int I=0;I<T;I++) Total+=I; cout<<NUM+Total; } void main() { LOCAL(45); } (1 Mark for two differences) (1 Mark for the suitable example) OR (Full 2 Mark for explanation of differences with the help of an example) OR (1 Mark for only example with no explanation)

(b) (i) string.h (ii) stdio.h 1 1 ( ½ Mark for mentioning each correct header filename) (c) #include <iostream.h> 2 class MEMBER { int Mno;float Fees; public:

Page 261: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 261

void Register(){cin>>Mno>>Fees;} void Display(){cout<<Mno<<":"<<Fees<<endl;} }; void main() { MEMBER M; M.Register(); M.Display(); } ( ½ Mark each correction) (d) 111:60 3 112:70 113:85 (1 Mark for each correct line of output) (e) #agaSbarr 2 (2 Marks for correct line of output) (f) (i) ABBC 2 (2 Marks for mentioning correct option)

g) (i) string.h (ii) math.h

1 (1/2 Mark for mentioning name of each header file)

h) At least two differences of each ½+ ½

1 2. (a) Data Encapsulation: Wrapping up of data and functions together in a single unit is 2 known as Data Encapsulation. In a class, we wrap up the data and functions together in a single unit. Data Hiding: Keeping the data in private visibility mode of the class to prevent it from accidental change is known as Data Hiding. class Computer { char CPU[10];int RAM; public: Data Encapsulation void STOCK(); void SHOW(); }; ( ½ Mark each for appropriate definitions) (1 Mark for appropriate example showing both) (b)

Page 262: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 262

2 i) Destructor, it is invoked as soon as the scope of the object gets over.

( ½ Mark for mentioning destructor) ( ½ Mark for remaining answer) ii) Constructor Overloading (or Function Overloading or Polymorphism) Seminar S1; //Function 1 Seminar S2(90); //Function 3 ( ½ Mark for mentioning the correct concept) ( ½ Mark for the example) (c) class TEST 4 { int TestCode; char Description[20]; int NoCandidate,CenterReqd; void CALCNTR(); public: void SCHEDULE(); void DISPTEST(); }; void TEST::CALCNTR() { CenterReqd=NoCandidate/100 + 1; } void TEST::SCHEDULE() { cout<<"Test Code :";cin>>TestCode; cout<<"Description :";gets(Description); cout<<"Number :";cin>>NoCandidate; CALCNTR(); } void TEST::DISPTEST() { cout<<"Test Code :"<<TestCode<<endl; cout<<"Description :"<<Description<<endl; cout<<"Number :"<<NoCandidate<<endl;; cout<<"Centres :"<<CenterReqd<<endl;; } (½ Mark for correct syntax for class header) (½ Mark for correct declarations of data members) (1 Mark for appropriate definition of function CALCNTR()) (1 Mark for appropriate definition of SCHEDULE() with a call for CALCNTR()) (1 Mark for appropriate definition of DISPTEST()) (d)

4 (i) None of data members are accessible from objects belonging to class AUTHOR. (1 Mark for correct answer) (ii) Haveit(), Giveit() (1 Mark for correct answer)

Page 263: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 263

(iii) Data members: Employees, Acode, Aname, Amount Member function: Register(), Enter(), Display(), Haveit(), Giveit(), Start(), Show(), (1 Mark for correct answer) (iv) 70 (1 Mark for correct answer)

3. (a) void AddNSave(int A[ ],int B[ ],int C[ ],int N,int M, int &K) 3 { int I=0,J=0; K=0; while (I<N && J<M) if (A[I]<B[J]) C[K++]=A[I++]; else if (A[I]>B[J]) C[K++]=B[J++]; else { C[K++]=A[I++]; J++; } for (;I<N;I++) C[K++]=A[I]; for (;J<M;J++) C[K++]=B[J]; } ( ½ Mark for correct Function Header) ( ½ Mark for correct initialization of required variables) ( ½ Mark for correct formation of loop) ( ½ Mark for appropriate conditions and assignments in the loop) ( ½ Mark for appropriately transferring the remaining elements from first array) ( ½ Mark for appropriately transferring the remaining elements from second array) (b) Given, 3 W=2 N=40 M=30 Base(S)=5000 Row Major Formula: Loc(S[I][J]) =Base(S)+W*(M*I+J) Loc(S[20][10]) =5000+2*(30*20+10) =5000+2*(600+10) =5000+1220 =6220 (1 Mark for writing correct formula (for column major) OR substituting formula with correct values) (1 Mark for writing calculation step - at least one step) (1 Mark for correct address)

Page 264: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 264

(c) struct NODE 4 { char Name[20]; NODE *Link; }; class QUEUE { NODE *R,*F; public: QUEUE(); void Insert(); void Delete(); }; void QUEUE::Insert() { NODE *Temp; Temp=new NODE; gets(Temp->Name); Temp->Link=NULL; if (Rear==NULL) { Rear=Temp; Front=Temp; } else { Rear->Link=Temp; Rear=Temp; } } (1 Mark for creating a new node and assigning/entering appropriate values in it) (1 Mark for checking if Queue is Empty) (1 Mark for assigning Rear and Front as Temp - if Queue is Empty) (1 Mark for eassigning Rear->Link as Front and Rear as Temp) (d) void DiagSum(int M[][4],int N,int M) 2 { int SumD1=0,SumD2=0; for (int I=0;I<N;I++) { SumD1+=M[I][I];SumD2+=M[N-I-1][I]; } cout<<"Sum of Diagonal 1:"<<SumD1<<endl; cout<<"Sum of Diagonal 2:"<<SumD2<<endl; } ( ½ Mark for correct function header) ( ½ Mark for initialization of SumD1 and SumD2 as 0) ( ½ Mark for appropriate loop) ( ½ Mark for correct expression for adding each diagonal elements)

(e)

Page 265: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 265

2 Result:- 500 (½ Mark for correctly evaluating each operator) (½ Mark for the correct result)

COMPUTER SCIENCE (Theory) - Class XII

Unit-1 , Set-2 TIME : 01 Hrs Marks : 40 Questions 1. (a) What is the difference between Actual Parameter and Formal Parameters? Also, give a suitable C++ code to illustrate both 2 (b) Write the names of the header files to which the following belong: 1 (i) frexp() (ii) isalnum() (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 2 #include <iostream.h> struct Pixels { int Color,Style;} void ShowPoint(Pixels P) { cout<<P.Color,P.Style<<endl;} void main() { Pixels Point1=(5,3); ShowPoint(Point1); Pixels Point2=Point1; Color.Point1+=2; ShowPoint(Point2); } (d) Find the output of the following program: 3 #include <iostream.h> void Changethecontent(int Arr[ ], int Count) { for (int C=1;C<Count;C++) Arr[C-1]+=Arr[C]; } void main() { int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200}; Changethecontent(A,3); Changethecontent(B,4); Changethecontent(C,2); for (int L=0;L<3;L++) cout<<A[L]<<'#'; cout<<endl;

Page 266: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 266

for (L=0;L<4;L++) cout<<B[L] <<'#'; cout<<endl; for (L=0;L<2;L++) cout<<C[L] <<'#'; } (e) Find the output of the following program: 2 #include <iostream.h> struct Game { char Magic[20];int Score; }; void main() { Game M={"Tiger",500}; char *Choice; Choice=M.Magic; Choice[4]='P'; Choice[2]='L'; M.Score+=50; cout<<M.Magic<<M.Score<<endl; Game N=M; N.Magic[0]='A';N.Magic[3]='J'; N.Score-=120; cout<<N.Magic<<N.Score<<endl; } (f) In the following program, if the value of N given by the user is 20, what maximum and minimum values the program could possibly display? 2 #include <iostream.h> #include <stdlib.h> void main() { int N,Guessnum; randomize(); cin>>N; Guessnum=random(N-10)+10; cout<<Guessnum<<endl; }

(g) Name the header file to which the following functions belong.

1 (i) isalnum( ) (ii) strcmp( ) (h) Name the header file to which the following belong: 1 (i) pow( ) (ii) random

2. (a) What do you understand by Polymorphism? Give a suitable example of the same.

Page 267: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 267

2 (b) Answer the questions (i) and (ii) after going through the following program: 2 class Match { int Time; public: Match() //Function 1 { Time=0; cout<<"Match commences"<<end1; } void Details() //Function 2 { cout<<"Inter Section Basketball Match"<<end1; } Match(int Duration) //Function 3 { Time=Duration; cout<<"Another Match begins now"<<end1; } Match(Match &M) //Function 4 { Time=M.Duration; cout<<"Like Previous Match "<<end1; } }; i) Which category of constructor - Function 4 belongs to and what is the purpose of using it? ii) Write statements that would call the member Functions 1 and 3 (c) Define a class in C++ with following description: 4 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 (d) Answer the questions (i) to (iv) based on the following: 4 class CUSTOMER

Page 268: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 268

{ int Cust_no; char Cust_Name[20]; protected: void Register(); public: CUSTOMER(); void Status(); }; class SALESMAN { int Salesman_no; char Salesman_Name[20]; protected: float Salary; public: SALESMAN(); void Enter(); void Show(); }; class SHOP : private CUSTOMER , public SALESMAN { char Voucher_No[10]; char Sales_Date[8]; public: SHOP(); void Sales_Entry(); void Sales_Detail(); }; (i) Write the names of data members which are accessible from objects belonging to class CUSTOMER. (ii) Write the names of all the member functions which 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?

3. (a) Write a function in C++ to combine the contents of two equi-sized arrays A and B by adding their corresponding elements as the formula A[i]+B[i]; where value i varies from 0 to N-1 and transfer the resultant content in the third same sized array C. 3

(b) 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. 3

(c) Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real numbers. 4

Page 269: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 269

(d) Write a function in C++ to find sum of rows from a two dimensional array. 2

(e) Evaluate the following postfix notation of expression: 2 True, False, AND, True, True, NOT, OR, AND

****End***

Set2: Marking Scheme 1. (a) Actual Parameter Formal Parameter 2

* It is a parameter, which is used in function call to send the value from calling environment. * It is a parameter, which is used in function header, to receive the value from actual parameter

#include <iostream.h> void Calc(int T) //T is formal parameter { cout<<5*T; } void main() { int A=45; Calc(A);//A is actual parameter } (1 Mark for two differences) (1 Mark for the suitable example) OR (Full 2 Mark for explanation of differences with the help of an example) (b) (i) math.h (ii) ctype.h 1 ( ½ Mark for mentioning each correct header filename) (c) #include <iostream.h> 2 struct Pixels { int Color,Style;}; void ShowPoint(Pixels P) { cout<<P.Color<<P.Style<<endl;} void main() { Pixels Point1={5,3}; ShowPoint(Point1); Pixels Point2=Point1;

Page 270: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 270

Point1.Color+=2; ShowPoint(Point2); } ( ½ Mark for each correction) (d) 7#9#5# 3 30#50#70#40# 2100#1200# (1 Mark for each line of output) (e) TiLeP550 2 AiLJP430 (1 Mark for each line of output) (f) Maximum Value: 19 Minimum Value: 10 2 (2 Marks for correct values) (g) (i) ctype.h (ii) string.h (½ Mark for each)

1 (h) (i) math.h (ii) stdlib.h (½ Mark for each)

1 2. (a) Polymorphism: It is a method of using the same operator or function (method) to work 2 using different set of inputs. Function overloading is one of the examples of polymor- phism, where more than one function carrying same name behave differently with different set of parameters passed to them. void Display() { cout<<"Hello!"<<endl; } void Display(int N) { cout<<2*N+5<<endl; } (1 Mark each for appropriate definition) (1 Mark for appropriate example) (b) i) Copy constructor, It will help to copy the data from one object to another. 2 ( ½ Mark for mentioning copy constructor) ( ½ Mark for remaining answer)

Page 271: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 271

ii) Match M; //Function 1 Match N(10); //Function 3 ( ½ Mark for each statement) (c) class FLIGHT 4 { int Fno; char Destination[20]; float Distance, Fuel; void CALFUEL(); public: void FEEDINFO(); void SHOWINFO(); }; void FLIGHT::CALFUEL() { if (Distance<=1000) Fuel=500; else if (Distance<=2000) Fuel=1100; else Fuel=2200; } void FLIGHT::FEEDINFO() { cout<<"Flight No :";cin>>Fno; cout<<"Destination :";gets(Destination); cout<<"Distance :";cin>>Distance; CALFUEL(); } void FLIGHT::SHOWINFO() { cout<<"Flight No :"<<Fno<<endl; cout<<"Destination :"<<Destination<<endl; cout<<"Distance :"<<Distance<<endl;; cout<<"Fuel :"<<Fuel<<endl;; } (½ Mark for correct syntax for class header) (½ Mark for correct declarations of data members) (1 Mark for appropriate definition of function CALFUEL()) (1 Mark for appropriate definition of FEEDINFO() with a call for CALFUEL()) (1 Mark for appropriate definition of SHOWINFO()) (d) 4 (i) None of data members are accessible from objects belonging to class AUTHOR.

Page 272: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 272

(1 Mark for correct answer) (ii) Enter(), Show() (1 Mark for correct answer) (iii) Data members: Voucher_No, Sales_Date, Salary Member function:Sales_Entry(),Sales_Detail(),Enter(),Show(),Register(), Status() (1 Mark for correct answer) (iv) 66 (1 Mark for correct answer) 3. (a) void AddNSave(int A[ ],int B[ ],int C[ ],int N) 3 { for (int i=0;i<N;i++) C[i]=A[i]+B[i]; } (1 Mark for correct Function Header with appropriate parameters) (1 Mark for appropriate loop) (1 Mark for correct expression for addition of corresponding elements) (b) Given, 3 W=4 N=20 M=30 Loc(P[2][20])=5000 Column Major Formula: Loc(P[I][J]) =Base(P)+W*(N*J+I) Loc(P[2][20]) =Base(P)+4*(20*20+2) Base(P) =5000 -4*(400+2) =5000-1608 =3392 (1 Mark for writing correct formula (for column major) OR substituting formula with correct values) (1 Mark for writing calculation step - at least one step) (1 Mark for correct address) (c) struct NODE 4 { float Data; NODE *Link; }; class STACK { NODE *Top; public: STACK(); void Push(); void Pop(); void Display();

Page 273: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 273

~STACK(); }; void STACK::Push() { NODE *Temp; Temp=new NODE; cin>>Temp->Data; Temp->Link=Top; Top=Temp; } (1 Mark for declaring Temp pointer) (1 Mark for creating a new node and assigning/entering appropriate values in it) (1 Mark for connecting link part of new node to top) (1 Mark for assigning Top as the new node i.e. Temp) (d) void MatAdd(int M[][4],int N,int M) 2 { for (int R=0;R<N;R++) { int SumR=0; for (int C=0;C<M;C++) SumR+=M[C][R]; cout<<SumR<<endl; } } ( ½ Mark for correct function header) ( ½ Mark for appropriate outer loop) ( ½ Mark for appropriate inner loop) ( ½ Mark for correctly initializing SumR and calculatin the sum)

(e) 2 Result: False (1 Mark for correctly evaluating each operator)

(1 Mark for correct answer) ***END*****

Page 274: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 274

Question Paper, Marking Scheme, Blue Print XI IP Unit Test I

Shreejith KV

PGT – Comp. Sc.

KV No.2 AFS Ojhar

S.No Topic VSA

(1 Mark) SA I

(2 Marks) SA II

(3 Marks) LA

(4 Marks) Total

1 Hardware Concepts 1(1) 6(3) 3(1) 10(5)

2 Software Concepts 1(1) 2(1) 3(1) 4(1) 10(4)

3 Getting started with programming using IDE

6(3) 4(1) 10(4)

4 Programming Fundamentals 1(1) 2(1) 3(1) 4(1) 10(4)

Total 3(1) 16(8) 9(3) 12(3) 40(17)

KENDRIYA VIDYALAYA SANGATHAN,INSERVICE TRAINING COURSE FOR PGT(Comp.Sci)

2010

MODEL QUESTION PAPER FOR FIRST UNIT TEST

SET I Class : XI Subject : Informatics Practices Time : 90 Minutes Max.Marks : 40

General Instructions

• All questions are compulsory

• Question paper consists of 4 questions and each carries 10 Marks.

• All questions consists of sub questions.

Q.1 Answer the following : a) Name any two super computers developed in India 1 b) What is the difference between RAM and ROM ? 2

c) What are two categories of printers? Give examples. 2 d) What is function memory ? What are its measuring units? 2 e) What are three types of computers? How do they differ? 3

Q.2 Answer the following :

a) What is dbms? 1 b) What is the difference between compiler and interpreter ? 2

c) Name any three features of electronic spreadsheets make them useful ? 3 d) What are various types of operating systems? 4

Q.3 Answer the following :

a) What do you understand by option buttons and an check box.. 2 b) What do you understand by Visual programming? 2

c) What are containers or container controls ? 2 d) Explain the following :

i) Event ii) Event driven program iii) Event source iv) Listener 4

Q.4 Answer the following :

Page 275: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 275

a) Define token. 1 b) What will be the result of following expressions :

i) ++i<=10 ii) i++<=10 2 c) Distinguish between a unary, a binary and a ternary operator. Give examples of

Java operators for each one of them. 3

d) What output will the following code fragment produce? 4 int val,res,n = 100; res = n + val > 1750 ? 400 : 200; System.out.println(res);

i) If the input is 2000 ii) If the input is 600 iii) If the input is 1000 iv) If the input is 500

KENDRIYA VIDYALAYA SANGATHAN,INSERVICE TRAINING COURSE FOR PGT(Comp.Sci)

2010

MARKING SCHEME - SET II

Q.1 a) 1. PARAM 1.

2. PACE ( ½ Mark for each point)

b) i) RAM refers to random access memory where both read and write operations can take place. But the

RAM is volatile memory; its content lost when power is turned off.

ii) ROM refers to read only memory where only read operation can take place. The ROM is non-volatile memory. 2 ( 1 Mark for writing each correct point)

c) The printers can be classified into following two categories: 2

1. Impact printers : In these types of printers, there is a physical contact between the paper and the printer head. Eg: dot matrix printer

2. Non impact printers : In these type of printers, there is no physical contact between the paper and the printer head. Eg : Laser printer

( 1 Mark for each point)

( Deduct Mark ½ each if not written examples)

d) 2

i) Data are raw facts and figures . ii) Data processing system transforms data into useful information ( 1 Mark for writing each correct point)

e) 3

Ports are the points on computer having associated circuitry to allow connection of external devices with computer. Ports can be of various types i) Serial port ii) Parallel port iii) USB Ports iv) Network port ( 1 Mark for writing correct definition)

( ½ Mark for each examples)

Q.2 Answer the following :

Page 276: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 276

a) DBMS is an acronym for Database Management System. A dbms is a software that can effectively store, manipulate, and handle bulk of data. A dbms provides utilities for data analysis and database management. 1 ( 1 Mark for writing correct definition)

b) 2

An interpreter converts an HLL program into machine language line by line and simultaneously executes the converted line.

A Compiler converts an HLL program in machine language in one go.

If an error occurs in a line, the line is displayed and interpreter does not proceed unless the error is rectified.

Once errors are removed, error free object code is made available and after this compiler is no more needed in the memory.

( 1 Mark for each point)

c) i) Spreadsheets cannot only represent data values but also their relationships. 3

ii) What if any analysis becomes very easy using spreadsheets. iii) Numerous built in functions are available in spreadsheets. ( 1 Mark for each point)

d) i) Real program OS : As the name suggests, this OS is single user operating system, so

only one user program can be supported and executed by it at any point of time. ii) Multiprogram OS : Unlike single program OS, this is multiuser OS. It supports

multiprogramming. iii) Time Sharing OS : This OS uses the time sharing technique. Each active user program is given

a fare share of CPU time, If the time elapses or an I/O operation is requested , CPU shifts over to the next job waiting and the previous program is put to wait.

iv) Real Time OS : In real time OS, the jobs have fixed deadlines and the jobs have to be completed within their deadlines. The system performance is measured by its ability to complete its jobs within the specified deadlines. 4

( 1 Mark for each point)

Q.3 Answer the following : a)

i) Option button is used to display an option that can be turned on or off. Usually option button used for a group of options where from user can select just one.

ii) Check boxes are used to allow a user select multiple choices. 2 ( 1 Mark for each correct point)

b) Visual is a method to create GUI applications. The visual programming style involves a list of

illustrations i.e, graphic entities rather than writing numerous lines of code to describe the appearance, functioning etc. of application’s interface. 2

( 2 Mark for correct explanation)

c) A container is a control that can hold other controls within it e.g. a Frame or a label or simply window .

Controls inside container are known as child controls. The child controls can exists completely inside their containers. That means we cannot move outside their container. When we delete container control , all its child control automatically get deleted. 2 ( 2 Mark for correct explanation)

d) 4 i) An event is an object that represents some occurrence. Often events correspond to user actions

such as presenting a mouse button, selecting an item from a menu, or typing in a text field.

Page 277: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 277

ii) A program that is oriented around a GUI responding to events from the user is called event-driven.

iii) The event source is the GUI component in which the event occurred. iv) A Listener is an object that is “waiting” for an event to occur and can respond in some way when

it does. ( 1 Mark for each correct point)

Q.4 Answer the following :

a) The smallest individual unit in a program is known as token. 1 ( 1 Mark for correct definition)

b) What will be the result of following expressions : ii) False ii) True 2 ( ½ Mark for each correct ouput)

c) i)A unary operator requires a single operand. Unary +, unary -, ++, -- etc. are some unary operators in java. ii)A binary operator requires two operands + (add), -(substract) , *, /, % etc. are some binary operands. iii)A ternary operators requires three oparands. ?:(conditional operator) is a ternary operator in java. 3

( 1 Mark for correct definition) d) 4

ii) 400 ii) 200 iv) 400 iv) 200 ( 1 Mark for each correct output)

KENDRIYA VIDYALAYA SANGATHAN,INSERVICE TRAINING COURSE FOR PGT(Comp.Sci)

2010

MODEL QUESTION PAPER FOR FIRST UNIT TEST

SET II Class : XI Subject : Informatics Practices Time : 90 Minutes Max.Marks : 40

General Instructions

• All questions are compulsory

• Question paper consists of 4 questions and each carries 10 Marks.

• All questions consists of sub questions.

Q.1 Answer the following : f) Name any two weaknesses of computer 1 g) What is MICR? Where is it mostly used? 2

h) What are the different types of digital computers based on their performance ? 2 i) What is data ? What is the output of data processing system? 2 j) What is port? Name any four port types. 3

Q.2 Answer the following :

e) What is system software? 1 f) What are various categories of application software? 2

g) Name any three features of word processors make them useful ? 3 h) What is fragmentation? How does it affect computer’s performance ? What

remedy suggest for it? 4

Page 278: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 278

Q.3 Answer the following : e) What do you understand by a properties and method. 2 f) Name two types of Java programs ? 2

g) What do you understand by JVM? 2 h) Explain the following :

ii) Option button ii) Check boxes iv) Event Source iv) Listener 4

Q.4 Answer the following : e) Define keyword. 1 f) What will be the result of following expressions :

iii) ++a<=15 ii) a++<=15 2 g) State the rules of operator precedence. 3

h) What output will the following code fragment produce? 4 int val, res,a = 100; res = a + val > 175 ? 40 : 20; System.out.println(res);

iii) If the input is 200 ii) If the input is 60 v) If the input is 100 iv) If the input is 50

KENDRIYA VIDYALAYA SANGATHAN,INSERVICE TRAINING COURSE FOR PGT(CS) 2010

MARKING SCHEME - SET II

Q.1 f) 1. Lack of decision making power 1.

2. Zero IQ ( ½ Mark for each point)

g) i) MICR stands for Magnetic Ink Character Reader.This device can read human readable characters that are printed using a special magnetic ink.

ii) The MICRs are mostly used in banks. 2 ( 1 Mark for writing each correct point)

h) Performance wise digital computers are of following four types. i) Micro computers ii) Mini Computers iii) Mainframe computers iv) Super Computers 2 ( ½ Mark for each point)

i) 2 iii) Data are raw facts and figures . iv) Data processing system transforms data into useful information ( 1 Mark for writing each correct point)

j) 3 Ports are the points on computer having associated circuitry to allow connection of external devices with computer. Ports can be of various types v) Serial port vi) Parallel port vii) USB Ports viii) Network port ( 1 Mark for writing correct definition)

( ½ Mark for each examples)

Q.2 Answer the following : e) The software that controls internal computer operations is called system software. 1

Page 279: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 279

( 1 Mark for writing correct definition) f) Application software can be subdivided into four categories. 2

1. Packages

2. Utilities

3. Customised Software

4. Developer Tools

( ½ Mark for each point) g) i) Word processors provide variety of fonts and printed styles. 3

ii) Information can be saved for later use. iii) Word processors provide the facility of spell check , dictionary and thesaurus. ( 1 Mark for each point)

h) What is fragmentation? How does it affect computer’s performance ? What remedy suggest for it? 4 Fragmentation means files stored in fragmented storage blocks. That is, when files not stored in contiguous storage areas rather their contents are scattered over the disk, it is known as fragmentation. High fragmentation slows down a computer has to perform more read/write operations. To defragment a disk, disk defragmenter utility may be run which rearranges files in contiguous storage blocks. ( 2 Mark for correct definition)

( 1 Mark for each correct point)

Q.3 Answer the following : e) 2

i)Properties can be thought of as an object’s attributes. ii)Method as it action. ( 1 Mark for each correct point)

f) i)Internet applet ii)Standalone applications 2

( 1 Mark for each correct point)

g) The Java Virtual Machine is an abstract machine designed to be implemented on the top of existing

processors. It hides the underlying operating systems from Java applications. Programs written in java are compiled into Java Byte code, which is then interpreted by a special Java interpreter for a specific platform. Actually this Java interpreter is known as the Java Virtual machine(JVM). 2 ( 2 Mark for correct explanation)

h) Explain the following : iii) Option button ii) Check boxes v) Event Source iv) Listener 4

v) Option button is used to display an option that can be turned on or off. Usually option button used for a group of options where from user can select just one.

vi) Check boxes are used to allow a user select multiple choices. vii) The vent Source is the GUI component in which the event occurred. viii) A Listener is an object that is “waiting” for an event to occur and can respond in some way when

it does. ( 1 Mark for each correct point)

Q.4 Answer the following :

e) Keywords are the words that convey a special meaning to the language compiler. 1 ( 1 Mark for correct definition)

Page 280: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 280

f) What will be the result of following expressions : iv) False ii) True 2 ( ½ Mark for each correct ouput)

g) i)All expressions are evaluated according to an operator precedence hierarchy that establishes the rules that govern the order in which operations are evaluated. ii)Operators(type) ,*, / and the remainder operator % are performed before + and - .Any expressions in parenthesis is evaluated first. iii)The assignment operator has a lower precedence than any of arithmetic operator. 3 ( 1 Mark for correct definition)

h) What output will the following code fragment produce? 4 int val, res,a = 100; res = a + val > 175 ? 40 : 20; System.out.println(res);

iv) 400 ii) 200 vi) 400 iv) 200 ( 1 Mark for each correct output)

Question Paper, Marking Scheme, Blue Print XI IP Unit Test II

Raju Lal Meena

PGT – Comp. Sc.

KV No.2 AFS Pune

KENDRIYA VIDYALAYA SANGATHAN

II UNIT TEST– 2010

Class – XI

Subject – INFORMATICS PRACTICES (065)

TIME : 1:30 Hrs Max Marks: 40 Note:

1. All the questions Compulsory to attempt.

2. Answer the questions after carefully reading the text.

1. State the basic units of the computer. Give the functions of each unit of computer. 2

2. Briefly explain the type of Computers and its purpose 2

3. What is the function of Memory? What are its measuring units? 2

4. Write two point differences between volatile memory and non-volatile memory. Write

two name the super computers developed in India. 2

5. Expend the following :-

i. CRT ii. IDE iii. MICR iv. ASCII 2

6. Explain the two categories of printers? Write working process of dot-matrix printer. 2

7. What are different characteristics of JAVA? 2

8. Distinguish between unary, binary & ternary operator. Give examples of Java

operators for each one of them. 3

Page 281: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 281

9. Write short note:- 3

i. Digital Certificate ii. Computer Viruses iii. Firewall & Cookies

10. Explain the following point with example:- 3

i. Try & Catch ii. Type of Errors

11. Identify the data type of the following expression: 3

i. u*t+1/2*f*t*t ii. 200.23*(1-u*f)/(q+r)

If u, q is an int, f is long and t is float type.

12. Can Non-Graphics (non-printable) characters be used and processed in Java? How?

Give examples. 3

13. Write a for loop that display the number from 0dd number from 51 to 99 3

14. Design an application having an interface like: 4

Implement functionality by writing methods clacSum(), calcAvg() & calcMax(). Invoke these methods and pass

three number as argument from buttons event handlers.

15. WAP & Design a following form for input valid day no., Month no. and year and

print date according to input month in given format with checking day no. >0 &

<=31 & month no >0 &<=12. 4

Page 282: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 282

KENDRIYA VIDYALAYA SANGATHAN II UNIT TEST– 2010

Class – XI Subject – INFORMATICS PRACTICES (065)

TIME : 1:30 Hrs Max Marks: 40 Note:

3. All the questions Compulsory to attempt.

4. Answer the questions after carefully reading the text.

1. Define Operating system. 2 2. What is the difference between copying and moving files and folders? 2

3. How is the complier different from an interpreter? 2

4. What is the difference between RAM and ROM? 2

5. What is Alignment? Which types of alignment are there in MS-Word? 2

6. What is the role of Human Resources Information System? 2

7. What is Java IDE? 2 8. What are the various date types available in Java? 2 9. What is variable? Explain how variable is declared in Java? 2 10. What are the various assignment statements in Java? 2 11. What is the difference between If and If else? Give example also. 2 12. Write a program that prints three arguments taken from the command line. To do this, you’ll

need to index into the command-line array of Strings. 3

13. What is the output of the following program : 3 public class AutoInc {

public static void main(String[] args) {

int i = 1;

prt("i : " + i);

prt("++i : " + ++i); // Pre-increment

prt("i++ : " + i++); // Post-increment

prt("i : " + i);

prt("--i : " + --i); // Pre-decrement

prt("i-- : " + i--); // Post-decrement

prt("i : " + i);

}

static void prt(String s) {

System.out.println(s);

}

} 14. Write a program that prints values from one to 100. 4 15. Write a program to display Fibonacci series? 4 16. Write a program to display reverse of a given number? 4

Page 283: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 283

MARKING SCHEME 1. Definition of Operating System. 2 2. For correct difference. 2 3. Detail of compiler. 1

Detail of compiler. 1 4. Definition of RAM. 1

Definition of ROM. 1 5. Description of Alignment. 1

Types of Horizontal and Vertical alignments in MS-Word 1 6. Definition of Human Resource Information System 1

Need for Human Resource Information System 1 7. Correct definition 2 8. All data types 2 9. Definition + Declaration 1 + 1 10. Valid Assignment Statement 2 11. Difference with example 1+1 12. correct program 3 13. The output for this program is: 3 i : 1

++i : 2

i++ : 2

i : 3

--i : 2

i-- : 2

i : 1

14. Correct program 4 15. Correct program 4 16. Correct program

Page 284: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 284

Question Paper, Marking Scheme, Blue Print XII IP Unit Test I

Amandeep Kaur

PGT – Comp. Sc.

KV Sec 2 RK Puram, New Delhi KENDRIYA VIDYALAYA SANGATHAN

CLASS – XII UNIT TEST - 1 MARKS: 40 SET A BLUE PRINT

S.No UNIT VSA (1 Mark)

SA – I (2 Mark)

SA – II (3 Mark)

LA (4 Mark)

TOTAL

1 COMPUTER NETWORKS 2 (2) 4 (2) 4 (1) 10 (5)

2 OPEN SOURCE CONCEPTS 3 (3) 2 (1) 5 (4)

3 GUI REVISION TOUR I 2 (1) 3 (1) 5 (2)

4 GUI REVISION TOUR II 1 (1) 4 (1) 5 (2)

5 GUI REVISION TOUR III 2 (1) 4 (2) 4 (1) 10 (4)

6 MORE ABOUT CLASSES & LIBRARIES

2(1) 3 (1) 5 (2)

8 (8) 14 (7) 6 (2) 12 (3) 40 (19)

KENDRIYA VIDYALAYA SANGATHAN

CLASS – XII UNIT TEST - 1 MARKS: 40 SET A Note:

5. All questions are compulsory.

6. Answer the questions after carefully reading the text.

Q1 (a) What is bleeding of signal? 1 (b) Which communication medium is to be suggested for very effective and fast communication in guided medium? 1 (c) Give examples of open source / Free Source softwares. 1 (d) Give difference between Freeware and Shareware. 1 (e)What do you understand by ODF? 1 (f) What are following ODF file extensions meant for ? (i) odt (ii) ods (iii) odp (iv) odg 2 (g) What are the different types of intrusion problems? 2 (h) Difference between Bridge and Router. 2 (i) Knowledge Supplement Organisation has set up its new center at Mangalore for 4 its office and web based activities. It has 4 blocks of buildings as shown in the diagram below:

Page 285: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 285

Center to center distances between various blocks Black A to Block B 50 m Block B to Block C 150 m Block C to Block D 25 m Block A to Block D 170 m Block B to Block D 125 m Block A to Block C 90 m Number of Computers Black A 25 Block B 50 Block C 125 Block D 10 e1) Suggest a cable layout of connections between the blocks. e2) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable reason. e3) Suggest the placement of the following devices with justification (i) Repeater (ii) Hub/Switch Q2 (a) What will be the value of Y for the two cases given below: 2 (i) Y = ++X ; (ii) Y = X++ ; (Given the value of X is 42) (b) Using NetBeans IDE write a java program to find whether the given number is palindrome or not. 3 (c) Which event gets fired when: (i) user presses enter in a text field. (ii) knob of a slider is dragged. 1 (d) The given form calculates the GCD(HCF) of two numbers. Write code for the command button (cmdGCD) to print the GCD in the label. 4 Q3 (a) What is the relationship of methods and events ? 1 (b) Which set of values can be assigned to a Boolean variable ? 1 (c) Explain difference between method declaration and method invocation. 2 (d) What is this keyword and what is its significance? 2 (e) Design an application having an interface like: 4

GCD Calculator Num 1 GCD Num 2

GCD

Page 286: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 286

Implement functionality by writing methods clacSum(), calcAvg() & calcMax(). Invoke these methods and pass three number as argument from buttons event handlers Q4(a) Read this piece of code carefully 2 if (“String”.toString() = = “String”) System.ou.println(“Equals”); else System.out.println(“Not Equal”); State whether (i) the code will compile and print “Equal”. (ii) the code will compile and print “Not Equal”. (iii) the code will cause a compiler error.

(b) An application counts the number of vowels in a string. Write the suitable code under the command button CountBtn to achieve this goal. 3

Ram is a good boy

Vowel Counter 7

Page 287: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 287

MARKING SCHEME FOR UNIT I IP CLASS XII

Ans 1(a) 1 Mark according to the definition. (b) Optical Fibre. (c) Linux, PHP, MySql, Tomcat, etc. (atleast give 4 examples). (d) In freeware, software is free for redistribution but not for modification. In shareware, software is allowed for redistribution but it is free for a limited period. (e) ODF refers to an Open Document file format for saving and exchanging office documents such as memo, reports, spreadsheet, databases, charts and presentations. (1 mark for correct def) (f) .odt for word processing .ods for spreadsheet files .odp for electronic presentation files .odg for graphics file. (1/4 mark for each correct answer) (g)Snooping and Eavesdropping (1 mark for each problem with definition). (h) (i) Hub’s speed is very less compared to that of a switch’s speed. (ii) With hub connected computers share the bandwidth but with switches the connected computers communicate at full bandwidth. ( 1 mark for each difference) (i) (1) (Any of the following option) Layout Option 1

Layout Option 2

(2) The most suitable place / block to house the server of this organisation would be Block C, as this block contains the maximum number of computers, thus decreasing the cabling cost for most of the computers as well as increasing the efficiency of the maximum computers in the network. (3) (i) For Layout 1, since the cabling distance between Blocks A and C, and that between B and C are quite large, so a repeater each, would ideally be needed along their path to avoid loss of signals during the course of data flow in these routes. For layout 2, since the distance between Blocks A and C is large so a repeater would ideally be placed in between this path (ii) In both the layouts, a hub/switch each would be needed in all the blocks, to interconnect the group of cables from the different computers in each block. Ans 2(a)(i) 43 (ii) 42 (1/2 mark for each) (b)int n=Integer.parseInt(tf.getText());

Page 288: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 288

int num=0, rev, t; t = n; while(n) { rev = n%10; num = num*10 + rev ; n = n/10; } if(t == num) lbl.setText(“It’s a palindrome”); else lbl.setText(“It’s not a palindrome”); (1/2 mark for input, ½ mark for variable declaration, 2 marks for while loop, 1 mark for checking if condition). (c) Action Event , Change Event (1/2 mark for each) (d) private void GCDBtnActionPerformed(java.awt.event.ActionEvent evt) { int n1 = Integer.parseInt(Num1TF.getText()); int n2 = Integer.parseInt(Num2.tf.getText()); int t; while(n2 != 0) { t = n2; n2 = n1 % t; n1 = t ; } GCDLabel.setText(“ “ + n1) ; } ( ½ mark for each statement) Ans 3(a) (1/2 mark for each definition) (b) True and False (1/2 mark for each value) (c ) Method declaration is declaring the method or method prototype Method invocation is method call. (1/2 mark for correct definition and ½ mark for correct example) (d) this keyword which is actually a reference stores the address of the current object. (e) 1 mark for correct variable and 1 mark for each function definition. Ans 4(a) Equal (2 mark for correct answer). (b) 1 mark for correct variable declaration and initialization, 1 mark for correct if condition used and 1 mark for display.

BLUE PRINT

CLASS – XII UNIT TEST - 1 MARKS: 40 SET B

S.No UNIT VSA

(1 Mark)

SA – I

(2 Mark)

SA – II

(3 Mark)

LA

(4 Mark)

TOTAL

1 COMPUTER NETWORKS 2 (2) 4 (2) 4 (1) 10 (5)

2 OPEN SOURCE CONCEPTS 3 (3) 2 (1) 5 (4)

3 GUI REVISION TOUR I 2 (1) 3 (1) 5 (2)

4 GUI REVISION TOUR II 1 (1) 4 (1) 5 (2)

5 GUI REVISION TOUR III 2 (1) 4 (2) 4 (1) 10 (4)

6 MORE ABOUT CLASSES &

LIBRARIES

2(1) 3 (1) 5 (2)

8 (8) 14 (7) 6 (2) 12 (3) 40 (19)

Page 289: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 289

KENDRIYA VIDYALAYA SANGATHAN

CLASS – XII UNIT TEST - 1 MARKS: 40

SET B Note:

7. All questions are compulsory.

8. Answer the questions after carefully reading the text.

Q1(a) In which unguided transmission medium Bandwidth allocation is limited? 1 (b) In which network there is no server? 1 (c) What is Ogg Vorbis? 1 (d) Expand the following abbreviations : (i) FLOSS (ii) GNU. 1 (e) Name an open standard for the vector images. 1 (f) What are the following software used for? (i) Linux (ii) Tomcat 2 (g) What is modem? What are its function? 2 (h) Name two transmission media for networking. 2 (i) 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: 4

Center to center distances between various buildings is as follows: Harsh Building to Raj Building 50 m Raz Building to Fazz Building 60 m Fazz Building to Jazz Building 25 m Jazz Building to Harsh Building 170 m Harsh Building to Fazz Building 125 m Raj Building to Jazz Building 90 m Number of Computers in each of the buildings is follows: Harsh Building 15 Raj Building 150 Fazz Building 15 Jazz Bulding 25 e1) Suggest a cable layout of connections between the buildings. e2) Suggest the placement of the following devices with justification: (i) Internet Connecting Device/Modem (ii) Switch e3) 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.

Page 290: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 290

Q2(a) How many times the following loops executed?

X = 5 ; Y = 50 ;

while ( X <= Y)

{ X = Y / X ; } 2 (b) Using NetBeans IDE write a java program to find the LCM and GCD of two numbers. 4 (c) Are values “true” and true the same? Likewise, are “false” and false, the same? 1 (d) What is a list? How is it different from combobox? 3 Q3 (a) What is the role of return statement in a method? 1 (b) What is the use of void keyword? 1 (c) How many time(s) are the following loop executed? 2 int i = 1, j = 0 , n = 0; for ( j = 1 ; j <= i ; j++) { i ++ ; if ( i == 5 ) { n = 1; break; } } (d) Predict the output of the following code fragments: 2 int a = 5, b = 1, k = 9 ; while( k > 1) { System.out.println (a); System.out.println (b); a = a - b ; b = b + 2; if (a == b) { k = 9 ; } else { k = k - 3; } } (e) Write a program & design IDE form to define two method

4

calcCI() & calcSI() to pass Principal Amount & Time as a argument

and return Simple Interest & Compound Interest respectively as per

following criteria :-

Amount Tim

e Rate

1-5000 0-5 10%

5000-10000 6-8 15%

10000- 20000

9-12

20%

20000-50000

13-20

25%

>50000 >20 30%

Page 291: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 291

Q4(a) What will be the output of the following code snippet when combined with suitable declarations and run? 2 StringBuffer city = new StringBuffer (“Madras”); StringBuffer string = new StringBuffer ( ); string.append (new String(city)); string.insert(0, “Central”); String.out.println(string);

(b) An application changes first letter of each word in a text box to uppercase and displays the modified sentence in the same text box. Write the suitable code under the command button CaseBtn to achieve this goal. 3

MARKING SCHEME FOR UNIT I IP CLASS XII

SET B Ans1(a) Radio Waves (1 mark for correct answer). (b) Ring Topology (1 mark for correct answer) (c ) 1 mark for correct definition. (d) ½ mark for each correct expansion (e) Scalable Vector Graphics (SVG) 1 mark for correct answer (f) 1 mark for each correct answer. (g) 1 mark for definition and 1 mark for function. (h) 1 mark for each transmission medium. (i) ment of the following devices with justification: (i) (e1) Any one layout Layout option1

Layout option 2 (e2)(i) Raj Building (ii) In both the layouts, a hub/switch each would be needed in all the buildings, to interconnect the group of cables from the different computers in each block e3) MAN, because MAN (Metropolitan Area Networks) are the networks that

Enter a sentence to be modified

Sentence Case

Page 292: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 292

link computer facilities within a city. Ans 2(a) Infinite times (1 mark for correct answer).

(b) ½ mark for variable declaration, ½ mark for intialization, 2 marks for while loop and 1 mark for display. (c) ½ mark for the answer and ½ mark for the reason. (d) 1 mark for list definition and 1 mark for each difference.

Ans 3(a) 1 mark for correct answer. (b) 1 mark for correct answer. (c) 3 times (2 marks for correct answer). (d)

5 1 4 3 1 5

1/2 marks for each correct value (e) ½ mark for variables, 1 mark each for button and ½ mark for displaying result. Ans 4(a) CentralMadras ( 2 marks for correct answer) (b) ½ mark for variables , 2 marks for loop and ½ mark for display.

Page 293: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 293

Question Paper, Marking Scheme, Blue Print XII IP Unit Test II

Nitin Kumar Jain

PGT – Comp. Sc.

KV NO.1, AFS, Pune

BLUE PRINT

Unit / Q Type Unit 1 Unit 2

V. Short Answer 0 1

Short Answer 5 11

Pract. Q. 0 3

Set 1

SECOND UNIT TEST

SUBJECT - IP Max Time :1 ½ Hrs Max Marks : 40

Q1. i ii iii iv v Q2. i ii iii iv Q3. i. ii. iii. iv. Q4. i. ii. iii.

What do you mean by Network ? What are its goals ? Give two advantage of Bus Topology ? Mention one difference between Circular and Star topology. Give two advantage of open standards. Define (a) Gateway (b) Modem Write any two features of XML What is difference between Radio button and Check box button ? Name any two types of lists in HTML What do you understand by ODBC ? How is JDBC different than ODBC ? What do you mean by dialog? Describe any two forms of Inheritance. Write a program to read a sentence and replace every “The” with “xyz” e.g The sentence “The Taj is the crown of the historical monuments ” should be display as “xyz Taj is xyz crown of xyz historical monuments.” Differentiate between Call by value and Call by reference . What is this keyword ? What is its significance ? Write a method that’s takes a number as argument and display the sum of all the digits in the number . For example if the argument passed is 354 the procedure should display 12 (i.e3+5+4) .Implement the method through a GUI application that obtains a number in a text field , computes the sum of its digits and display in a label. Write a program to design an application that performs Arithmetic operations.

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3

Page 294: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 294

Q.5. i. ii. iii. iv.

What do you mean by Static members? Differentiate between String and StringBuffer objects. What do you mean by functions signature ? Give two advantages of Inheritance.

2 1 2 2

Set 1

SECOND UNIT TEST

SUBJECT – IP (MARKING SCHEME) Max Time :1 ½ Hrs Max Marks : 40

Q1. i ii iii iv v Q2. i ii iii iv Q3. i. ii. iii. iv. Q4. i. ii. iii. Q.5. i. ii. iii.

1 Mark for each correct Answer. 1 Mark for each correct Answer. 2 Marks for correct Answer. 1 Mark for each correct Answer. 1 Mark for each correct Answer. 1 Mark for each correct Answer 2 Mark for correct Answer 1 Mark for each correct Answer 1 Mark for each correct Answer 2 Mark for each correct Answer 1 Mark for each correct Answer 2 Mark for each correct Answer 2 Mark for each correct Answer 1 Mark for each correct Answer 2 Mark for correct Answer 2 Mark for correct Answer 2 Mark for correct Answer 2 Mark for each correct Answer 2 Mark for each correct Answer 1 Mark for each correct Answer

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 1 2 2

Page 295: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 295

BLUE PRINT

Unit / Q Type Unit 1 Unit 2

V. Short Answer 0 1

Short Answer 5 13

Pract. Q. 0 1

Set 2

SECOND UNIT TEST

SUBJECT - IP Max Time :1 ½ Hrs Max Marks : 40

Q1. i ii iii iv v Q2. i ii iii iv Q3. i ii iii iv v Q4. i ii

Define MAC address and IP address . Define the two types of servers. Differentiate between LAN and WAN Give two disadvantage of microwave. Differentiate between Tree type font and Open type font. What do you mean by variable? Give 2 Examples. Name and define elements that control a loop. Give the output of the following code segment - int i , j ,k ; for (i=1 ; i <=4 ; ++i) { { for (k=1, j=i ; k<=i ; k++, j+=2) System.out.print (“ ”+j) System.out.prinln() ; } Explain any three methods of Combo box control Diffrentiate between Method Declaration and Invocation. What does it means that a member of class is “static”? Define package. Given a package named EDU.student. How would you import a class named Test contained in this package ? Write one line statement. Illustrate the concept of function overloading with the help of example. Name the dialog for which Java string provides support Write six steps to create database connectivity applications Which packages classes must be includes as part of your java application

2 2 2 2 2 2 3 2 3 2 2 2 2 2 3 1

Page 296: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 296

iii iv v

for database connectivity for work. What is protocol ? How do protocol effect Internet? What is difference between <BASEFONT> and <FONT> tag. Name any four control types available in HTML.

2 2 2

Set 2

SECOND UNIT TEST

SUBJECT – IP (MARKING SCHEME) Max Time :1 ½ Hrs Max Marks : 40

Q1. i ii iii iv v Q2. i ii iii iv Q3. i ii iii iv v Q4. i ii iii iv v

1 Mark for each correct Answer 1 Mark for each correct Answer 1 Mark for each correct Answer (2 Differences) 1 Mark for each correct Answer 2 Mark for correct Answer 1 Mark for each correct Answer 1 Mark for each correct Answer 2 Mark for each correct Answer Explain any three methods of Combo box control 1 Mark for each correct Answer 2 Mark for each correct Answer 1 Mark for each correct Answer 1 Mark for each correct Answer (1 Mark for example) 2 Mark for each correct Answer 1/2 Mark for each correct Answer 1 Mark for correct Answer 1 Mark for each correct Answer 2 Mark for correct Answer 1/2 Mark for each correct Answer

2 2 2 2 2 2 3 2 3 2 2 2 2 2 3 1 2 2 2

Page 297: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 297

Unitwise Question ANweres for Slow achievers XI CS

Pankaj Singh

PGT – Comp. Sc.

KV Rly. Gandhidham

UNIT – I: COMPUTER FUNDAMENTALS

Q1. What is a computer? A. A computer is an electronic device that can perform a variety of operations in accordance with a set of

instructions called program. Q2. Expand the following:

i) CPU ii) ROM iii) MICR iv) CD-R v) UPS A. (i) CPU : Central Processing Unit

(ii) ROM : Read Only Memory (iii) MICR : Magnetic Ink Character Reader (iv) CD–R : Compact Dist Recordable

(v) UPS : Uninterrupted Power Supply

Q3. What is data? What is the output of data processing system? A. Data are raw facts and figures. Data processing system transforms data into useful information. Q4. What do you mean by CPU? A. The CPU is the control centre for a computer. It guides, directs and governs its performance. It is the

brain of the computer. The CPU has two components which are responsible for different functions. These two components are its Control Unit (CU) and Arithmetic Logic Unit (ALU).

Q5. Discuss memory units in details. A. The least unit of measuring data in computer is a bit. A bit means a binary digit i.e., either 0 or 1. A

number of bits together are used to store data instructions by their combination. A bit is an elementary unit of the memory.

A group of 8 bits is called a byte and a group of 4 bits is called a nibble. One byte is the smallest unit which can represent a data item or a character. Other units of memory are

as follows: 1 KB (Kilobyte) = 1024 bytes 1 MB (Megabyte) = 1024 KB = 1024 x 1024 bytes 1 GB (Gegabytes) = 1024 MB = 1024 x 1024 x 1024 bytes 1 TB (Terabyte) = 1024 GB = 1024 x 1024 x 1024 x 1024 bytes 1 PB (Petabyte) = 1024 TM = 1024 x 1024 x 1024 x 1024 x 1024 bytes Q6. Explain briefly the functions of ALU. A. The Arithmetic and Logic Unit performs all the four arithmetical (+,-,*,/) and some logical (<,<=,>,>=,<

>) operations. When two numbers are required to be added, these numbers are sent from memory to ALU where addition takes place and the result is put back in the memory. In the same way other arithmetic operations are performed.

For logical operations also, the numbers to be compared are sent from memory to ALU where the

comparison takes place and the result is returned to the memory. The result of a logical operation is either TRUE or FALSE. These operations provide the capability of decision-making to the computer.

Page 298: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 298

Q7. Differentiate between primary memory and secondary memory. Give examples of each type of memory. A. The memory inside the CPU is primary memory (main memory) and the memory outside it is known as

secondary (auxiliary) memory. Primary Memory RAM (Random Access Memory) and ROM (Read only Memory) comes under primary memory. RAM is volatile memory and ROM is non volatile memory. All the data and programs must be stored in RAM for execution. But the content of RAM is not permanent. Eg: RAM, ROM.

Secondary Memory Since primary memory has a limited storage capacity and is not permanent, secondary storage devices are used to store large amount of data permanently. There are various types of secondary devices available these days. Example:

Hard disks, Floppy disks � Magnetic Media CD ROMS, DVDs � Optical Media

Q8. What do you mean by Hardware and Software? A. Hardware represents the physical and tangible components of the computer i.e., the components that can

be seen and touched. Examples are mouse, keyboard, printer etc. Software represents the set of programs that govern the operation of a computer system and make the

hardware run. Example – MS Windows, MS Word etc. Further Software can be classified into three categories: � Operating System � Language Processors � Application Software Q9. What do you mean by an operating system? A. An Operating System is a program which acts as an interface between a user and the hardware (i.e., all

computer resources). Examples are Window 98, XP, Vista, Unix, Linux Q10. What do you mean by Language Processors? A. Generally programmers prefer to write their programs in High Level Languages (HLLs) because it is

much easier to code. However, the computer does not understand any language other than its own machine language (binary language). Therefore, it becomes necessary to process a HLL program so as to make it understandable to the computer. The system programs which perform this job are known as language processors.

Q11. What do you mean by Assembler? A. It is an example of language processor. It converts the program written in assembly language into

machine language. Q12. Define the following terms: i) Tracks ii) Sectors A. i) Tracks: Concentric circles on the magnetized surface of the magnetic disks are known as Tracks.

ii) Sectors: The tracks on the disk surface are divided into invisible segments known as Sectors. Q13. What is the difference between an Interpreter and a Compiler? A. Interpreter

This language processor converts a HLL program into machine language by converting and executing it line by line. If there is any error in any line, it reports it at the same time and program execution cannot

Page 299: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 299

resume until the error is rectified. Interpreter must always be present in the memory every time the program is executed as every time the program is run, it is first interpreted and then executed.

Compiler

It also converts the HLL program into machine language but the conversion manner is different. It converts the entire HLL program in one go, and reports all the errors of the program along with the line numbers. After all the errors are removed, the program is recompiled, and after that the compiler is not needed in the memory as the object program is available.

Q14. What are two categories of printers? Which type of printers are more speedy? A. The printers can be classified into the following categories viz impact and non-impact printers:

1. Impact Printers In these type of printers, there is physical contact between the paper and the printer head. Example Dot Matrix Printers (DMPs)

2. Non-Impact Printers In these type of printers, there is no physical contact between the paper and the printer head. The printing take place with some electromagnetic or thermal or laser techniques.

The non-impact printers are more speedy than impact printers.

Q15. What is the difference between Preemptive and Non-Preemptive scheduling? Explain giving its one-one

example. A. Non-preemptive Scheduling

In this scheduling, a scheduled job always completes before another scheduling decision is made. Therefore, finishing order of the job is also same as their scheduling order. Examples FCFS (First Come First Serve), SJF (Shortest Job First) scheduling

Preemptive Scheduling In contrast to non-preemptive scheduling, a scheduling decision can be made even while the job is executing whereas in non-preemptive scheduling, a scheduling decision is made only after job completes the execution. Therefore, preemptive scheduling may force a job in execution to release the processor, so that execution of some other job can be undertaken, in order to improve throughput considerably. Example Round Robin Scheduling.

Q16. What is the difference between a file and a folder? A. A file is a least unit of storing data and a folder is a place where we keep our other files and folders. Q17. What do you mean by Recycle Bin? A. It is something like ‘dustbin’. It temporary stores all deleted files in it. We can restore files later if you

want. File once deleted from Recycle Bin, can not be restored. Q18. What is the difference between ‘copying’ and ‘moving’ files or folders? A. In copying any file or folder is copied to both the places source and destination, but in moving, any file

or folder is deleted from source location and send to destination location. Q19. List some services offered by operating system. A. Some common services provided by operating system are as follows: i) Program Execution ii) Handling Input/Output Operations iii) Manipulation of file system iv) Error Detection and Handling

Page 300: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 300

v) Resource Allocation vi) Acounting vii) Information and Resource Protection Q20. Differentiate between 1’s complement and 2’s complement giving an example of each. A. One’s Complement

Positive numbers are written in their true form and negative numbers are written in their one’s complement form. It is written by converting 0-1 and vice versa

Like: One’s complement of 13 +13 = 0, 000 1101 - 13 = 1, 111 0010

Two’s Complement Positive numbers are written in their true form and negative numbers are written in their two’s complement form. It is written by adding 1 to its one’s complement.

Like: Two’s complement of 13

+13 = 0, 000 1101 - 13 = 1, 111 0011 Working 1’s complement of 13 is 1, 111 0010 Adding 1 to it 1 2’s complement of 13 is 1, 111 0011

Q21. Convert these hexadecimals into octal i) 38AC ii) 7FD6 A. i) (38AC)16 = (34254)8

ii) (7FD6)16 = (77726)8 Q22. What do you mean by sign and magnitude representation? Represent +24 and -14 in it. A. Sign and Magnitude Representation

It is the conventional form for number representation. Integers are represented by their signs (+ or –) and a string of digits which represent the magnitude. +24 = 0,001 1000 -14 = 1,000 1110

Q23. What is the full from of ASCII and EBCDIC? A. ASCII = American Standard Code for Information Interchange EBCDIC = Extended Binary Coded Decimal Interchange Conversion Q24. What is the difference between RAM and ROM? A. RAM

Random Access Memory is a volatile memory. The data is lost when power is switched off. It is temporary in nature.

ROM Read Only Memory is a non volatile memory. The data remains on it even if power is switched off. It is permanent.

Q25. Write a short note on input and output devices.

Page 301: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 301

A. Input Devices are those which are responsible for accepting input i.e. data and instructions from the user. Examples are keyboard, mouse, microphone, scanner etc.

Output Devices

are those which are responsible for producing the output in user readable format. Examples are VDU, printer, plotters etc.

Q26. What do you mean by ‘Cache’ memory? A. The ‘Cache’ memory is a high speed memory available inside CPU in order to speed up access to data

and instructions stored in RAM memory. Q27. Write a short note on PORTS. A. Ports are used to connect external devices to the computer. These are the connecting points of various

device to the computer. Some commonly used ports are as follows: 1. Serial Ports

The serial port transfer data serially a bit at a time. As a result, the serial port needs only wire to transfer 8 bits. The disadvantage is that it takes 8 times longer to transmit a byte. Serial port come in the form of 9-pin or 25-pin male connector. These ports are often known as communication (COM) ports or RS232C ports. They are typically used to connect devices like mouse and modem.

2. Parallel Ports Parallel ports can send or receive a byte (8-bit) at a time. Unlike the serial port, these 8-bits are transmitted parallel to each other. Parallel ports come in the form of 25-pin female connector. Parallel ports are popularly used to connect printer, scanner, CD writer, external hard disk drive etc.

3. USB (Universal Serial Bus) To spare botheration of 8-pin, 25-pin, male, female connectors, the USB has been designed. It gives you a single, standardized, easy-to-use way to connect a variety of devices to a computer. These devices include printers, scanners, digital camera, web cameras etc.

4. AGP Ports The AGP (Accelerated Graphics Port) port is used to connect to graphic card that provides high-speed video performances typically required in games and other multimedia applications. 5. InfraRed Port (IR Port) An IR port is a port, which sends and receives infrared signals from other devices. In this special form of radio transmission, a focused ray of light in the infrared frequency spectrum is modulated with information and sent from a transmitter to a receiver over a relatively short distance. Infrared radiation (IR) is the same technology used to control a TV set with a remote control. It is used in laptops, mobile telephones etc.

6. Bluetooth This technology got its unusual name in honour of Halard Bluetooth, king of Denmark in the mid-tenth century.

It is a telecommunications industry specification that describe how mobile phones, computers and personal digital assistants (PDAs) can be easily interconnected using a short-range wireless connection. Data can be exchanged at a rate of 1 megabit per second and maximum range is 10 meters.

7. PS-2 Port The PS/2 standard, introduced by IBM in 1987, stands for Personal System/2. A PS/2 port is an

electronic receptacle or plug found on computer. It accepts a PS/2 cable with a mini-DIN connector, and is most often used to plug in a keyboard or mouse.

Page 302: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 302

UNIT – II: PROGRAMMING METHODOLOGY

Q1. Explain the terms: i) Prologue ii) Prettyprinting iii) Robustness iv) Guard Code v) Algorithms A. i) Prologue

Comment summarizing the purpose of a program, procedure or a function.

ii) Prettyprinting When program formatting is done to make a program more readable, it is called Prettyprinting. iii) Robustness The ability of a program, to recover following an error and to continue operating within its environment, is called robustness. iv) Guard Code The code which can handle exceptional data errors and operational errors is called guard code.

v) Algorithms The logical sequence of precise steps that solve a given problem, is called Algorithm. Q2. What is a ‘source code’? What is an ‘object code’? A. Source Code

A program in original form i.e. code in the programming language. Object Code Machine code produced by a compiler or assembler from a source code.

Q3. Explain the terms i) Testing ii) Debugging A. Testing & Debugging

Testing is the process of finding errors in a program, and debugging is the process of correcting errors found during the testing process.

Q4. What is echo printing? A. Printing of the input data, as they are read, is called echo printing

Q5. What do you mean by Documentation? A. Documentation refers to written descriptions, specifications, design, code and comment, internal and

external to a program, which make a program more understandable, readable and more easily modifiable.

Documentation must describe the who, what, when, where and how of each system application. The

documentation reduce the costs of production and maintenance. Q6. Write characteristics of a good program.

Page 303: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 303

A. A program written in good style is easily understandable to a reader, therefore, is a good program. Following are the characteristics of a good program:

(i) Effective and efficient The program produces correct results and is faster, taking into account the memory constraints. (ii) User Friendly The program should be user friendly. The program should interact with user by understandable message

and user’s work should be as low as possible. (iii) Self-Documenting Code A good program must have self-documenting code. The source code that uses meaningful names for

constant, variable and subprogram identifiers to clarify their meaning in the program, is called self-documenting code.

(iv) Reliable The program should be reliable i.e. it must be able to handle unexpected situations like wrong data or no

data. The program should display proper error messages. (v) Portable The program should be portable i.e. it should be able to run on different platforms.

Q7. Write a short note on program maintenance. A. Program maintenance refers to the modification of a program, after it has been completed, in order to

meet changing requirement or to take care of errors that show up. There could be four kinds of maintenance:

(i) Corrective Maintenance ii) Adaptive Maintenance (iii) Preventive Maintenance iv) Perfective Maintenance Q8. Why are logical errors harder to locate? A. In spite of logical errors’ presences, the program executes without any problem but the output produced

is not correct. Therefore, each and every statement of the program need to be scanned. Thus the logical errors are harder to locate.

Page 304: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 304

UNIT – III: INTRODUCTION TO C++

Q1. Differentiate High Level Language and Low Level Language. A. Low Level Languages (LLL) i.e. machine language and assemble language are machine-oriented and

require extensive knowledge of computer circuitry. Machine language, in which instructions are written in binary code (using 1 and 0), is the only language the computer can execute directly. Assembly language, in which instructions are written using symbolic names for machine operations and operands, makes programming less tedious than machine language programming.

High Level Language (HLL), on the other hand, offer English like keywords, constructs for sequence,

selection and iteration and use of variable and constants. Thus it is very easy to program with such languages compared to LLL. The programs written in HLL are converted into machine language using compiler or interpreter as computer can work with machine language only.

Q2. Differentiate between object oriented programming and procedural oriented programming with the help of examples of each. A. Procedure Oriented Programming

A program in a procedural language is a list of instructions where each statement tells the computer to do something. The focus is on the processing. There is no much security for the data. Object Oriented Programming The object oriented approach views a problem in terms of objects involved rather than procedure for doing it. In object oriented programming, object represents an entity that can store data and has its interface through functions. All data is openly available to all data and functions enclosed within objects. Functions in the program new objects communicate with one another. OOP is so closer to the real life. And also it consists many features like 1. Data Abstraction 2. Data Encapsulation 3. Modularity 4. Inheritance 5. Polymorphism 6. Data hiding.

Q3. Explain these terms giving example of each. i) Modularity ii) Object iii) Attribute iv) Abstraction v) Polymorphism vi) Encapsulation vii) Inheritance A. i) Modularity

Breaking down a big module into small parts or dividing any task into small logical parts is known as Modularity. Like any book is divided into units, units into chapters. So concentrating on chapters and after completing them we complete the entire book.

ii) Object An object is an identifiable entity with some characteristics and behaviour. It is an instance of a class. Example: Maruti 800 is a car. So in this example Maruti 800 is an object of class car. iii) Attribute The properties of any class is known as an attribute. Like if we have student class, so its attributes would be rollno, name, fathername, address, city, phone etc. iv) Abstraction

Page 305: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 305

It refers to the act of representing essential features without including the background details or explanations. v) Polymorphism Ability of an object to behave differently in different circumstances is termed as Polymorphism. Example a person has to play different roles in his life. He is father to his son, son to his father, husband to his wife, brother to his sister, student to his teacher and so on. vi) Encapsulation The binding or wrapping of member data and functions into one unit is known as Encapsulation. Example is a class. vii) Inheritance It is the capability of one class of things to inherit capabilities or properties from another class. Example: In the given figure Human is “Base” class and “Male” & “Female” are “Derived” classes. Base class is also known as Super or Parent class whereas Derived class is also known as Sub of Child class.

Q4. Write some advantages and disadvantages of OOP. A. OOP has following advantages over the conventional programming approaches: a) It models real world well. b) With OOP, programs are easy to understand.

c) OOP offers classes’ reusability. Already created classes can be reused without having to write them again. d) OOP facilitates Quick Development as parallel development of classes is possible.

Although OOP has proved revolutionary in software development yet it has some disadvantages too. These are: a) With OOP, classes tend be overly generalised. b) The relations among classes become artificial at times. c) The OOP programs’ design is tricky. d) Also one needs to do proper planning and proper design for OOP programming.

Q5. Name the three categories of errors? Explain one of them in brief. A. Three types of categories are: i) Compile-Time error ii) Run-Time error iii) Logical error.

Compile-Time Error: Errors that occur during compile-time, are compile-time errors. Example cout<<”Hello ;

Q6. What is the difference between semantics error and syntax error? Give an example of each. A. Syntax Errors

Syntax errors occur when rules of a programming language are misused. Syntax refers to formal rules governing the construction of valid statements in a language.

Eg: int a, b //Did not keep ; (semicolon) at the end of statement. Semantics Error

Page 306: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 306

Semantic errors occur when statements are not meaningful. Semantics refers to the set of rules which give the meaning of a statement.

Eg: X * Y = Z; (Siva plays Guitar is Syntactically and Semantically correct but Guitar plays Siva is Syntactically correct

but Semantically incorrect). Q7. Write introductory note on C++. A. The C++ programming language was developed at AT&T Bell Laboratories in the early 1980s by

Bjarne Stroustrup. Q8. Which one condition, every C++ program must fulfil? A. Every C++ program must have a function named main(). The program execution begins at main(). So, if

function main() is missing then there shall be no execution of the statements. Q9. What is the difference between ‘h’ and “h” in C++? A. ‘h’ is a character literal where as “h” is a string literal. Q10. What is the difference between 0, 0.0, ‘\0’? A. 0 is decimal integer constant, 0.0 is floating constant and ‘\0’ is end of string or null terminator. Q11. What do you mean by comments in the program? Explain giving example. A. Comments are non-executable statements in the program. These are of the following type: Single Line Comment

Are those which has only one line as // This is a single line comment Multiple Line Comment

Are those which contain one or more than one lines in it as /* This is Multi line Comment statement */ Q12. What is the difference between / and % in C++? A. / is integer division and % is remainder operator in C++. Q13. What kind of constants are the following: 14, 011, 0x2A, 17? A. 14 – Integer 011 – Octal 0x2A – Hexadecimal 17 – Integer Q14. What is meant by token? Name the tokens available in C++. A. A token is a smallest unit of data in C++. Examples Keywords, Identifiers, Literals Q15. What is the distinction between 33L and 33? A. 33L is long type constant whereas 33 is of integer type. Q16. What is the difference between a keyword and an identifier? A. A keyword is a special reserve word in the programming and it can not be used as an identifier name.

Whereas an identifier is a building block of a program which is used to identify a part of program like function name, variable name, class name etc.

Page 307: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 307

Q17. Explain the concept of pointer and its purpose. A. Pointer

A pointer is a variable which holds address of any simple variable. It is declared by prefixing an * sign before any variable. As int *x;

Q18. What do you mean by keyword ‘enum’? Explain giving an example. A. It is short form of enumeration. An alternative method for naming integer constants is often more

convenient than const. It can be done using enum. For example: enum{START, PAUSE, GOO};

Q19. Write an equivalent C++ expression for the following:

i)

2

2

1ftutY +=

ii) x

exxY2logsin −+=

iii) baba +=+

A. i) Y=u*t + (f * t * t)/2;

ii) Y=sqrt(sin(x) + log(x) – exp( 2*x)) iii) abs(a) + b = a + abs(b) 1

Q20. What do you mean by a variable? What are lvalue and rvalue? Explain giving example. A. A variable is named memory location which is used to store some data. lvalue is its location value and

rvalue is its real value. Example: If we declare int x=20; Then if it is stored at 1000

Q21. What do you mean by an operator? A. An operator is a specific symbol which is used to perform some task. Objects of the operation are

referred to as operands. Q22. What is the difference between = and = = sign? A. = sign is assignment operator which is used to assign a value to any variable. Ex. int x=10.

whereas = = is relational operator which is used to check equality between variable and a value.

Ex. if (x = =10) cout<<”Hello”; else cout<<”Bye”; Q23. Distinguish between unary, binary and ternary operator with examples. A. unary operator

are those operator which work with only one operands. Like i++.

Binary operator are those operator which work with two operands. Like x + y.

Ternary operator are those operator which work with three operands. Like z=(x>y)?x:y;

Page 308: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 308

Q24. What is the function of logical operators? Write an expression involving a logical operator to test if marks are 55 and grade is ‘B’ and exam is “computer”.

A. Logical operators are used to join two or more conditions in a program. if(marks==55 && grade==’B’ && strcmp(exam,”computer”)==0)

Q25. What do you mean by an expression? A. An expression in C++ is any valid combination of operators, constants, and variables. Q26. What is Fundamental Data Types? A. Fundamental (atomic) data types are those that are not composed of other data types. Q27. Differentiate between unions and structures with help of an example. A. Structure

A structure is a collection of elements(variables) of same or different data types. The keyword struct is used to construct a structure. Syntax: struct structtag { datatype variable; datatype variable. ----- ----- }structure variables; Eg:

struct student {

int rollno; char name[26]; int m[3]; int total; float avg; }s1,s2;

struct s3;

Referencing Structure variables: Structurevariable.elementname; Eg: s1.rollno; s2.name; s3.marks[2];

Union A union is a memory location that is shared by two or more different variables (generally

shared by two or more different times). Eg: union share {

int i; char ch; };

union share us; us.i = 20;

Page 309: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 309

cout<<us.ch; At any point, you can refer to the data stored in a us as either an integer or a character.

Difference between a union and a structure � A union is a memory location that is shared by two or more different variables. � A structure have separate memory location for every variable. In the above example for structure variable S1, 40 Bytes will be reserved and For union variable us, 2 bytes will be reserved. Q28. What do you mean by Type Conversion? A. The process of converting one predefined type into another is called type conversion. It is of two types:

(i) Implicit Type Conversion An implicit type conversion is a conversion performed by the compiler without programmer’s

intervention. An implicit conversion is applied generally whenever differing data types are intermixed in an expression, so as not to lose information.

In C++ compiler converts all operands upto the type of the largest operand, which is called type promotion. Example

void main() { int x=10, y; char z=’A’; y=x+z; cout<<y; } In the above program, compiler will perform type promotion and value of z will be taken as 65 (ASCII

value) and output will be 75.

(ii) Explicit Type Conversion An explicit type conversion is user-defined that forces an expression to be of specific type. It is done as

shown below: new type = (type ) expression; Example: for (int i=65; i<=70; i++) cout<<(char)i<<”\t”; The output of above program will be A B C D E F Q29. Construct logical expressions to represent the following conditions: (a) weight is greater than or equal to 115 but less than 125 (b) x is even (c) donation is in the range 4000-5000 or guest is 1 (d) ch is an uppercase letter A. (a) weight>=115 && weight<125 (b) x%2==0 (c) donation>=4000 && donation<=115 || guest=1 (d) ch>=’A’ && ch<=’Z’ Q30. The following is illegal. Why? How would you correct it? main() {

Page 310: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 310

int i=j=k=10; } A. This is illegal because multiple assignment statement requires pre-declaration of variables. Therefore,

the correct way to do so it as shown below: main() { int i, j, k;

i=j=k=10; } Q31. Which header file must be included in the program to make use of C++’s built-in mathematical

functions? A. #include<math.h>

Page 311: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 311

UNIT – IV: PROGRAMMING IN C++

Q1. What do you mean by an array? Write at least two benefits of using array. A. Array is a contiguous memory cell which is referred by a common name and have homogeneous

elements in it. All the elements are distinguished by their index or subscript number. If an array contain N elements it, the valid index number ranges from 0 to (N-1). Benefits of using array

i) We can store large amount of data. ii) All data is referred by a common name. iii) All data occupies memory in a contiguous manner

Declaration Datatype variableName[size]; Example: int A[5];

Initialization A[0]=10; A[1]=15; A[2]=7; A[3]= -14; A[4]=125; or int A[5]={10, 15, 7, -14, 125};

User Input for(int i=0; i<5; i++) cin>>A[i]; Q2. Write a short note on 2D array. A. 2D array is found in form of matrix which has rows and columns.

Declaration Datatype variableName[rows][column]; Example: int A[3] [3];

Initialization A[0][0] =10; A[0][1]=5; A[0][2]=2; A[1][0] =20; A[1][1]=8; A[1][2]=15; A[2][0] =30; A[2][1]=7; A[2][2]=71;

or int A[3][3]={10, 5, 2, 20, 8, 15, 30, 7, 71}; or int A[3][3]={{10, 5, 2}, {20, 8, 15}, {30, 7, 71}};

User Input for(int i=0; i<5; i++) { for(int j=0; j<3; j++) { cin>>A[i][j]; } } Q3. What is meant by index of an element? How are they numbered? A. The index number is used to distinguish elements present in the array. They are numbered from 0 to (N-

1), if array contain N elements in it.

Page 312: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 312

Q4. How does C++ view a string as? Which character marks the end of a string? A. A string is an array of characters. End of string is ‘\0’. Q5. What is difference between if-else and switch statement? Explain giving example. A. The if-else and switch both are selection statements and they both let you select an alternative out of given many alternatives by testing an expression. But there are some differences in their operations. (i) The switch statement differs from the if statement in that switch can only test for equality whereas if can evaluate a relational or logical expression i.e. multiple conditions. (ii) The switch statement selects its branches by testing the value of same variable whereas the if else construction lets you use a series of expressions that may involve unrelated variables and complex expressions. (iii) The if-else can handle ranges whereas switch cannot. Each switch case label must be a single value. (iv) The if-else statement can handle floating point tests also where as switch cannot handle floating point tests. (v) The switch case label value must be a constant. So, if two or more variables are to be compared, use if-else.

Syntax of if-else is:

if (condition) { //task to do } else

{ //task to do }

Syntax of switch is: switch(variable name) { case constant-value: // task to do break; case constant-value: // task to do break; : : : : : default: //task to do } Q6. What do you mean by driver function? A. In C++, the program execution starts with the first statement of main() and ends with the last statement

of main(). Therefore, the main() is also called driver function as it drives the program. Q7. What do you mean by entry controlled and exit controlled loop? Explain A. Entry Controlled loop

Page 313: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 313

means while loop. It check the condition first then execute the statement. Syntax is initialization of variable while(condition) { //task to do update expression }

Exit Controlled loop means do-while loop. It execute the statements first then check the condition. Syntax is

initialization of variable do{ //task to do update expression } while(condition); Q8. What do you mean by an infinite loop? How it is done in C++? A. loop which is running infinitely or never ending or running continuously is known as an infinite loop.

Example : i) for(int x=5; x>0; x++) { cout<<”\nHello”; } ii) for( ; ; ) { cout<<”\nHello”; } Q9. What is fall through? Explain with example. A. Absence of break statement in switch case causes all cases to execute. It is known as fall

through. Example: int I; switch (I) { case 0: cout<<”Zero”; case 1: cout<<”One”; case 3: cout<<”Three”; default: cout<<”Bye”; } If I is passed as 1, then output would be: OneThreeBye as there is no “break” in case 1 statement.

Q10. What is dangling problem? Explain in brief. A. The nested if-else statement introduces a source of potential ambiguity referred to as dangling-else

problem. This problem arises when in a nested if statement, number of ifs is more than the number of else clause. The question then arises, with which if does the additional else clause property matchup. For example

if(ch>=’a’) //outer if statement if(ch<=’z’) //inner if statement cout<<”\nHello”; else

Page 314: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 314

cout<<”\nBye”; The indentation in the above code fragment indicates that programmer wants the else to be with the

outer if. However, C++ matches an else with the preceding unmatched if. In this case, the actual evaluation of the if-else statement will be as shown below:

if(ch>=’a’) if(ch<=’z’) cout<<”\nHello”; else cout<<”\nBye”; In nested if statement, a dangling else statement goes with the preceding unmatched if statement. Q11. What are data types? Differentiate ADT and UDT? A. Data types are means to identify the type of data and associated functions of handling it.

ADT are Abstract Data Types which are provided by the language where as UDT are Userdefined Data Types which are created by user using these ADTs

Q12. Convert the following if-else to a single conditional statement: if(qty >=20) order=max + 5; else oder=max; A. order=(qty >=20)? (max+5) : max; Q13. What do you mean by a function? How many types of functions we have? A. A Function is a unit which contains one or more statement and referred by a name which can be later on

used by calling its name. It is also known as procedure, sub program, sub routine etc. Functions are of two types i.e. i) System defined & ii) User defined

Q14. What do you mean by Function Prototype? A. Function Prototype is a declaration of the function that tells the program about the type of the value

returned by the function and the number and type of arguments. Example int absval(int); int findSum(int, int, int); Q15. What are the three steps in using a function? A. Before using a function in C++, three things that are required are: i) Function declaration (i.e. prototype) to specify the function’s interface to the program. ii) Function definition to tell the program about what and how a function is doing. iii) Function call to invoke the function. Q16. Write a program to check whether the given number is palindrome or not. A. #include<iostream.h>

void main() { int n, r, old;

Page 315: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 315

cout<<”\nEnter a number to check :”; cin>>n; old=n; while(n>0) { r=n%10; n=n/10; rev=rev*10 + r; } if (rev = = old) cout<<”\nThe number is palindrome”; else cout<<”\nThe number is not a palindrome”; } Q17. Write a program to check whether the given number is prime or not. A. #include<iostream.h>

void main() { int n, i, ctr=0; cout<<”\nEnter a number to check :”; cin>>n; for (i=1; i<=n; i++) { if( n%i ==0) ctr++; } if (ctr==2) cout<<”\nThe number is prime number ”; else cout<<”\nThe number is not a prime number ”; } Q18. Write a program to check whether the given string is palindrome or not. Example NITIN A. #include<iostream.h> #include<string.h> void main() { char inp[20], op[20]; ini i, j=0 cout<<”\n Enter a word :”; cin>>inp; for(i=strlen(inp) – 1; i>=0; i--) {

Page 316: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 316

op[j]=inp[i]; j++; } op[j]=’\0’; if(strcmp(inp, op)= =0) cout<<”\n The entered string is a palindrome”; else cout<<”\n The entered string is not a palindrome”; } Q19. Write structure definitions for structures containing the following: i) rollno, name, grade ii) itemno, name, price, monthly sales for last 4 months A. i) struct student

{ int rollno, char name[20], grade; };

ii) struct item { int itemno, sale[4]; char name[20]; float price; };

Q20. Name the header files, to which following built-in functions belong: i) isalnum() ii) exit() iii) strlen() iv) pow() A. i) isalnum() – ctype.h

ii) exit() – process.h iii) strlen() – string.h iv) pow() – math.h Q21. What do you mean by ‘sorting’ and ‘searching’? A. Sorting

Arrangement of data either in ascending or descending order is known as sorting. Available sorting techniques are bubble sorting, insertion sorting, selection sorting, quick sorting, merge sorting etc.

Searching To search a particular element in any array is known as searching. Available searching techniques are

linear and binary search technique. Q22. What is Actual and Formal Parameter in context of functions? Explain giving example. A. Actual Parameters

are those which appear in function call statement and Formal Parameters are those which appear in function definition statement. Example

Page 317: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 317

void printCube(int y) // Here y is formal parameter { int y=pow(y,3); cout<<”\n Cube is “<<y; } void main() { int m; cout<<”\n Enter a number :”; cin>>m; printCube(m); // Here m is actual parameter } Q23. What do you mean by Function Overloading? Explain giving example. A. Function Overloading

When we have two or more functions having same name but different in their function signature (parameters) are knows as overloaded functions. Example:

void print() { cout<<”hello”; } void print(int x) { for(int y=0; y<x; y++) { cout<<”hello”; } } Q24. Differentiate between call by value and call by reference with help of an example.

A. (i) In call by value, actual arguments will be copied into the formal parameters. In call by reference, formal parameters are references to the actual arguments.

(ii) In call by value, if any modification is occurred to the formal parameter, that change will not reflect back to the actual argument. In call by reference, if any modification is occurred to the formal parameter (reference to the actual argument), the actual argument value will be changed. (iii) We should go for call by value when we don’t want to modify the original value. We should go for call by value when we want to modify the original value. (iv) Example: void Change(int a, int &b) { a= 2*a;

Page 318: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 318

b=20; } Here a is called by “call by value” method and b is called by “call by reference” So as the value of a is changed, actual argument for a will not be changed, as the value of b is changed, actual argument for b will be changed

Q25. What is the difference between linear and binary search technique? Explain in brief. A. Linear Search

This search technique works on any kind of data whether sorted or unsorted. In this technique, each element is checked with each element of the array.

Binary Search This search technique works only on sorted data. In this technique, the array is halved and the element is checked in any part of the array.

Q26. Write a short note on preprocessor directive. A. The preprocessing phase of a C++ program occurs before a program is compiled. The C++ preprocessor is a program that is executed before the source code is compiled.

Preprocessor commands are called DIRECTIVES, and begin with a hesh symbol (#). No white space should appear before the #, and a semi colon is NOT required at the end. The #define preprocessor allows us to define symbolic names and constants e.g. #define PI 3.14159

Q27. Write a program to find the roots of a quadratic equation. A. #include<iostream.h> #include<conio.h> #include<math.h> void main( ) {

clrscr( ); double r1, r2, b, a, c, d; cout<<"\nEnter the coefficients of equation : "; cin>>a>>b>>c; d=b*b – 4 * a * c; if(d==0) { cout<<"\nRoots are real and equal "; r1= - b /2 * a; r2= - b /2 * a; cout<<”\n They are “<<r1<<” “<<r2; } else if(d>=0) { cout<<"\nRoots are real and unequal"; r1= ( - b + sqrt (d) )/2 * a; r2= ( - b - sqrt (d) )/2 * a;

Page 319: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 319

cout<<”\n They are “<<r1<<” “<<r2; } else cout<<"\nRoots are complex. i.e. imaginary"; getch( ); }

Q28. Write a program to print the diagonal (left & right) elements of an NxN matrix. A. //Program to print the left and right diagonal element of an NXN matrix #include<iostream.h> #include<conio.h> #include<iomanip.h> void main( ) {

int A[10][10]; int i, j, N; clrscr( ); cout<<"\nHow many rows and columns required for matrix: "; cin>>N; cout<<"\nEnter "<<N*N<<" elements: "; for(i=0;i<N;i++) { cout<<"Enter the elements into Row "<<i+1<<": "; for(j=0;j<N;j++) cin>>A[i][j]; } clrscr( ); cout<<"\nThe entered elements in the matrix are: \n"; for(i=0;i<N;i++) { for(j=0;j<N;j++) cout<<A[i][j]<<"\t"; cout<<endl; } cout<<"\n\n\nThe elements which are belongs to only diagonals...\n"; for(i=0;i<N;i++) { for(j=0;j<N;j++) if((i==j)||((i+j)==(N-1))) cout<<setw(6)<<A[i][j]; else cout<<" "; cout<<endl; } getch( ); }

Q29. Write a program to find the factorial of a number using recursive function.

Page 320: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 320

A. #include<iostream.h> #include<conio.h> long f=1; long factorial(int n) { if (n==0) return f; else f=n*factorial(n-1); } void main( ) {

clrscr( ); long num; cout<<"\nEnter the number to which you want to find factorial: "; cin>>num; cout<<"\nThe factorial of the number = "<<factorial(num); getch( ); }

Q30. Write a program to find the total number of characters, lines and words in a paragraph of text. A. #include<iostream.h> #include<conio.h> #include<stdio.h> void main( ) {

char str[300]; int i, charcount=0, words=1, lines=1; clrscr(); cout<<"\nEnter the Paragraph ie message: \n"; gets(str); for(i=0; str[i]!='\0'; i++) { charcount++; if(str[i]==' ') words++; if (charcount%80==0) lines++; } cout<<"\nNumber of Characters in the entered message: "<<charcount; cout<<"\nNumber of Words in the entered messge: "<<words; cout<<"\nNumber of Lines in the entered message: "<<lines; getch( ); }

Q31. Write a program to sort an array on N numbers in ascending order. Avoid duplication of elements. A. #include<iostream.h> #include<conio.h> void main( ) { clrscr( );

int A[20], N, i, j, temp;

Page 321: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 321

cout<<”\nEnter the number of elements:”; cin>>N; for(i=0;i<N;i++) cin>>A[i]; cout<<"The Elements in the array before sorting…. "; for(i=0;i<N;i++) cout<<A[i]<<'\t'; //Bubble sort technique for(i=0; i<N-1; i++) { for(j=0;j<(N-1)-i ;j++) { if(A[j]>A[j+1]) { temp=A[j]; A[j]=A[j+1]; A[j+1]=temp; } } } cout<<"The Elements in the array after sorting…. "; for(i=0;i<N;i++) cout<<A[i]<<'\t'; }

Q32. Find the output of the program: struct PLAY { int Score, Bonus; }; void calculate(PLAY &P, int N=10) { P.Score++; P.Bonus+=N; } void main() { PLAY PL={10, 15}; calculate(PL,5); cout<<PL.Score<<":"<<PL.Bonus<<endl; calculate(PL); cout<< PL.Score<<":"<<PL.Bonus<<endl; calculate(PL,15); cout<< PL.Score<<":"<<PL.Bonus<<endl; }

A. 11:20 12:30 13:45

Page 322: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 322

Q33. What output will the following code fragment produce? if ( x – 15 > 6 ) cout<<”Please enter again \n”; else cout<<”Promise, this is the last time \n”; cout<<”Thank God !!”; if the value of x is i) 25 ii) 18

A. i) Please enter again Thank God !! ii) Promise, this is the last time Thank God !!

Q34. Write a function which input a string and a character as parameter and return the frequency of character in the string. A. int func(char a[ ], char ch)

{ int i, ctr=0; for(i=0; i<strlen(a); i++) { if(a[i]==ch) ctr++; } return ctr; }

Q35. Write a program to input a character and print whether it is a lowercase, uppercase, digit or a special character. A. void main()

{ int ch; cout<<”\n Enter a character to check :”; cin>>ch; if(ch>=’A’ && ch<=’Z’) cout<<”\n It is upper case “; else if(ch>=’a’ && ch<=’z’) cout<<”\n It is lower case “; else if(ch>=’0’ && ch<=’9’) cout<<”\n It is a digit case “; else cout<<”\n Special letter ”; }

Q36. Find the output of the program: #include<iostream.h> #include<conio.h> struct three_d { int x,y,z; }; void movein(three_d &t, int s=1)

Page 323: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 323

{ t.x+=s; t.y-=s; t.z+=s; } void moveout(three_d &t, int s=1) { t.x-=s; t.y+=s; t.z-=s; } void main ( ) { clrscr(); three_d t1={10,20,5}, t2={30,10,40}; movein(t1); moveout(t2,5); cout<<t1.x<<","<<t1.y<<","<<t1.z<<endl; cout<<t2.x<<","<<t2.y<<","<<t2.z<<endl; movein(t2,10); cout<<t2.x<<","<<t2.y<<","<<t2.z<<endl; getch(); }

A. 11, 19, 6 25, 15, 35 35, 5, 45

Q37. Write a program to input a complete name to print in the given format Input : PANKAJ SINGH Output : P. SINGH Input : RAJ KUMAR SHARMA Output : R. K. SHARMA

A. #include<iostream.h> #include<ctype.h> #include<string.h> void main() { char inp[80], tmp[20], wrd[20]; int l, i, j=0, p=0, pos; cout<<"Enter a line :\n"; cin.getline(inp,80); l=strlen(inp); for(i=0; i<l; i++) { if(islower(inp[i])) inp[i]=toupper(inp[i]); } for(i=0; i<l; i++) { if(inp[i]!=' ') { tmp[j]=inp[i]; j++;

Page 324: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 324

} else { tmp[j]='\0'; j=0; wrd[p]=tmp[0]; p++; wrd[p]='.'; p++; } } for(i=l; i>=0; i--) { if(inp[i]==' ') { pos=i; break; } } for(i=pos; i<=l; i++) { wrd[p]=inp[i]; p++; } cout<<"\nShort name is : "<<wrd; }

Q38. Write a program to input a line of text to print all vowel pairs present in it. A. #include<iostream.h>

#include<conio.h> #include<string.h> int isVowel(char a) { char v[]="aeiouAEIOU"; int i, flag=0; for(i=0; i<10; i++) { if(v[i]==a) { flag=1; break; } } return flag; } void main() { clrscr(); char str[100]; int i, p1, p2; cout<<"\nEnter a line of text :"; cin.getline(str, 100); for(i=0; i<strlen(str)-1; i++) {

Page 325: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 325

p1=isVowel(str[i]); p2=isVowel(str[i+1]); if(p1==1 && p2==1) cout<<str[i]<<str[i+1]<<endl; } getch(); }

Page 326: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 326

Unitwise Question Anweres for Slow achievers XII CS

Kapil Sehgal

PGT – Comp. Sc.

KV ONGC Ankleshwar

Unit 1st - Chapter 1

st

Q. 1. What is the call by value and call by reference? Explain with code Ans : A function can be invoked in two manner. Call by value and Call by reference.. The Call by value method copies the values of actual parameters into formal parameters. It means the function creates its own copy of arguments values and then uses them. Ex. #include<iostream.h> void main() { int cube(int); int ,x=4; cube(x); // Here x is the actual parameter; cout<<x; } void cube(int t) // Here t is format parameter. Here value of x is just copied into t { return (t*t*t); } The Ouptut is 4 The call by reference method uses a different mechanism. In place of passing a value in the function being called a reference to original variable is passed. Here reference is an alias means different names for a predefined variable. By this concept the same value can be accessed by any of the two names. This means both variables names referred the same location in memory. If we change the value of one variables other variable reflect the changes. #include<iostream.h> void main() { int cube(int); int x=4; cube(x); // Here x is the actual parameter; cout<<s; } void cube(int &t) // Here t is format parameter. Here value of x is just copied into t { return (t*t*t); } The Output is 64 Q.2 What is the difference between ‘while’ and ‘do – while ‘ loop ?

Page 327: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 327

Ans There are basically only one difference between them but the differences are (1) ‘while’ loop is entry control loop and ‘do while’ is exit control loop. (2) ‘while’ loop statements can not sure to execute at least once, but the ‘do while’ loop statements

must execute at least once. (3) Syntax are as follows

a. while loop while(condition) loop body;

b do while do { Loop body } while (condition) Q.3 What is the purpose of header files in a program. Ans. C/C++ provides many functions for general uses and classified according to their behavior. The definition of these built in function are written in a file called the header files. If we need to access these function in our program we must include the corresponding header files in our program. Q.5 What are unary operators? Ans. Those operators which have single side operand is called unary operator. These operators are ++ (called increment operator) and --(called decrement operator) These operators can be applied in two ways - PRE and POST Pre Increment means – First Increment the variable and then execute the expression Post Increment means – First execute the expression and then increment the variable. Similarly

Pre decrement means – First decrement the variable and then execute the expression Post decrement means – First execute the expression and then deccrement the variable. Ex – Let a =5 and b =60; then b=a++

In this expression post increment is used so first assigned the value of a to b and increment the variable a. So value of a will 6 and b will 5

Unit 1st - Chapter 2

nd

Q.1 What is procedural programming? Also write its drawbacks Ans. A programming paradigm defines the methodology of designing and implementing programs sing the key features and building blocks of a programming language. Procedural Programming is susceptible to design changes – In this type of languages whenever the definition of type changes the function referring to this type must also be changed

struct student {

int rollno; \char name[20]; int clas

};

Page 328: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 328

Drawbacks

Procedural Programming leads to increased time and cost overheads during design changes - As design changes lead to many modification in the code. This leads to increased time and cost overhead at times. Q.2 What is Object based programming Methods? Explain also write its advantages and Limitations Ans: Object Based programming is newer paradigm that implements some features of object oriented programming, but not all. In Object based programming data and its associated meaningful functions are enclosed in one single entity as CLASS. Classes enforce information hiding and abstraction. In other words – Users of a class are allowed to access its interface, but they cannot access its implementation details In object based programming whenever there is any changes in the definition of type, user interface remains unaffected generally Object based programming is subset of Object Oriented Programming :- The object based programming can be thought of as subset of object oriented programming as it also implement the some of the features of OOP, such that Information Hiding, Abstraction, Classes, Function overloading etc. But it is not implementing the Inheritance and Polymorphism.

Advantages:- � It overcome the shortcomings of Procedural Programming � It localize changes and hides implementation details from user. � It Support user defined data type

Limitations:- � This can not represent the real world problems. � It does not hold the features of Inheritance-due to this reusability is not present. � It does not hold the features of Polymorphism

Q.3 What is Object Oriented Programming? Ans. The Object Oriented programming paradigm is superset of object based programming. It is offer all the features of Object based programming and overcomes its limitation by implementing INHERITANCE. So that real world problems can be represented programmatically. The object oriented programming has been developed with a view to overcome the drawback of conventional programming approaches. The OOP approach is based on the concepts that help it attain its goal of overcoming the drawback or shortcoming of conventional programming approaches Features of OOPs.:- (1) Data Abstraction (2) Data Encapsulation (3) Modularity (4) Inheritance (5) Polymorphism. Q.4 How to implements the objects in c++. Ans. Our aim is implement real world object in the form of a software objects

� Real world objects have physical characteristic (state) and behavior e.g. Motor car has � Characteristic – Current Gear, Two wheel, No of gears � Behaviors – Braking, Accelerating, Changing gears � The software object also have state and behaviors � These state maintained through variables and data items � The Behaviors implements through functions.

Q.5 Write Advantages and Disadvantages of OOPs. Ans: Advantages:

� The advantages offered by OOP are : � Re-Use of Code – Linking of code to objects and explicit specification of relations between objects

allows related objects to share code.

Page 329: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 329

� Ease of Comprehension- OOP codes are more near to the real world models. � Ease of Fabrication and Maintenance – Abstraction and Encapsulation allow for very clean design, when

an object is going into disallowed state. � Easy redesign and extension – We can easily enhanced the design without and extra Burdon.

Disadvantages:- � There are many demerits here � With OOP, Classes tend to overly generalized � The relation among classes becomes artificial at times. � The OOP program design is tricky � Also need to proper planning and proper design for OOP programming.

Unit 1st - Chapter 3

rd

Q.1 What is function Overloading Ans When several function declarations are specified for a single function name in the same scope the name is said to be overloaded. C++ allows functions to have the same name if it can distinguish them by their number and type of arguments. For example two function are different for c++ float divide(int a , int b); float divide(float y, float z); Here first divide function takes two int arguments and second divide function takes two float arguments. This is known as function overloading. A function name having several definition that are differentiable by the number or type of their arguments. Q.2 Why function overloading is needed? Ans Function Overloading not only implements polymorphism but also reduces number of comparisons in a program and thereby makes the program run faster. Q.3 What are the restrictions on overloaded functions? Ans: Several restrictions governs an acceptable set of overloaded functions:

(1) Any two function in a set of overload functions must have different argument lists. (2) Overloading functions with argument lists of the same types, based on return type alone, is an

error. (3) Member function cannot be overloaded solely on the basis of one being static and the other non

static. (4) Typedef declaration do not define new types; they introduce synonmyms for existing types. They

do not affect the overloading mechanism Q.4. How would you compare default argument and function overloading? Ans. With default argument, default value can be provided in the function prototype itself and the function may be called even if an argument is missing. But there is one limitation with it. If you want to default a middle argument then all the arguments on its right must also be default..

Unit 1st - Chapter 4

th

Page 330: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 330

Q.1 How does a class enforce data-hiding, abstraction and encapsulation? Ans. A classes bind together data and its associated function under one unit thereby enforcing encapsulation as encapsulation means wrapping up data and associated function together into a single unit. A class groups its members into three sections ;.private, protected and public. The private and protected members remain hidden from outside world. Thus through private and protected members a class enforce data hiding. The outside world is given only the essential and necessary information through public members, rest of the things remain hidden, which is nothing but abstraction. As abstraction means representation of essential features without including the background details or explanation Q.2 How class and objects are different in terms of OO programming. Ans. In OO terms, a class is “the fundamental building block”. A class is a type, it means a representation for a set of states and a set of operations for changing the state. Classes are similar to built in type in this sense. An object in terms of OO is a chunk of memory with certain semantics. These semantics are defined by the class of the object. So we can say that class defines a blueprint and object is an instance created from that blueprint. Q.3 What are the advantages and disadvantages of inline function? Ans. The main advantage of inline functions is that they save on the overheads of a function call as the function is not invoked, rather its code is replaced in the program. The Major disadvantages of inline functions is that with more function calls, more memory is wasted as for every function call, the same function code is inserted in the program. Repeated occurrences of same function code waste memory space. Q.4 What is the relationship of a class and its objects? How is memory allocated to a class and its objects Ans. A class represents a group of similar objects. For instance ‘Car’ is a class and ‘Maruti 800’ is an object. An object is an instance of the class. In C++ class makes a data type using which its objects can be created. When a class defined memory is allocated for its member function and they are stored in the memory. When an object is created, separate memory space is allocated for its data members. All objects work with one copy of member function shared by all. Q.5. what do you mean by static data member? Ans. A class can have static data members as well as static member function. The static data members ate the class variables that are common for all the objects of the class. Only one copy of static data members is maintained which is shared by all the objects of the class. They are visible only within the class but their lifetime is the entire program. They can be accessed by all the member function. A member function that access only static data members of a class is static member function. It cannot access other data members but static members. The static data members are useful when some data values are to be shared access objects of the same class. .

Unit 1st - Chapter 5

th

Q.1 Write the special Characteristics of Constructor Ans. The constructor functions have certain special characteristics

1. Constructor functions are invoked automatically when the objects are created.

Page 331: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 331

2. If a class has a constructor, each object of that class will be initialized before any use is made of the object.

3. Constructor functions obey the usual access rules. That is ,private and protected constructor are available only for member and friend functions , however ,public constructor are available for all the function .Only the function that have access to the constructor of a class , can create an specified object of the class.

4. No return (not even void) can be specified for a constructor . 5. They cannot be inherited , though a derived class can call the base class constructor . 6. A constructor may not be static. 7. Default constructor and copy constructor are generated (by the compiler) where needed .Generated

constructor are public. 8. Like other C++ functions, constructors can also have default arguments. 9. It is not possible to take the address of a constructor. 10. An object of a class with a constructor cannot be a member of a union. 11. Member functions may be called from within a constructor. 12. A constructor can be used explicitly to create new objects of its class type , using the syntax

class – name(expression list ) { Constructor body } Q.2 Write the characteristics of Destructions Ans. The destructions have some special characteristics associated. These are:

1. Destructor function are invoked automatically when the objects are destroyed. 2. You can have only one destructor for a class. In other words, destructors can’t be overloaded. 3. If a class has a destructor, each object of the class will be de initialized before the object goes out of

scope. 4. Destructor function also, obey the usual access rule as other member function do. 5. No argument can be provided to a destructor, neither does it return any value. 6. They cannot be inherited. 7. A destructor may not be static. 8. It is not possible to take the address of a destructor. 9. Member function may be called from within a destructor. 10 An object of a class with a destructor cannot be a member of a union.

Q.3. Write a short note on significance of constructor in OOP classes. Ans. One major characteristic of oop is its close correspondence with the real-world entities. Like real-world entities, oop objects also are created and scrapped. When an object is created, it must be constructed with some legal initial value automatically without being specified by the programmer. In this job of initializing an object some legal value is carried out by the constructor of the class, the object belongs to. Therefore, the constructor takes over this very important duty of initialization of an object being created and relieves us from this task. Q.4 What do you understand by a default constructor ? what is its role? How is it equivalent to a constructor having default arguments? Ans. A default constructor is the one that take no arguments. It is automatically invoked when an object is created without providing any initial values. In case, the programmer has not defined a default constructor, the compiler automatically generates it.

Page 332: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 332

It is equivalent to a constructor having default arguments because when no initial values are provided for an object at the time of its declaration, the constructor having default argument values is invoked same way as the default constructor is invoked. Therefore, these two are considered equivalent. Q.5 Discuss the various situation when a copy constructor is automatically invoked. Ans. Generally, in the following three situations, a copy constructor is invoked:

1. When an object is defined and initialized with another object of the same type, then the copy constructor is invoked to copy the data values of one object to the other.

2 When an object is passed by value to a function, then the copy of the passed object is created for the function by invoking the copy constructor.

3 When a function returns an object, the copy constructor creates a temporary object to hold the return value of the function returning an object.

Unit 1st - Chapter 6

th

Q.1 Why Inheritance is needed? Ans. Inheritance is needed for the followings 1. One major reason behind this is the capability to express the inheritance relationship which ensures the closeness with the real-world models. 2. Another reason is the idea of reusability. The advantages of reusability are: faster development time, easier maintenance, and easy to extend. Inheritance allows addition of additional features to existing class without modifying it. One can derive a new class (subclass or derived class) from an existing one and add new features to it.

Suppose we have a class student, and we need to add a new class called graduate student. We derive the new class GraudateStudent from the existing class student and then all we need to add are the extra features to GraudateStudent that describe the difference between students and graduate student. Notice the reduction in amount of typing an effort. 3. One reason is transitive nature of inheritance. For example, if a new class graduate student has been declared as a subclass of student which itself is a person then graduate student must also be a person i.e., inheritance is transitive. If a class B inherits properties of another class A, then all subclass of B will automatically inherits the properties of A. This property is called transitive nature of inheritance. This carries a benefit in it .Suppose we inherit class B from existing class A. The class C and D inherit from class B. Later we find that class A (base class of B) has a bug that must be corrected. After correcting the bug in A, it automatically will be reflected across all classes that inherit from A, if the class A has been inherited without changes .See the reduction in amount of efforts that one would have done if each class inherits from A was to be modified separately, a gifted benefit of being transitive. Q.2 Write various forms of Inheritance. Ans. Forms of Inheritance are as follows. 1. Single Inheritance. When a subclass inherits only from one base class, it is known as single

inheritance.

2. Multiple Inheritances. When sub class inherits from multiple base classes, it is known as multiple

Inheritances.

3. Hierarchical Inheritance. When many sub classes inherits from a single base, it is known as hierarchical

inheritance.

4. Multilevel Inheritance. The nature of inheritance is reflected by this form of inheritance. When subclass

inherits from a class that itself inherits from another class, it is known as multilevel inheritance.

Page 333: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 333

Hybrid Inheritance. It combines two or more forms of inheritance e. g, when a subclass inherits from multiple base classes and all of its base classes inherits from single base class, this form of inheritance is known as hybrid inheritance Q.3 What is containership? How does it differ from inheritance? Ans. When a class contains object of another class as its members, this kind of relationship is called containership or nesting. Inheritance lets you create a define a specialized instance of class that shares the properties of the class and at the same time adds new features to it. Containership, on the other hand, does not do any such job rather it facilitates to enclose object of another classes inside a class. It is just a way to define an object which itself is collection of object of other classes. Q.4 Answer the questions (i) to (iv) based on the following code: class Dolls { char DCode[5]; protected; float Price; void Calcprice (float); public: Dolls ( ); Void DInput ( ); Void DShow ( ); }; class SoftDolls : public Dolls { Char SDName[20]; Float weight; Public: SoftDolls(); void SDInput( ); void SDShow( ); }; class ElectronicDolls:public Dolls { char EDName[20]; char BatteryType[10]; int Batteries; public: Electronic Dolls( ); void EDInput( ); void EDShow( ); }; Ans (i)Which type of inheritance is shown in the above example? (ii)How many bytes will be required by an object of the class ElectronicDolls? (iii)Write name of all the data members accessible from member functions of the class SoftDolls. (iv)Write name of all the member function accessible by an object of the class ElectronicDolls. Solutions. (i) Multilevel Inheritance (ii) 65 bytes (iii) Price,SDName,Weight (iv)DInput(),DShow(),SDInput(),SDShows( ),EDInput( ), EDshow( )

Page 334: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 334

Unit 1st - Chapter 7

th

Q.1 Write the various file mode constants? Ans.

S.NO.

CONSTANTS

MEANING STREAM TYPE

1. ios :: in It opens file for reading, i.e., in input mode ifstream

2. ios :: out It opens file for writing, i.e., in output mode. This also opens the file in ios :: trunc mode, by default. This means an existing file is truncated when opened, i.e., its previous contents are discarded.

ofstream

3. ios :: ate This seeks to end-of-file upon opening of the file. I/O operations can still occur anywhere within the file.

ofstream, ifstream

4. ios :: app This causes all output to that file to be appended to the end. This value can be used only with files capable of output.

ofstream

5. ios :: trunc This value causes the contents of a pre-existing file by the same name to be destroyed and truncates the file to zero length.

ofstream

6. ios :: nocreate

This causes the open( ) function to fail if the file does not already exist. It will not create a new file with that name.

ofstream

7. ios :: noreplace

This causes the open( ) function to fail if the file already exists. This is used when you want to create a new file and at the same time.

ofstream

8. ios :: binary This causes a file to be opened in binary mode. By default, files are opened in text mode. When a file is opened in text mode, various character translations may takes place, such as the conversions of carriage-return into newlines. However, no such character translations occur in files opened in binary mode.

ofstream, ifstream

Q.2 Distinguish between ios::app and ios::out Ans. The ios::out is the default file mode of stream. With the mode of the file does not exist, it gets created but if the file exists the its existing contents get deleted. On the other hand, ios::app is also an output mode, which creates the file if it does not exits but if the file exists, then its existing contents are retained and new information is appended to it. Q.3. what is the difference between get( ) and getline( ) functions even when they share similar prototype?

Page 335: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 335

Ans. . The difference between get and getline is that even though both read characters from the input stream into a character array being pointed to buf until either num no. of characters are read or the character specified by delim ( by default ‘\n’) is encountered, whichever occurs earlier. The major difference is that get( ) does not extract the delimiter newline character from the input stream i.e., the delimiter character remains in the stream after get( ) is over. On the other hand, getline( ) does extract the delimiter newline character from the input stream so that the stream is empty after getline( ) is over Q. 4 Write a function in C++ to count the no. of lowercase present in a text file “BOOK.TXT”. Ans. . int count lower( ) { if stream fin(“BOOK.TXT”); char ch ; int count=0; while (!fin.eof( )) { fin.get(ch); If(islower(ch)) Count++; } fin.close( ); Return count; } Q.5 What are the different functions available for file I/O error handling in C++ ? Ans. The different functions available for file I/O error handling are : bad( ), eof( ), fail( ), good( ) ; The eof( ) function returns true if the eof bit is set(i.e., true). The bad( ) function returns true if badbit is set. The fail( ) function returns true if fail bit is set. The good( ) function returns true if there are no errors. Otherwise, they returns false. Q.6 Write a program that prints a text file on the printer Ans. . #include<iostream.h> #include<conio.h> #include<process.h> void main( ) { char filename[13]; cout<<“ Enter the text file name “; cin.getline(filename, 13) cout<<“\n”; //create stream for input ifstream fin; //open file fin.open(filename); //check for errors if(!fin) { cerr<<“\n File can’t be opened !\n” ; exit(-1); } ofstream fout ; //create output stream fout.open(“PRN”) ; //open it for printer char ch; while(fin.get(ch) != 0) //read a character fout.put(ch); //write a character to printer }

Page 336: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 336

nit 2nd

- Chapter 8th

Q.1 What do you understand by Free store of memory? Ans. Definition:- Free store is a pool of unallocated heap memory given to a program that is used by the program for dynamic allocation during program execution. The allocated free store memory is unnamed. Objects allocated on the free store are manipulated indirectly through pointers. Another aspect of free store is that the allocated memory is un initialized. The programmer is responsible for initializing it explicitly.

The free store memory is allocated through the use of new operator and deal located through delete operator. Dynamic Allocation Operators explains the working of new and delete operators.

Q.2. Differentiate between static and dynamic allocation of memory? Ans. In the static memory allocation, the amount of memory to be allocated is predicted and pre known. This memory is allocated during the completion itself. All the declared variables declared normally, are allocated memory statically.

In the dynamic memory allocation, the amount of memory to be allocated is known beforehand. It is allocated during run-time as and when required. The memory is dynamically allocated using new operator, the memory allocation operator of C++.

The objects that are allocated memory statically have the lifetime as their scope allows, as decided by the compiler.; And the objects that are allocated memory dynamically have the lifetime as decided by the programmer. That is, until the programmer explicitly deal locates the memory, such objects live in the memory. Q.3. What do you understand by memory leaks? What are the possible reasons for it? How can memory leaks be avoided? Ans. If the objects, that are allocated memory dynamically, are not deleted using delete, the memory block remains occupied even at the end of the program. Such memory blocks are known as orphaned memory blocks.

These orphaned memory blocks when increase in number, bring as adverse effect on the system. This situation is known as memory leak.

The possible reasons for this are: i) a dynamically allocated object not deleted using delete.

ii) delete statement is not getting executed because of some logical error. iii) Assigning the result of a new statement to an already occupied pointer.

The memory leaks can be avoided by i) making sure that a dynamically allocated is deleted. ii) a new statement stores its return value (a pointer) in a fresh pointer.

Q.4 . Predict and explain the output of the following program: #include<iostream.h> #inclue<conio.h> //for clrscr() void junk(int, int*) int main()

Page 337: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 337

{ clrscr(); int i=6, j = -4; junk(I, &j); cout<<”i=”<<i<<”,j=”<<J<<”\n”; return 0; } void junk(int a, int *b) { a=a*a; *b=*b**b; }

Ans. The output of the program will be I=6,j=16

Explanation: While calling the function junk(), the value of i(call-by-value) and the address of j(call-by-refernce) are passed to it. Naturally, in junk() a is declared as an ordinary int(storing value of i) whereas b is declared as the pointer to int(pointing to j). Even though the value of a is changed to 36 in junk(), it is not reflected back in main() *b in junk(0 is reflected back in main(0 because of call-by-reference mechanism. Hence j stores the result of (*b)* (*b) i.e., -4*-4=16. Q.5 Illustrate the use of “self referential structures with the help of an example. Ans. A structure having a member element that refers to the structure itself is called self-referncial structure. For example Struct Employee { int Empno; char name[26]; float basic; Employee *next; }; In this example, *next is referring to the structure Employee itself. It is useful in defining linked lists where in each element points to the next element of same type.

Unit 2nd

- Chapter 9th

Q.1 Write short note about the different data structure Ans. DATA STRUCTURE ARE VERY IMPORTANT IN A COMPUTER SYSTEM, AS THESE MOT ONLY

ALLOW THE USER TO COMBINE VARIOUS DATA TYPES IN A GROUP BUT ALSO ALLOW

PROCESSING OF THE GROUP OF THE SINGLE UNIT THEREBY MAKING THINGS MUCH SIMPLER

AND EASIER. THE DATA STRUCTURE CAN BE CLASSIFIED INTO FOLLOWING 2 WAYS:- 1. SIMPLE DATA STRUCTURE. THESE DATA STRUCTURES CAN BE COMBINED IN VARIOUS

WAY TO FORM MORE COMPLEX STRUCTURE CALLED COMPOUND DATA STUCTURE

COMPOUND DATA STRUCTURE ARE CLASSIFIED INTO 2 TYPES:-

� LINEAR DATA TYPE. SIMPLE DATA STRUCTURES ARE SINGLE LEVEL DATA

STRUCTURES. A DATA STRUCTURE IS SAID TO BE LINEAR IF ITS ELEMENTS FORM A

SEQUENCE.FOLLOWING ARE YHE EXAMPLE OF LINEAR DATA TYPE :-

Page 338: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 338

A. STACK B. QUEUE C.LINKED LIST

� NON LINEAR DATA TYPE.THESE ARE MULTILEVEL DATA STRUCTURES. EXAMPLE

OF NON LINEAR DATA STRUCTURE IS A.TREE

Q.2 Write various operation on data structures ? Ans. THE BASIC OPERATION THAT ARE PERFORMED ON DATA STRUCTURE ARE AS FOLLOWS :

1. INSERTION. INSERTION MEANS ADDITION OF A NEW DATA ELEMENT IN A DATA

STRUCTURE.

2. DELETION. DELETION MEANS REMOVAL OF A DATA ELEMENT FROM A DATA

STRUCTURE. THE DATA ELEMENT IS SEARCHEG FOR BEFOR ITS REMOVAL.

3. SEARCHING. SEARCHING INVOLVES SEARCHIN FOR THE SPECIFIC DATA ELEMENT

IN THE DATA STRUCTURE.

4. TRAVERSAL. TRAVERSAL OF A DATA STRUCTURE MEANS PROSECCING ALL THE

DATA ON IT.

5. SORTING. ARRANGING DATA ELEMENTS OF A DATA STRUCTURE IN A SPECIFIED

ORDER IS CALLED SORTING.

6. MERGING. COMBINING ELEMENTS OF 2 SIMILER DATA STRUCTURES TO FORM A

NEW DATA STRUCTURE OF SAME TYPE, IS CALLED MERGING.

Q.3 Write the algorithm for binary search. Ans. ARRAY AR[L : U] IS STORED IN ASCENDING ORDER

/*INITIALISE SEGMENT VARIABLE */

1. SET BEG =L, LAST=U 2. REAPEAT STEP 3 THROUGH 6 UNIT BEG>LAST 3. MID = INT ( (BEG + LAST)/2) 4. If AR [MID]==ITEM THEN

{ PRINT “SEARCH SECCESSFUL”

PRINT ITEM, “FOUND AT”,MID

BREAK

}

5. If AR[MID]<ITEM THEN

BEG=MID + 1

6. If AR [MID]>ITEM THEN

LAST=MID – 1

7. IF BEG =/=LAST PRINT “UNSUCCESSFUL SEARCH” 8. END.

Q.4 Write the algorithm for Selection Sort. Ans. Algorithm Selection Sort in Array

Page 339: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 339

1. Small=AR[L] /* Initialise small with first array element */

2. For I= L TO U do // In C++, 0 To size-1

{ 3. Small = AR [I] /* Loop to find smallest element and its position */

4. For J=I TO U do

{ 5. If AR [J] < small then

6. { small = AR[J]

7. pos =J

} J = J+1 } /* end of inner loop */ /* swap the smallest element with Ith element */ 8. Temp = AR[I]

9. AR[ I ] = small

10. AR[pos] = temp

} /* end of outer loop */ 11. END.

Q.5 Write the algorithm for Bubble Sort. Ans. For I = L TO U

1. { For J = L TO [ ( U – 1 ) -1] // need not consider already settled heavy elements//

// that is why (u-1)-I. 2. { if AR [J] > AR[J + 1 ] then

{ /* swap the values */ 3. temp = AR[ J]

4. AR[J] =AR[J + 1]

5. AR[J+ 1] = temp

} /* end of if */ } /* end of inner loop */ } /* end of outer loop */

6. END.

Q.6. Write the algorithm for Insertion Sort. This algorithm sorts the Array A with N – 1 elements i.e., from A [1] to A [N – 1]. We are not reading any value in A [0] because A [0] stores the minimum possible value to act as sentinel node.

Page 340: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 340

//To make A[0] the sentinel element by storing minimum possible integer value// 1. A[0] = minimum integer value /* Now start sorting the array */

2. Repeat step 3 through 8 for K = 1,2,3,….N -1

{ 3. temp = A[K]

4. ptr =K -1

5. Repeat steps 6 to 7 while temp < A[ptr]

{ 6. A[ptr +1] =A[ptr] //Moves element forward

7. ptr = ptr -1

} //End of inner repeat –step 5’s loop 8. A[ptr + 1] = temp

} //End of outer repeat – step 2’s loop 9. END.

Unit 2nd

- Chapter 10th

Q.1 How free store allocation in c++ Ans. In c++, every program is provided with a pool of unallocated memory that it may utilize during program execution .this memory is known as free store memory. In c++, one aspect of this free store memory is that it is unnamed. object allocated on the free store do not posses any name, rather, they are manipulated indirectly through pointers. Free store memory is allocated by applying operator new to a typespecifier and which return a pointer pointing to the allocated memory to allocate memory for a node of a linked list the following statement are given:

Struct node { char info [15]; //declare variable forming info part Node * next; //pointer that wil point to the next node };

Node *ptr; //pointer that will point to the newly allocated memory Ptr=new node; //allocate memory to hold a node and make ptr

point to it.

Q.2 Write the algorithm Insertion in the begning of a link list Ans. The algorithm for insertion in the begning of the list is given below: /* This algorithm deals with insertion in the begning of a list*/ /* initialize the pointer */

1. Ptr=START //START DENOTES the first node of the list /* allocate memory for

the new node*/

2. NEWPTR=new node

3. If NEWPTR = NULL // If sufficient memory is not available

4. Print “no space available ! aborting!!”

5. Else

{

Page 341: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 341

6. NEWPTR->INFO=ITEM /* Put information in new node*/

7 .NEWPTR->LINK=NULL 8. if START=NULL then 9. STATR=NEWPTR 10. ELSE { 11. save=START /* Save start’s value – save is also a pointer*/ 12.START=NEWPTR /* Assign NEWPTR to START */ 13.NEWPTR->LINK=Save /* Make NEWPTR POINT TO PREVIOUS START*/

} } 14.END .

Q.3 Write the algorithm Insertion in the end of a link list

Ans. 1. Declare pointer START,PTR,NEWPTR,NEWPTR REAR // Rear point to the last node of the list 2. Ptr=START 3. NEWPTR=new node /* Allocate memory for new node*/ 4. If NEWPTR=NULL //If sufficient memory is not available 5. Print” no space available ! aborting!!”

6. Exit /* Put information in new node*/

7. Else { 8. NEWPTR->LINK=NULL } 9.if START=NULL THEN { 10. START=NEWPTR 11.REAR=NEWPTR } 12.REAR->LINK=NEWPTR 13. REAR=NEWPTR 14.END

Q.4 Write the algorithm Deletion from the beginning of the list

/* first of all initialize pointer*/ 1.If START=NULL THEN 2.print “UNDERFLOW” 3.else 4. { ptr=start 5. Start=ptr- >LINK 6. delete ptr } 7.END

Q.5 Write the algorithm for Pushing in stack- array

Ans /* assuming that array-stack can hold maximum N element 1.top=-1 /*Initialise stack with invalid subscript value to show it is empty.legal subscript value are

0 . . .(n-1)*/ 2.Read Item //item,which is to be pushed

3.If (top==n-1) then /* if top is at end of stack-array*/

4.{ Print “Overflow !!”

Page 342: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 342

} 5.Else 6.{ top=top+1 /* increment top to move to next empty position to hold new item*/ 7. Stack[top]=Item} 8.END

Q.6 Write the algorithm for Infix to Postfix Conversion using Stack

Ans 1.Push “(“onto STACK,and add”)” to the end of X

2 Scan X from left to right and REPEAT step 3 t 6 for each element of x UNTIL the STAC is empty: 3. If an operand is ancountered,add it to y. 4.If a left paranthesis is encountered, push it onto STACK. 5. If an operator is encountered,then: (a)Repeatedly pop from stack and add to Y each operator(on the top of stack) which has the same precedence as or higher precedence than operator. (b) Add operator to STACK.

/*End of if structure*/

6. If a right paranthesis is encountered,then: (a)Repeatedly pop from STACK and add to y each operator (on the top of stack) until a left paranthesis is encountered. (b) Remove the left paranthesis.[do not add the left paranthesis to Y].

/* End of step 2 loop*/ 7 END.

Q.7 Write the algorithm for Evaluation Of Postfix Expression

Ans. /* reading of expression takesplace from left to right*/ 1.Read the next element /* first element for the first time*/

2.If element is operand then Push the element in the stack

3.If the element is operator then { 4.Pop two operand from the stack /*pop one operand in case of unary Operator*/

5.Evaluate the expression formed by the two operand and the operator 6.Push the result of the expression int the stack end } 7.If no-more-element then Pop the result Else go to step 1

8. END.

Page 343: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 343

Unit 3rd

- Chapter 11th

Q.1 Write the purpose of the Database? Ans. Purpose of the database are as follows

1. Databases reduce the data redundancy to a large extent.

Data redundancy means duplication of data. Non-database systems maintain separate copy of data for each application.

2. Databases can control data inconsistency to a large extent.

This is really a corollary of the previous point. When the redundancy is not controlled, there may be occasions on which the two entries about the same data do not agree (that is, when one of them stores the updated information and the does not). At such times, database is said to be inconsistent. Obviously, an inconsistent database will provide incorrect or conflicting information.

3. Databases facilitate sharing of data.

Sharing of data means that individual pieces of data in the database may be shared among several different users, in the sense that each of those users may have access to the piece of data and each of them may use it for different purposes.

4. Databases enforce standards.

The database management systems can ensure that all the data (that is stored centrally) follow the applicable standards. There may be certain standards laid by the company or organization using the database. Or there may be certain industry standards that must be satisfied by the data. Similarly, there may be national or international standards. Standardizing stored data formats is particularly desirable as an aid to data interchange or migration between systems.

5. Databases can ensure data security. The information stored inside a database is sometimes of great

value to a corporation. Therefore, it must be kept secure and private

Q.2 Write the various levels of database implementation? Ans. Levels of the database are as follows

1) Internal level (physical level). The lowest level of abstraction, the internal level, is the one closest to

physical level. So, it is sometimes termed as physical level. It describes how the data is actually stored on

a stored medium. At this level, complex low-level data structures are described in details.

2) Conceptual level. This level of abstraction describes what data are actually stored in the database. It also

describes the relationships existing among data. At this level, the database is described logically in terms

of simple data-structures. The user of this level are concerned about what information is to be kept in the

database.

3) External level (view level). This is the level closest to the users and is concerned with the way in which

the data is viewed by individual users. The user needs only the part of the database relevant to them.

Example: - An account holder (a user) is only interested in his account details and not with the rest of the

information stored in the database.

To simply such users’ interaction with the system, this level of abstraction is defined.

Q, 3:- What is database system? What is its need?

Page 344: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 344

Ans: - A database is a collection of interrelated data and a database system is basically a

computer based record keeping system.

A typical file processing system suffers from some major limitations like data redundancy, data inconsistency, un sharable data, un standardized data, insecure data, incorrect data etc. On the other hand, a database system

overcomes all these limitations.

The advantages provided by a database system are-

a) reduced data redundancy

b) controlled data inconsistency

c) shared data

d) standardized data

e) secured data

f) integrated data.

Q.4:- Can you think of disadvantages of using a database system? What are these? Ans: - With the complex tasks to be performed by database systems, certain things may crop up that may be termed as disadvantages of using database system. These are:

1. Security may be compromised without good controls.

2. Integrity may be compromised without good controls.

3. Extra hardware may be required.

4. Performance overhead may be significant. System is likely to be complex

Q.5:- How many types of users work on database systems? Ans: - There are three different types of database systems users differentiated by the way they expect to interact with the system.

i. End User. An end user is a person who is not a computer trained person but uses the database to retrieve

some information.

ii. Application System Analyst. This user is concerned about the entire database at logical level without

considering the physical implementation details.

iii. Physical Storage System Analyst. This user is concerned with the physical implementation details of

the database such as which storage device, which storage technique should be used? etc.

Q. 6:- What are the various data models available for database system? Ans: - A data model is a collection of conceptual tools for describing data, data relationships, and data semantics etc. There are three data models available:

1) Relational Model. This represents data and relationships among data by a collection of tables known as

relations, each of which has a number of columns with unique names.

2) Network Model. This represents data by collections of records and relationships among data are

represented by links which can be viewed as pointers. The records in the database are organized as

collection of arbitrary graphs.

Page 345: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 345

3) Hierarchical Model. It is similar to the network model in the sense that data and relationships among

data are represented by records and links respectively.

Q.7 :- What are views? How are they useful? Ans: - A view is a virtual table that does not really exist in its own right but is instead derived from one or more underlying base table(s). No stored file is created to store the contents of a view rather its definition is stored only. The usefulness of views lies in the fact that they provide an excellent way to give people access some but not all the information in the table.

Q.8 :- Differentiate between Candidate Key and Primary Key in context of RDMBS. Ans.: - Candidate Key- It is the one which that is capable of becoming primary key i.e. a field or attribute that has unique value for each row in the relation. Primary Key- It is a designated attribute or a group of attributes whose value is uniquely identify the tuples in the relation.

Q. 9:-Differentiate between Candidate Key and Alternate Key in context of RDMBS. Ans.: - Candidate key- It is the one that is capable of becoming primary key. A candidate key that is not a primary key is called an ALTERNATE KEY.

Unit 3rd

- Chapter 12th

For the following Table answers the followings questions using SQL. Hospital (No, Name, Age, Dept, Dateofadmn, charges, sex) 1. To show all information about the patients of cardiology department. Select * from Hospital where dept = ‘cardiology’; 2. To list the name of female patients who are in orthopedic department. Select Name from Hospital where sex =’f’ and dept = ‘orthopedic’ 3 To list the name of all patients with their date of admission in ascending order.

Select Name, dateofadmn from Hospital order by dateofadmn. 4 To display patient’s name, charges, age for only male patients

Select Name, charges, age from Hospital where sex = ‘m’;

5 To count the number of patients with age greater than 30.

Select Count(*) from Hospital where age > 50.

Unit 4th

- Chapter 13th

Q. 1:- In Boolean algebra, verify using truth table that X+XY = X for each X, Y in (0, 1). Ans. - Truth table is as follow –

Page 346: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 346

Since, the column of X+XY & X are identical, hence verified.

Q.2:- Prepare a table of combinations for the Boolean algebra expression : X’YZ’ + XY’. Ans. - The truth table is as follow –

X Y Z X’ Y’ Z’ X’YZ’ XY’ X’YZ’ +

XY’

0 0 0 1 1 1 0 0 0

0 0 1 1 1 0 0 0 0

0 1 0 1 0 1 1 0 1

0 1 1 1 0 0 0 0 0

1 0 0 0 1 1 0 1 1

1 0 1 0 1 0 0 1 1

1 1 0 0 0 1 0 0 0

1 1 1 0 0 0 0 0 0

Q. 3:- Convert AB+C to minterms. Ans.: - AB + C = AB.1 + 1.1.C = AB. (C+C’) + (A+A’). (B+B’). C = ABC + ABC’ + (AB + AB’ + A’B + A’B’). C = ABC + ABC’ + ABC + AB’C + A’BC + A’B’C = ABC + ABC’ + AB’C + A’BC + A’B’C.

Q.4:- Convert the following function into canonical product of sums form - F(X, Y, Z) = (0, 2, 4, 5).

Ans: - F(X, Y, Z) = (0, 2, 4, 5) = M0 . M2. M4.M5

M0 = 000 X+Y+Z M2 = 010 X+Y’+Z M4 = 100 X’+Y+Z M5 = 101 X’+Y+Z’

� F = (X+Y+Z) (X+Y’+Z) (X’+Y+Z) (X’+Y+Z’).

Q.5 5:- Simplify- AB’CD’ + AB’CD + ABCD’ + ABCD. Ans: - AB’CD’ + AB’CD + ABCD’ + ABCD = AB’C (D’ + D) + ABC (D’ + D) = AB’C.1 + ABC.1 = AC (B’ + B) = AC.1 = AC.

Q.6:- Reduce the expression (XY)’ + X’ + XY. Ans :- (XY)’ + X’ + XY = (X’ + Y’) + X’ + XY = X’ + X’ + Y’ + XY = X’ + Y’ + XY = [X’ + (X’)’Y] + Y’ [Since, (X’)’=X]

X Y XY X+XY

0 0 0 0

0 1 0 0

1 0 0 1

1 1 1 1

Page 347: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 347

= X’ + Y + Y’ = X’ + 1 = 1.

Q. 7:- Reduce the Boolean expression using K-map

F(X, Y, Z) = ∑ (1, 2, 4, 5, 6, 7). Solution: - Y’Z’ Y’Z YZ YZ’

X’

0 1 0 1

X

1 1 1 1

F = X (Y’Z’ + Y’Z + YZ + YZ’) + Y’Z (X + X’) + YZ’ (X + X’) = X + Y’Z + YZ’.

Q. 9:- Reduce the Boolean expression using K- map

F(A, B, C, D) = ∑ (0,2,4,5,6,7,8,10,11,13,15) Ans:-

C’D’ C’D CD CD’

A’B’ 1 0 0 1

A’B 1 1 1 1

AB 0 1 1 0

AB’ 1 0 1 1

F = (A’B’ + AB’) (C’D’ + CD’) + (A’B + AB) (C’D + CD) + (A’B’ + A’B) (C’D’ + C’D) + (AB+ AB’) CD

= B’.D’ + B.D + A’C’ + A.CD = B’D’ + BD + A’C’ + ACD.

Q. 9:- Convert the following Boolean expression from sum of products (SOP) to product of sums (POS)-

F = x’y’ + xy’ + xyz’. Ans:- Y’Z’ Y’Z YZ YZ’

X’ 1 1 0 0

X 1 1 0 1

[Take the pair of zeros (0)]

F’ = YZ (X + X’) + X’ (YZ + YZ’) = YZ + X’Y (F’)’ = (YZ + X’Y)’ F = (YZ)’ + (X’Y)’ = (Y’ + Z’). (X + Y’)

Q 10:- Convert the following Boolean expression from product of sums (POS) to sum of products (SOP)- F = (x + y’). (x’ + y’). (x’ + y + z’) Ans:- F’ = (x + y’)’. (x’ + y’)’. (x’ + y + z’) F’ = x’ y + xy + x y ’z’ y’ z’ y’ z y z yz’

x’ 1 1 0 0

Page 348: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 348

x 1 0 0 0

[Take the pair of one (1)] F = y’ z’ +x’ y’.

Q. 11:- Convert the given expression from both POS to SOP and SOP to POS-

F (x, y, z) = ∑ (0, 1, 2, 5). Ans:- y’ z’ y’ z y z y z’

x’ 1 1 0 1

x 0 1 0 0

SOP – POS – F’ = y z (x’ + x) + x (y’ z’ + y z’) = y z + x z’. (F’)’ = (y z)’ + (x z’)’ = (y’ + z’).(x’ + z). POS – SOP – F = (y’ + z’).(x’ + z) F’ = y z + x z’ y’ z’ y’ z y z y z’

x’ 1 1 0 1

x 0 1 0 0

F = y’ z (x’ + x) + x’ (y’ z’ + y z’) = y’ z + x’ z’.

Unit 5th

- Chapter 14th

Q.1 What is a modem and what is its function? Ans. A modem is a computer peripheral that connects a workstation to other work station via telephone lines and facilitates communications. It is a short form for Modulation / Demodulation. Modem converts digital signal to A/F (Audio Frequency) tones which are in the frequency range that the telephone lines can transmit and also it can convert transmitted tones back to digital information. Q.2 What do you mean by network topology? What are the most popular topologies. Ans. Topology refers to the way in which the workstations attached to the network are interconnected. The most popular topologies are. a. Bus or Linear b. Ring c. Star d. Tree 1. Bus (Linear) :- In this topology, all the devices on network are connected to a single continuous cable called a Bus. Transmission from any station travels the length of the bus in both directions and can be received by all other stations. The destination device on identifying the address on data packet copies the data onto the disk. When the data packet reaches at either end the terminator on that end absorbs the signal, removing from the bus. Basically this topology can be used for small network. 2. Ring ::- A LAN using a ring topology is connected in the closed loop. The data packets transmitted, circulate along the ring. The destination station copies the packet content on recognizing its address on the packet. After a packet travels a full circle, it is removed at the source station. 3. Star :- In this topology each workstation id directly linked to a central node. Devices can be easily plugged or unplugged to the central node, as need dictates. Any communication between the station must pass through the central node.

Page 349: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 349

4. Tree:- In this topology the network is shaped as an inverted tree with the central root branching and sub-branching to the extremities of the network. Transmission in this topology takes place in the same way as in bus topology. Q.3 What are protocols? Ans. The protocols means the rules that are applicable for a network. Protocol defines standardized formats for data packets, techniques for detecting and correcting errors and so on. The effective use of network it must follow a standardized protocol. There are various protocols that are used in various types of network. For example, IBM LAN software, DEC net , TCP/IP (Transmission Control Protocol / Internet Protocol ) etc. TCP/IP is native protocol of Internet. Q.4 Differentiate between GSM and CDMA? Ans. GSM (Global System for Mobile) communications is a technique that uses narrowband TDMA, which allows eight simultaneous calls on the same radio frequency. TDMA is short for Time Division Multiple Access. TDMA use Time Division Multiplexing (TDM) and divide a radio frequency into time slot and then allocates these slots to multiple calls thereby supporting multiple, simultaneous data channels. CDMA (Code Division Multiple Access) on the hand, unlike GSM, does not assign a specific frequency to each user. CDMA uses spread spectrum technique where every channel uses full available spectrum. With CMDA, data is sent in small pieces over a number of discrete frequencies available for use at any time in the specified range. All users transmit in the same wide-band chunk of spectrum. Each user’s signal is spread over the entire bandwidth by a unique spreading code, which is again used at the receiver and to recover the transmitted signal. Q.5 Write a short note on WLL. Ans. A WLL (Wireless Local Loop) serves a local area by deploying a multiplicity of multi channel transmit / Receive based station (Transceivers) that are within line of sight of the intended customers. Each customer is equipped with a mini-station of low power, into which the telephone (or PBX) is connected. When call are made from the telephone, it signals the base station for a connection, which is subsequently established through a switch centre, exactly as in conventional telephony. An incoming call is identified at the switch centre and routed to the base station assigned to serve the telephone being called. The wire less connection is then made, and the call is completed in the conventional manner. The infra structure design of a WLL system typically uses an advanced transmission technology such a CDMA, which permit support of a large subscriber base through orderly expansion of the base station cluster. Q.6 What is VIRUSES explain? Ans Computer virus is a malicious program that requires a host and his designed to make system sick, just like a real virus. Viruses can spread from computer to computer, and they can replicate themselves. Some viruses are categorized as a harmless pranks, while other are far more malicious. Broadly three types of viruses are.

1. File Infectors - Attach themselves to a program file. 2. Boot Sector Viruses – Install themselves on the beginning tracks of a hard drive. 3. Macro Viruses – Infect data files.

Most viruses spread by email-attachment and warn then to be suspicious of any files attached to unsolicited messages.

Characteristics of Computer Virus: 1. It is able to replicated, 2. It requires a host program as a carrier. 3. It is activated by external action. 4. Its replication ability is limited to the (Virtual) System.

Page 350: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 350

Unitwise Question ANweres for Slow achievers XI IP

Rachna Katiyar

PGT – Comp. Sc.

KV MM Sadiq Nagar, New Delhi

Questions and Answers for the Slow Achievers

Unit 1 : Introductions to the computer Systems Q1 : What are the various categories of software?

Ans > Page 77 Ans 1 Q2 : What is the difference between Interpreter and compiler /

Ans . Page 78 Ans 3 Q3 . What is fragmentation ? How does it affect computers performance ? What remedy do you suggest for it?

Ans Page 78 Ans 8 Q4 . What are the difference between hardware , software and firmware ?

Ans . Page 49 Ans . 4 Q 5 : What are the there types of computers ? How do they differ ?

Ans . Page 49 Ans 6 Q6 . Name the super computers develop in Indiaa. Ans. Page 49 Ans 9 Q7. What arte the major sttrenghth and weakness of computers ? Ans Page 49 Ans 10 Q8 . Why is binary often terms as machine language ? Why is machine required ? Ans. Page 50 Ans. 11 Q9. What are categories of printer ?Which type of printers are more speedy?

Ans. Page 50 Ans. 16 Q10. Explain the working of Dot- Matrix Printer.

Ans. Page 50 Ans 17 Q11. What are the advantages and disadvantages of OCR?

Ans. Page 50 Ans 15 Q12. What is a port ? name some port types .

Ans. Page 51 Ans 21 Q 13. What is diffeneence between RAM and ROM ?

Ans. Page 51 Ans . 18 Q14.What is MICR ? Where is it mostly used? What are the major disadvantages of MICR as general purpose? Ans. Page 50 Ans. 13 Q15.Describe why authentication is important for file protection. Ans. Page 79 Ans.

Unit 2: Introductions to Programming

Q1 : How can you say that java is both a programming language and a platform.

Ans > Page 113 Ans 2 Q2 : How is ordinary compilation process different from Java compilation

Ans . Page 113 Ans 3 Q3 . How are internet applets different from stand alone application of java ?

Ans Page 114 Ans 7 Q4 . What is the similarity and difference between option button and checks boxes ?

Page 351: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 351

Ans . Page 114 Ans . 12 Q 5 : Expalin the following terms. Event Event driven Programming Event Scource Listerner Ans . Page 115 Ans 13 Q6 . Your class teacher has asked you to create GUI application that will help KG students learn addition . The application will have two text fields to accept two numbers and then compute their sum. . Ans. Page 49 Ans 9 Ans. Page 115 Ans. 14 as Lab. Exercise. Q7. What State the rules of operator precedence’s. Ans Page 175 Ans 11 Q8 . What is casting when do we need it? Ans. Page 175 Ans. 10 Q9. What is a type , as this term relates to programming.

Ans. Page 175 Ans. 14 Q10. Given the following code fragment Int ch = 20; System.out.println(++ch); System.out.println(ch);

i) What output does the above code fragment produce? ii) What is the replacing ++ch witth ch+1 .

Ans. Page 173 Ans 2 Q11. What does the computer do when it executes a variable declaration statement ? Give an example?

Ans. Page 177 Ans 17 Q12. Loop to print the sum of the following series : .

1 + ¼ + 1/7 + 1/10 + 1/13 + 1/16 ….. + 1/25 Ans. Page 214 Ans 5.17

Q 13. Loop to display the 1o stars in line ? Ans. Page 214 Ans . 5.18

Q14.How is the if … else if combination more general than a switch statements Ans. Page 237 Ans. 6 Q15. Sate the output of the following code : Int a = 10 , b = 5; If(a>b) { If (b>5)

Learn to ADD

+ =

Compute Result.

Page 352: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 352

System .out.println (“b is ” + b ); } Else System .out.println (“a is ” + a ); Ans. Page 236 Ans. 5

Q16. What does a break statements do ?

Ans. Page 239 Ans. 14 Q17. Write a java programming to find out whether a year (4 – digit number stored in variable year) is a leap year.

Ans. Page 241 Ans. 20 Q18. Given three numbers A,B,C and write code in java to write their values in descending order . For example if A = 7,B = 4, C = 10 , your program should print out : 10, 4, 7

Ans. Page 241 Ans. 21 Q19. How do you convert the character array returned by getPassword()method of password field to equivalent string ?

Ans. Page 367 Ans. 7 Q20. Can you name the java classes that implements text field , password field and text area ?

Ans. Page 366 Ans. 5 Q21. What is the difference between slider and scrollbar?.

Ans. Page 368 Ans. 19 Q22. What is button group ? What all controls can you put in it?

Ans. Page 368 Ans. 18

Unit 3: Relational Database management Systaem

Q.1 Write the purpose of the Database? Ans. Purpose of the database are as follows

6. Databases reduce the data redundancy to a large extent.

Data redundancy means duplication of data. Non-database systems maintain separate copy of data for each application.

7. Databases can control data inconsistency to a large extent.

This is really a corollary of the previous point. When the redundancy is not controlled, there may be occasions on which the two entries about the same data do not agree (that is, when one of them stores the updated information and the does not). At such times, database is said to be inconsistent. Obviously, an inconsistent database will provide incorrect or conflicting information.

8. Databases facilitate sharing of data.

Sharing of data means that individual pieces of data in the database may be shared among several different users, in the sense that each of those users may have access to the piece of data and each of them may use it for different purposes.

9. Databases enforce standards.

The database management systems can ensure that all the data (that is stored centrally) follow the applicable standards. There may be certain standards laid by the company or organization using the database. Or there may be certain industry standards that must be satisfied by the data. Similarly, there may be national or

Page 353: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 353

international standards. Standardizing stored data formats is particularly desirable as an aid to data interchange or migration between systems.

10. Databases can ensure data security. The information stored inside a database is sometimes of great

value to a corporation. Therefore, it must be kept secure and private

Q.2 Write the various levels of database implementation? Ans. Levels of the database are as follows

4) Internal level (physical level). The lowest level of abstraction, the internal level, is the one closest to

physical level. So, it is sometimes termed as physical level. It describes how the data is actually stored on

a stored medium. At this level, complex low-level data structures are described in details.

5) Conceptual level. This level of abstraction describes what data are actually stored in the database. It also

describes the relationships existing among data. At this level, the database is described logically in terms

of simple data-structures. The user of this level are concerned about what information is to be kept in the

database.

6) External level (view level). This is the level closest to the users and is concerned with the way in which

the data is viewed by individual users. The user needs only the part of the database relevant to them.

Example: - An account holder (a user) is only interested in his account details and not with the rest of the

information stored in the database.

To simply such users’ interaction with the system, this level of abstraction is defined.

Q, 3:- What is database system? What is its need? Ans: - A database is a collection of interrelated data and a database system is basically a

computer based record keeping system.

A typical file processing system suffers from some major limitations like data redundancy, data inconsistency, un sharable data, un standardized data, insecure data, incorrect data etc. On the other hand, a database system

overcomes all these limitations.

The advantages provided by a database system are-

g) reduced data redundancy

h) controlled data inconsistency

i) shared data

j) standardized data

k) secured data

l) integrated data.

Q.4:- Can you think of disadvantages of using a database system? What are these? Ans: - With the complex tasks to be performed by database systems, certain things may crop up that may be termed as disadvantages of using database system. These are:

5. Security may be compromised without good controls.

6. Integrity may be compromised without good controls.

Page 354: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 354

7. Extra hardware may be required.

8. Performance overhead may be significant. System is likely to be complex

Q.5:- How many types of users work on database systems? Ans: - There are three different types of database systems users differentiated by the way they expect to interact with the system. iv. End User. An end user is a person who is not a computer trained person but uses the database to retrieve

some information.

v. Application System Analyst. This user is concerned about the entire database at logical level without

considering the physical implementation details.

vi. Physical Storage System Analyst. This user is concerned with the physical implementation details of

the database such as which storage device, which storage technique should be used? etc.

Q. 6:- What are the various data models available for database system? Ans: - A data model is a collection of conceptual tools for describing data, data relationships, and data semantics etc. There are three data models available:

4) Relational Model. This represents data and relationships among data by a collection of tables known as

relations, each of which has a number of columns with unique names.

5) Network Model. This represents data by collections of records and relationships among data are

represented by links which can be viewed as pointers. The records in the database are organized as

collection of arbitrary graphs.

6) Hierarchical Model. It is similar to the network model in the sense that data and relationships among

data are represented by records and links respectively.

Q.7 :- What are views? How are they useful? Ans: - A view is a virtual table that does not really exist in its own right but is instead derived from one or more underlying base table(s). No stored file is created to store the contents of a view rather its definition is stored only. The usefulness of views lies in the fact that they provide an excellent way to give people access some but not all the information in the table.

Q.8 :- Differentiate between Candidate Key and Primary Key in context of RDMBS. Ans.: - Candidate Key- It is the one which that is capable of becoming primary key i.e. a field or attribute that has unique value for each row in the relation. Primary Key- It is a designated attribute or a group of attributes whose value is uniquely identify the tuples in the relation.

Q. 9:-Differentiate between Candidate Key and Alternate Key in context of RDMBS. Ans.: - Candidate key- It is the one that is capable of becoming primary key. A candidate key that is not a primary key is called an ALTERNATE KEY.

For the following Table answers the followings questions using SQL. Hospital (No, Name, Age, Dept, Dateofadmn, charges, sex) 1. To show all information about the patients of cardiology department.

Page 355: IN-SERVICE COURSE FOR PGTs COMP. SC - KVS …kvspgtcs.org/wp-content/uploads/2013/08/Inservice-Course-Booklet...The In - service course for the PGTs Computer Science, ... K.V. I.I.T

- - 355

Select * from Hospital where dept = ‘cardiology’; 2. To list the name of female patients who are in orthopedic department. Select Name from Hospital where sex =’f’ and dept = ‘orthopedic’ 6 To list the name of all patients with their date of admission in ascending order.

Select Name, dateofadmn from Hospital order by dateofadmn. 7 To display patient’s name, charges, age for only male patients

Select Name, charges, age from Hospital where sex = ‘m’;

8 To count the number of patients with age greater than 30.

Select Count(*) from Hospital where age > 50.

Unit 4: IT Applications Q1 . How has e – governess benefited the common man? Ans. Page 660 Ans. 1 Q2 . What issues are still to be worked out for e governess to meet all its objectives? Ans. Page 660 Ans. 2 Q3 . What benefits does an e-business offer to the customers?? Ans. Page 660 Ans. 3 Q4 . What benefits (mention at least five) does an e-business offer to an organization? Ans. Page 661 Ans. 4 Q5 . How is e-learning proved useful for a trainer ? Ans. Page 661 Ans. 5 Q6 . What you think is most outstanding feature of e-learning ? Ans. Page 661 Ans.6 Q7 . What do you think e-learning course have high dropout rate? Ans. Page 661 Ans. 7