Sei sulla pagina 1di 6

Page 1 of 6

MAHARISHI VIDYA MANDIR SENIOR SECONDARY SCHOOL


DATE: 21.12.16 HALF-YEARLY EXAMINATION TIME: 3 HRS
STD: XII COMPUTER SCIENCE – 083/1 MAX.MARKS: 70
Roll. No:____________

Answer the following questions:


1.a) Differentiate between enumerator and typedef. Explain it with an example. (2)
b)Give only the requied header file(s) to run the following code segment successfully:
(1)
void main()
{ char CH, STR[20];
cin>> STR;
CH = toupper(STR[0]);
cout<<STR<<”starts with”<<setw(4)<<CH<<endl;}
c) Rewrite the following program after removing the syntactical errors if any. Underline
the corrections
Note: assume that the required header files are included (2)
class
{int length =5, breadth, height;
Public:
void details()
{ cin>>length>>breadth>>height;
calcvol();}
voidcalcvol()
{volume = length * breadth * height;}
void display()
{ cout<<length<<breadth<<height<<calcvol(); } };
void main()
{ details(4,5,6);
display(); }
d)Give the output for the following code: (2)
void change(int x[4])
{static int k =1;
x[k] = x[k] * k;
k++; }
void main()
{ int x[ ] = {9, 19, 29, 39};
for(int i = 0; i<4; i++)
{ change(x);
cout<< x[i]<<endl;} }
e) Write the output for the following code snippet: (3)
(Assume that necessary header files are already included)
void change(char *s)
{ s = “HaLfYeArLYExaMiNATion 2016”;
for(int j = 0; *(s + j); j++)
if(isupper(*(s+j)))
*(s + j) = *(s+j+1);
else if(islower(*(s+j)))
*(s + j) = *(s++ + ++j);
else *(s + j) = ‘\0’;
puts(s);
}
void main()
{ char *p = “HaVe Fun KiDDoS”;
Page 2 of 6

cout<<++p<<strlwr(p + 6)<<p++<<endl;
change(p);
cout.write(p + 2, 10);}
f) Choose the correct possible outputs for the following code. And also find the minimum
and maximum value for m. (2)
#include<iostream.h>
#include<stdlib.h>
void main()
{ randomize();
int s[ ]= {65,50,118,89,70,41,56};
int m = random(s[2] / s[1] + sizeof(s[0]));
for(int k = 0; k < m; k++)
cout<<(char)s[k] + m<<’,’ ;
}
OUTPUTS
i) 0,1,2,
ii) B,
iii) D,5,y,
iv) 68,53,121,

2.a)What do you understand by the term “Containership”. Explain how it is implemented


in C++. (2)
b) Answer questions (i) and (ii) based on the following declaration: (2)
class travel
{int tour_code;
char package_name[30];
date start_date, end_date; // date is of type struct
public:
travel(travel &);// function 1
travel(int, char*,date, date); //function 2
~travel(); //function 3
Set_data();
Print_data();
};
i) What property is displayed by function 1 and function 2? When an object
iscreated for travel, what will be the order of invocation of constructor?
ii) Define function1 to initialize the members and also invoke it explicitly
C) Define a class election with the following specifications. Write a C++ program to
declare an array of objects of election type and find the winner and display his details if
he got more than 100000 votes.
Private members:
Candidate name, party, votes received
Public members:
Enterdetails() – to input data
Display() - to display the details
Winner() – to return the details of the winner through the object after comparing the
votes received by the candidates. (4)
d) Answer the questions (i) to (iv) based on the following: (4)
class date
{ int dd, mm, yy;
protected:
read_date();
display_date(); };
Page 3 of 6

class author: private date


{ char book_name[20];
protected:
char book_type[20];
float price;
public:
char author_name[20];
set_data();
increment(); };
class publisher : public date
{ protected:
char publisher_name[20];
public:
getdata();
print_data(); };
class book: public publisher, public author
{ public:
book(); };
i) What would be the size of object book.
ii) List out the members that can be accessed from the member functions of the
class book.
iii) List out the member variables that can be accessed from the objects of class
author
iv) Identify the type of inheritance.

3.a) Define a function to insert an element in a circular queue of 5 elements that stores
the following details: (3)
struct student
{int rno; char sname[25]; };
b)An M*N real array has its base address as 100, the element of A[8][15] is in 732 if it
is stored in column wise, the same element is stored in 800 if it is row wise, Find the
total number of bytes allocated for the above array. (3)
c) Write an user defined function to delete a record from the dynamically allocated
queue which has name, age of a child and also a pointer field . (4)
d) Write a C++ function which has an array of strings and the number of strings as their
parameters ,count and display the number of words present on each string (2)
e) Convert the following infix expression to its postfix form: (2)
A or B ^ 3 / E and F + G % 3

4a) Observe the program segment given carefully, and answer the question that follows:
(1)
class Joy
{ int Joy_id;
char Joy_name[20];
public :
// function to enter Joyians details
void enterdetails ( );
// function to display Joyians details
// function to return Joy_id
int AJoy_id( ) { return Joy_id; } };
void Modify ( JOY NEW)
{ fstream File;
File.open (“JOY.DAT”, ios :: binary | ios :: in | ios :: out);
JOY OB;
Page 4 of 6

int Recordsread = 0, Found = 0;


while (!Found && File.read (( char*) & OB, sizeof(OB)))
{ Recordsread++;
if(NEW.AJoy_id( ) = = OB.AJoy_id( ))
{
________________ // Missing Statement1
_________________//Missing statement2
Found = 1;
}
else
File.write((char *)&OB, sizeof(OB)); }
if (!Found)
cout << “Record for modification does not exist”;
File.close ( ); }
If the function Modify( ) is supposed to modify a record in file JOY.DAT with the values of
JOY NEW passed to its argument, write the appropriate statement for Missing
Statements using seekp( ) , seekg( ) and write() , whichever needed, in the above code
that would write the modified record at its proper place.
b) Write a C++ function to create a text file “text.txt”. Transfer the lines that starts with
a vowel to a new file “exam.txt” in reverse order (do not use strrev). Also find the total
number of bytes occupied by the exam file. (2)
c) A College maintains two binary files, one containing the roll nos, names and
addresses of the students and another contains the roll no and the course taken. Create
a third file which contains the roll nos, names and addresses of the students who have
taken up the math course.( Assume that for each entry in the first file there is a
corresponding entry in the second file and that the two files are already created ) (3)

5a) Differentiate between (2)


i) DML and DDL with an example
ii) Cartesian product and Union with an example
b)Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries
(v) to (viii): on the basis of the table (4+2)

BOOKS

Book_ Book_Na Author_na Publisher Price Type Qty


Id me me

F0001 The Tears William First Publ. 750 Fiction 10


Hopkins

F0002 Thunderbol Anna First Publ. 700 Fiction 5


t Roberts

T0001 MyFirstC+ Brain & EPB 250 Text 10


+ Brooke

T0002 C++Brain A.W. TDH 325 Text 5


Rossaine

C0001 Fast Cook Lata Kapoor EPB 350 Cookery 8


Page 5 of 6

ISSUED

Book_Id Quantity_Issu
ed

F0001 3

T0001 1

C0001 5

(i)To display the names and price of the books in descending order of their price.
(ii)To increase the price of all books of First Publ. Publishers by 50.
(iii)To display the Book_Id, Book_Name and Quantity_Issued for all books which have
been issued.
(iv) To insert a new row in the table Issued having the following data: ‘F0002’, 4.
Give the output:
(v) SELECT COUNT (DISTINCT Publisher) FROM Books;
(vi) SELECT SUM(Price) FROM Books WHERE Qty > 5;
(vii) SELECT Book_Name, Author_Name FROM Books WHERE Price <500;
(viii) SELECT COUNT (*) FROM Books;

6a)State and prove De-morgan’s theorem using truth table (2)

(b)Write the equivalent Boolean expression for the following Logic Circuit: (1)

c)A combinational circuit has 3 inputs and one output. Output is 1 if:
(i) All the inputs are equal to 1.
(ii) None of the inputs are equal to 1.
(iii) An odd number of inputs are equal to 1.
Obtain the truth table and find the simplified output function in POS form
(1)
d)Obtain a simplified form for the Boolean expression using K-map. (3)
F(a,b,c,d) = ∑(0,2,5,8,9,10,11,13,15)
e) Implement the following expression using NAND – NAND
logic: (1)
F = p’ q’ + rs
7.a) Compare any two switching techniques (1)
b) How is TELNET service of internet useful? (1)
c) Which of the following crime(s) does not come under cybercrime? (1)
i) Stealing keyboard and mouse from a shop
ii) Copying some important data from a computer without taking permission from the
owner of the data.
d)What is the purpose of using a web browser? Name any one commonly used web
browser. (1)
e) Anuradha is a web developer. She has designed a login form to input the login id and
password of the user. She has to write a script to check whether the login id and the
corresponding password as entered by the user are correct or not. What kind of script
from the following will be most suitable for doing the same?
Page 6 of 6

(i) Client-side script


(ii) JSP
(iii) VB Script (1)
f) What is web hosting? (1)
g) “Vidya Mandir for All” is an educational NGO. It is setting up its new campus at Jaipur
for its web based activities. The campus has four buildings as shown in diagram below:
(4)

Main Resource
Building Building

Accounts
Training
Building
Building

Center to center distances between various buildings as per architectural drawings (in
meters) is as follows:

Main Building to Resource Building 120m


Main Building to Training Building 40m
Main Building to Accounts Building 135m
Resource Building to Training Building 125m
Resource Building to Accounts Building 45m
Training Building to Accounts Building 110m
Expected number of Computers in each building is as follows:

Main Building 15
Resource Building 25
Training Building 250
Accounts Building 10
(i)Suggest a cable layout of connection between the buildings.
(ii)Suggest the most suitable place( i.e building) to house the server of this NGO. Also
provide a suitable reason for your suggestion.
(iii)Suggest the placement of the following devices with justification:
i. Repeater
ii. Hub/Switch
(iv)The NGO is planning to connect its International office situated in Delhi. Which out of
following wired communication links, will you suggest for very high speed connectivity?
i) Telephone Analog Line ii) Optical Fibre iii) Ethernet Cable

☺☺☺☺☺ALL THE BEST☺☺☺☺☺

Potrebbero piacerti anche