Sunteți pe pagina 1din 8

MAHARISHI VIDYA MANDIR SR. SEC.

SCHOOL
CLASS:XII REVISION EXAMINATION-II TIME: 3 HRS
DATE:20 /11/17 COMPUTER SCIENCE 083/2 MARKS:70
ROLL.NO:_____

Answer the following questions:


1.a) Out of the following find and also name the valid derived
data types: (2)
i) long double c; ii) int &c; iii) class c {……….};
iv) int c[10]; v) unsigned char c; vi) void c( );

b) Write the name of the headerfile(s), which is/are essentially


required to run/execute the following code snippet and also find
its output (1)
void main()
{ char *s = “Hello kiddos”;
for(int I = 0; s[I]; I++)
cout<<setw((strlen(s) +I))<<s++<< endl; }

c) Rewrite the following code snippet after removing all


syntactical error(s) with each correction underlined: (2)
( Assume all required header files are included)
class X
{ int l;
const float pi = 3.14;
char s[20];
X(X &t)
{ l = t.l;
s = t.s; }
public:
void accept()
{ cin>>l>>pi>>s;}
void display()
{ cout<<l<<pi<<s; } }ob1;
void main()
{ ob1.accept();
X ob2 =ob2(ob1);
ob2.display(); }

d) Give the output for the following code segment: (3)


( Assume all required header files are included)
void PointersArena( char &*x, char *y)
{ x = “Be*Calm&\0Cool”;
x++;
y = x;
cout<<++y<<strupr(x)<<-- y<<x++; }
void main()
{ char str[] = “Beware!!”, *ptr = str;
PointersArena(ptr,str);

1
for( int j=0; str[j]; j++, ptr++)
cout<<’\n’<<j[str]<<”$$”<<ptr; }

e)Find the output for the following: (2)


( Assume all required header files are included)
int & fun()
{ static int a = 10;
a += 2;
return a; }
void main()
{int x=2;
while(x--)
{int &y = fun();
y += x;
cout<<y<<’:’<<y+2<<’&’<<y++<<endl;}}

f) Choose the output(s) which are not possible for the following
code segment and also find the maximum and minimum values
that are assigned to the variable losnumeros: (2)
#include<iostream.h>
#include<stdlib.h>
#define ESPANOL(x,y) x * y
enum numeros
{ UNO=9,
DOS,
TRES,
CUATRO=-11,
CINCO } ;
void main()
{randomize();
numeros ob1 = TRES;
int losnumeros = random((ESPANOL( DOS+2, CINCO +15))) ;
losnumeros += CUATRO;
for (int i = losnumeros; 0<i; i +=3)
cout<<losnumeros++ + i<<’:’; } }
OUTPUTS:
i) -14:-10:-6:
ii) -22:-18:-14:-10:
iii) -9:-6:-3:
iv)-11:-8:-5:

2a) Explain how Abstract class and Concrete class are inter-
related with an example and also give any one difference
between those two classes. (2)
b) Observe the following C++ code and answer the questions (i)
and (ii). Assume all necessary header files are included: (2)
class RE2
{ int marks;
char *subject;

2
public:
RE2(int s,char *t); //function 1
RE2(RE2 &R); //function 2
~RE2(); //function 3
};
void main()
{ RE2 ob1[20]; //s1
}

i)Does the above statement s1 execute properly, if not, make


necessary changes(Note: Don’t alter the statement s1)
ii) Write a statement to invoke functions 2 and 3. Also write the
function definition for function 2

c) Define a class Tour in C++ with the 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 initialize all data members with 0
• Function EnterTour() to input the values of the data members
tcode, adults, children and invoke AssignFare function.
• Function ShowTour() to print all the details of object of Travel
type.

d)Consider the following code and answer the questions given


below: (4)
class date
{int dd, mm,yy;
protected:
read_data();
display_data(); };
class author: public date
{ char bname[25];
protected:
char btype[25];
float price;
public:
3
date ob1;
char aname[20];
set_data();
increment();};
class publisher: private date
{ protected:
char *pname;
public:
set_data();
print_data();};
class book: public publisher, public author
{ publisher ob2;
public:
book();}ob4;
class library: private book
{ void fn();
}ob5;
i) What would be the size of ob5 and also name the type of
inheritance?
ii) Name the member variables that can be accessed from
book().
iii) What will be the order of invocation of destructors if we
declare an object for class book
iv)Name the member names that can be accessed from fun().

3.a)Write a function check() to check whether the passed array of


integers is sorted or not. The function should return 1 if arranged
in ascending order, -1 if arranged in descending order, 0 if it is
not sorted. (3)

b) An array of strings ARR [L1 …………U1, L2…………U2] which


stores upto 12 strings and each string can have upto 19
characters , starts from the location 1200. If that array is stored
in rowwise, the elemental address of ARR[2][5] is 1397,
otherwise it is 1294. Find the upper and lower limit of row and
column of that array.
Also find the memory space allocated for the array AA. (3)

c) Write a C++ user defined function which accepts an array of


strings, a string to be searched as an argument, check whether
the given string is present on that array of strings or not using
binary search. If it is present return its position else return -1. (2)

d) Write an equivalent postfix expression for the infix expression


given below, showing the stack contents for each step of
conversion: (2)
((X + Y) / (^Z * V) – R)

e) Given the following class (4)


4
char *msg[ ] = {“OVERFLOW”, “UNDERFLOW”};
class CLASS
{int fr, r;
char cq[5];
void err_rep(int e_num)
{ cout<<msg[e_num]; }
public:
void init()
{ fr = r = -1; }
void push(int);
void pop();
};
Define push() function outside CLASS for a statically allocated
circular queue and also that function should invoke err_rep().

4a) Write a function in C++ to find and display the total number
of players from the text file baseball.txt
Data stored on that file in the following form: (2)
LADodgers 25
SFOGiants 23
OaklandA’s 21
………………… ….
………………… ….

b)Write a C++ program to maintain bank account using two


binary files:
i)Master(acno, acholdname, balance)
ii)Transaction(acno, transdate, trantype, amt)
The trantype can either be ‘d’ for deposit or ‘w’ for withdraw.
amt stores the amount deposited or withdrawn. For each
Transaction, the corresponding record in Master file should get
updated. (3)

c)Find the returned value of the following C++ code snippet


considering that “actransit.dat” exists on the hard disk with 272
records . (1)
class transit
{ int routeno;
char destcity[20], origcity[20];
public:
void getrec();
void disprec(); }t;
int readbin( )
{ fstream fin(“actransit.dat”, ios::binary| ios::in);
fin.read((char *)&t, sizeof(transit));
fin.seekp(0,2);
for(int i= 0; i<=3; i++)
fin.seekp(-1*i, 1);
int count = fin.tellg() / sizeof(transit);

5
fin.close();
return count; }
5a) Differentiate between DDL and DML statements with
examples (2)
b) Write SQL queries for (i) to (iv) and find outputs for SQL
queries (v) to (viii), which are based on the tables. (6)
SPORTS
Scode Sportsname Participants PrizeMoney Scheduledate
101 Carrom 2 5000 2012-01-23
102 Badminton 2 12000 2011-12-12
Table
103 4 8000 2012-02-14
Tennis
105 Chess 2 9000 2012-01-01
Lawn
108 4 25000 2012-03-19
Tennis

COACH
Ccode Name Scode
1 Ravi 101
2 Mohan 108
3 Sameer 101
4 Shikhar 103

i)To display scode, the number of coaches for each scode from
the table coach and display scode in descending order.
ii)To display details of those sports and coachname which are
having PrizeMoney more than 9000 and coachname ends with ‘n’.
iii)To display the contents of the sports table with their
coachname whose schedule date is in the year 2019.
iv)Increase the Participants by 6 for the sports carom, chess and
badminton
v)SELECT COUNT(DISTINCT Participants) FROM SPORTS;
vi)SELECT MAX(Scheduledate), MIN(Scheduledate) FROM
SPORTS;
vii) SELECT Sportsname, Name FROM SPORTS, COACH;
viii)SELECT SUM(PrizeMoney) FROM SPORTS WHERE
Participants < 4;

6a) X.Y + X.Z’ + Y.Z = X.Y + X. Z’


Name the above law and prove it algebraically (2)

b) Draw the logic circuit for the following Boolean expression:(2)


(AC)’ + BA + (BC)’
using NOR-NOR logic.

c) Write an equivalent Standard Maximum Term expression


for the reduced Boolean expression given below: (1)
f(p,q,r) = (p + q’)’.r

6
d) Reduce the following Boolean Expression using K-Map: (3)
g(u,v,w,x) = ϖ(0,1,2,6,8,10,11,12)
7a)Write two advantages of using an optical fibre cable over an
ethernet cable to connect two service stations which are
200m away from each other (1)

b) Pratibha is an IT expert and a freelancer. She is undertakes


those jobs, which are related to setting up security software/tools
and managing networks in various companies. If we name her
role in these companies, what it will be out of the following : (1)
(i) Cracker
(ii) Network Admin
(iii) Hacker
(iv)Operator (justify the reason for your chosen option)

c) Go-Fast corporation is a Hyderabad based company, which is


planning to set up training campuses in various cities in next
3 years. Their first campus is coming up in Pune. At Pune
campus, they are planning to have 4 different blocks for HR,
Web Design Training, Programming Training and Hardware
Training. Each block has number of computers, which are
required to be connected in a network for communication,
data and resource sharing. As a network consultant of this
company, you have to suggest the best network related
solutions for them for issues/problems raised in (i) to (iv),
keeping in mind the distances between various
blocks/locations and other given parameters. (4)

HYDERABAD PUNE CAMPUS


Head office PROGRAM
MING

WEB
DESIGN

HR HARDWARE

Shortest distances between various blocks/locations :


Programming Block to HR Block 60 metres
Programming Block to Web Design Block 50 metres
Programming Block to Hardware Block 70 metres

7
HR Block to Web Design Block 120 metres
HR Block to Hardware Block 85 metres
HYDERABAD Head Office to PUNE Campus 504 Km
Number of Computers installed at various blocks are as follows :
HR Block 10
Programming Block 100
Web Design Block 60
Hardware 40
(i) Suggest the most appropriate block/location to house the
SERVER in the PUNE Campus (out of the 4 blocks) to get
the best and effective connectivity. Justify your answer.
(ii) Suggest a device/software and where it is to be
installed in PUNE Campus to take care of data security
(iii) Suggest the best wired medium and draw the cable layout
(Block to Block) to efficiently connect various Blocks within
the PUNE campus.
(iv) Suggest a device and the protocol that shall be needed to
provide Video Conferencing solution between PUNE
Campus and Hyderabad Head Office.

d) Why do we need Intellectual property rights? (1)

e) Give two examples of web browser and web server (1)

f) 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? (1)
i) JSP ii) Client-side script iii) VB script

g) What do you mean by IP address? How is it useful? (1)

☺☺☺☺☺ENJOY UR PAPER KIDDOS☺☺☺☺☺

S-ar putea să vă placă și