0% found this document useful (0 votes)
13 views

Computer Science

Uploaded by

Ayush Pradhan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Computer Science

Uploaded by

Ayush Pradhan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ASN Senior Secondary School

PREBOARD EXAMINATION 2019-20


COMPUTER SCIENCE TIME- 3 HR.
CLASS XII MM-70
…….....................................................................................................................................……………..
General Instructions:-
All the questions are compulsory.
Do all parts of the same question together.
-------------------------------------------------------------------------------------------------------------------
1 (a) What is the difference between call by value and call by reference method? Explain
with the help of suitable code. (2)

(b) Write the names of header files, which are necessary to run the following program. (1)
void main()
{ int number;
cin>>number;
if(abs(number)== number);
cout<<”positive”; }

(c ) Observe the following C++ code very carefully and rewrite it after removing any/all
syntactical errors with each correction underlined. (2)

Note : Assume all required header files are already being included in the program.

#Define float Max=70.0;


void main()
{ int Speed char Stop=’N’;
cin>>Speed;
if Speed>Max
Stop= “Y”;
cout<<Stop<<end;

(d) Observe the following C++ code carefully and obtain the output, which will appear
on the screen after execution of it. (2)
Important Note:
● All the desired header files are already included, which are required to run the code.
#include<iostream.h>
#include<ctype.h>
void Mycode(char Msg[],char CH)
{ for(int cnt=0;Msg[cnt]!=‘\0’;cnt++)
{
if(Msg[cnt]>=‘B’&& Msg[cnt]<=‘G’)
Msg[cnt]=tolower(Msg[cnt]);
else
if(Msg[cnt]==‘N’|| Msg[cnt]==‘n’|| Msg[cnt]==‘ ’)
Msg[cnt]=CH;
else
if(cnt%2==0)

1
Msg[cnt]=toupper(Msg[cnt]);
else
Msg[cnt]=Msg[cnt–1];
} }
void main()
{ char MyText[]="Input Raw";
Mycode(MyText,‘@’);
cout<<"NEW TEXT:"<<MyText<<endl; }

(e) Observe the following C++ code carefully and obtain the output, which will appear on
the screen after execution of it. (3)

Important Note:

● All the desired header files are already included, which are required to run the code.

#include<iostream.h>
void in(int x,int y, int &z)
{ x+=y;
y – –;
z*=(x–y);
}

void out(int z,int y, int &x)


{ x*=y;
y++;
z/=(x+y);
}

void main()
{ int a=20, b=30, c=10;
out(a,c,b);
cout<<a<<"#"<<b<<"#"<<c<<"#"<<endl;
in(b,c,a);
cout<<a<<"@"<<b<<"@"<<c<<"@"<<endl;
out(a,b,c);
cout<<a<<"$"<<b<<"$"<<c<<"$"<<endl; }

(f) Based on the following C++ code, find out the expected correct output(s) from the options (i)
to (iv). Also find out the minimum and the maximum value that can be assigned to the variable
TRICK used in the code at the time when value of Count is 3: (2)

#include<stdlib.h>
#include<iostream.h>

void main()
{
randomize();
char status[] [10]= { “EXCEL”, “GOOD”, “OK”};
int turn=10, trick;
for(int count=1; count<4; count++)
{

2
trick=random(count);
cout<<turn-trick<< status[trick]<<”#”;
turn--;
}
}
Outputs:
(i) 10EXCEL#9EXCEL# 6OK#
(ii) 10EXCEL#8OK# 9GOOD#
(iii) 10EXCEL#9GOOD#10EXCEL#
(iv) 10EXCEL#10GOOD# 8OK#

2 (a) Explain the concept of data hiding and data abstraction with the help of an example.
(2)

(b) Answer the questions (i) and (ii) after going through the following class: (2)
class Book
{ char Title[20];
int price;
public:
Book() //Function 1
{
}
void Details() //Function 2
{
cout<<”book detail function”<<endl;
}
Book(int p) //Function 3
{ }
Book(Book &B); //Function 4
};
(i) Write the complete definition of function 1.
(ii) Write statements that would call the member Functions 2 and 4.

(c) Write the definition of a class PIC in C++ with following description : (4)
Private Members
– Pno //Data member for Picture Number (an integer)
– Category //Data member for Picture Category (a string)
– Location //Data member for Exhibition Location (a string)
– FixLocation //A member function to assign//Exhibition Location as per category
//as shown in the following table
Category Location
Classic Amina
Modern Jim Plaq
Antique Ustad Khan
Public Members
– Enter() //A function to allow user to enter values
//Pno, category and call FixLocation() function
– SeeAll() //A function to display all the data members

(d) Answer the questions (i) to (iv) based on the following code: (4)
class CUSTOMER
{
int Cust_no;
char Cust_Name[20];

3
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 all the members which are accessible from objects belonging to class
SALESMAN.
(ii) Is the function Enter() accessible by status() of class CUSTOMER.
(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 SALESMAN?

3. (a)
Write definition for a function TOPBOTTOM(int M[][5],int N,int M) in C++,
which finds and displays sum of the values in topmost row and sum of the values in
bottommost row of a matrix M (Assuming the parameter N represents number of Row and the
parameter M represent number of Columns). For example, if the content of array M having N
as 4 and M as 5 is as follows : (3)

10 20 30 40 50
12 15 32 4 15
38 4 11 24 15
5 10 15 20 25
The function should find the sum and display the same as : Sum of Top Row : 150 Sum of
Bottom Row : 75

(b) Write a user-defined function NoTwoThree(int Arr[], int N) in C++, which should display
the value of all such elements and their corresponding locations in the array Arr (i.e. the array
index), which are not multiples of 2 or 3. N represents the total number of elements in the array
Arr, to be checked. 3 Example : If the array Arr contains
25 8 12 49 9 (2)
Then the function should display the output as : 25 at location 0 49 at location 3

4
(c) A two dimensional array P[20] [50] is stored in the memory along the row with
each of its element occupying 4 bytes, find the address of the element P[10] [30],
if the element P[5] [4] is stored at the memory location 15000. Also mention the total number of
bytes occupied by an array P (3)

(d) Write a function in C++ to perform Insert operation in a circular Queue containing Player’s
information (represented with the help of an array of structure PLAYER). (4)
struct PLAYER
{ long PID; //Player ID
char Pname[20]; //Player Name
};

(e) Convert the following infix expression to its equivalent Postfix expression,
showing the stack contents for each step of conversion. (2)
X / Y + U* (V–W)

4. (a) A binary file “Students.dat” contains data of 10 students where each student’s data is an
object of the following class: (1)
class Student
{ int Rno; char Name[20];
public:
void EnterData()
{cin>>Rno; cin.getline(Name,20); }
void ShowData() {cout<<Rno<<” - ”<<Name<<endl;}
};

With reference to this information, write output of the following program segment:
ifstream File;
Student S;
File.open(“STUDENTS.DAT”,ios::binary|ios::in);
File.seekg(0, ios::end);
cout<<File.tellg();

(b) Write a function COUNT ( )in C++ which reads the content of a text file “MYFILE.txt” and
count the words do and did (not case sensitive) present in the text file. (2)

(c ) Given a binary file “EMP.DAT”, containing records of the following structure type. (3)

struct EMP
{
int EMP_code;
char EMP_name[20];
double salary;
};

Write a function in C++ that would read contents from the file EMP.DAT and create a file
named MANAGER.DAT copying only those records from EMP.DAT to
MANAGER.DAT who have salary between 200000 and 500000.

5
5. (a) Following is the list of SQL commands. Separate them into DDL and DML commands.

CREATE, UPDATE, DELETE, ALTER, SELECT, DROP, INSERT (2)


(b)
Consider the following tables DRESS and MATERIAL. Write SQL commands for the statements
(i) to (iv)

DRESS
CODE Dress Name Price Mcode Launchdate SIZE
1001 Shirt 1800 M001 10-Feb-01 L
1002 Frock 1100 M002 29-Dec-08
1003 Skirt 2000 M002 18-Feb-09 M
1004 Pant 3000 M001 1-Jan-10 M
1005 Top 500 M003 21-Sep-11 L
1006 Slacks 450 M003 23-Jul-13
MATERIAL
Mcode Type
M001 Terelene
M002 Cotton
M003 Polyester
M004 Silk
i) Increase the Price of those dresses by 10% whose size is M. (1)
ii) To display the MATERIAL CODE and the total PRICE from the table DRESS.
(1)
The expected output of the query should be
Mcode Total Price
M001 4800
M002 3100
M003 950
(c) Write SQL statement to display DRESSCODE, DRESS NAME, Price and TYPE from the
tables DRESS and MATERIAL. (2)
(d) Give the output of the following SQL queries (½ X4=2)

i. SELECT TYPE, DRESSNAME from DRESS WHERE PRICE BETWEEN 1700 AND
2000;
ii. Select DISTINCT(MCODE) From Dress;
iii. SELECT COUNT(SIZE) FROM DRESS;
iv. SELECT CODE FROM DRESS WHERE SIZE= ‘L’;

6. (a) State and verify Distributive law algebraically. (2)


(b) Find the complement of the following Boolean function AB’ + C’D’ . (1)
(c) Write the SOP form of the Boolean function F(P,Q,R) = ∑(0,2,3,5). (1)
(d) Draw the logic diagram for the Boolean expression (x+ y’) . (x+y) using NOR gate.(1)
(d) Reduce the following Boolean Expression to its simplest form using K-Map : (3)
F(P,Q,R,S) = ∑(0,1,2,3,5,6,7,10,14,15)

6
7. (a) To provide telemedicine facility in a hilly state, a computer network is to be setup to
connect hospitals in 6 small villages (V1, V2, . . . , V6) to the base hospital (H) in the state
capital. This is shown in the following diagram.

No village is more than 20km away from the state capital.


Imagine yourself as a computer consultant for this project and answer the following questions
with justification:

(i) Out of the following what kind of link should be provided to setup this network: (1)
(a) Microwave link, (b) Radio Link, (c) Wired link
(ii) What kind of network will be formed: LAN, MAN, or WAN? (1)
(iii) Many times doctors at village hospital will have to consult senior doctors at the base
hospital. For this purpose, how should they contact them: using email, SMS, telephone, or
video conference? (1)
(b) Out of SMTP and POP3 which protocol is the most recent version of standard protocols to
receive emails? (1)

(c) What are cookies in the context of computer networks? (1)

(d) Rajeshwari is trying for on-line subscription to a magazine. For this she has filled in a form on
the magazine’s web site. When she clicks submit button she gets a message that she has left e-
mail field empty and she must fill it. For such checking which type of script is generally executed
– client-side script or server-side script? (1)
(e) Write any two important characteristics of cloud computing. (1)
(f) State any one advantage of 4 G technology over 3 G technology. (1)
(g) What is the importance of cyber law? (1)
(h) Write the difference between Twisted pair and Coaxile cable. (1)

You might also like