Professional Documents
Culture Documents
izh&cksMZ ijh{kk
Class d{kk :- XII th ckjgoha
COMPUTER SCIENCE (Theory)
MM : 70
No.
Question
s
1.
(a)
(b)
Marks
What is the difference call by value and call by reference with respect to
memory allocation ?Give suitable C++ code to illustrate both.
void main()
{
char name[20];
cin >>name;
cout<<(char)toupper( name[0] ) << for <<setw(25)<<name;
}
(c)
Rewrite the following program after removing the syntactical errors (if
any). Underline each correction.
#include<iostream.h>
#include<stdio.h>
class MyStudent
{
int StudentId =
875; char
Name[20]; public:
MyStudent (){}
void Register(){cin>> StudentId;
gets name
}
void Display(){ cout << StudentId<<,<<name<<endl;}
};
void main()
{MyStudent
MS
Register.MS;
MS.display();
}
No.
(d)
Questions
Find the output of the following program:
#include<iostream.h>
void ChangetheContent(int Arr[], int Count)
{
Marks
3
(e)
No.
(f)
Questions
In the following program, what will be the expected output(s) from the
following options (i), (ii), (iii) and (iv)?
#include <iostream.h>
#include <stdlib.h>
void main()
{
randomize();
int x=788,y=45;
int a=random(3)+4;
int b=random(2)+2;
for(int i=0;i<a; i++)
cout<<@;
cout<<x<< , ;
for(i=0;i<b ; i++)
cout<<$;
cout<<y<<endl;
}
(i)
@@@788,$ 45
(ii)
@@788,$$ 45
(iii)
@@@@@@788,$$ 45
(iv)
@@@@788,$$$$ 45
Marks
2
No.
Questions
Marks
(a)
(b)
Answer the questions (i) and (ii) after going through the following class:
2.
class Birds
{ public:
char category[20];
Birds( char bname[])
{
strcpy(category, bname)
}
Birds(Birds &t);
};
// function1
//function2
i)
ii)
c)
No.
(d)
Questions
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)
(ii)
(iii)
(iv)
Write the names of data members which are accessible from objects
belonging to class CUSTOMER.
Write the names of all the member functions which are accessible
from objects belonging to class SALESMAN.
Write the names of all the members which are accessible from member
functions of class SHOP.
How many bytes will be required by an object belonging to class SHOP?
Marks
4
No.
3
(a)
(b)
(c )
(d)
Questions
Marks
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 the Base
Address of the array is 5000.
Write a function in C++ to find the sum of both left and right diagonal elements from
2
a two dimensional array (matrix).
(e)
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 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);
;
int Bytes =
int Count = Bytes / sizeof(Item);
File.close();
return Count;
//statement 1
; //statement 2
(b)
(c )
NAME
POST
2001
2002
2003
2004
2005
AJAY
VIJAY
RAM
RAHIM
ABBAS
GENERAL MANAGER
EXECUTIVE MANAGER
DEPUTY MANAGER
PROD. INCHARGE
ADD.GENERAL
MANAGER
SGRADE
D003
D002
D003
D002
D001
DOJ
23-Mar-2003
12-Feb-2010
24-Jan-2009
11-Aug-2006
29-Dec-2004
Table:GROSSINCOME
SGRADE
D001
D002
D003
SALARY
56000
32000
24000
HRA
18000
12000
8000
(II)
(b)
(c)
Write SOP form of Function F(x,y,z) whose truth table representation is given
below:
x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
F
0
0
1
0
1
0
1
1
(d)
7(a)
(c )
(e)
(b)
(d)
1
1
1
FAZZ
RAJ
HARSH
JAZZ
50 m
60 m
25 m
170 m
125 m
90 m
15
150
15
25
e1)
e2) Suggest the most suitable place (i.e. building) to house the server of this
organisation with a suitable reason.
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 W AN will be formed?
Justify your answer.
(f)
What do you mean by Spam Mails? How can you protect your mailbox from Spams?
(g)
1
1