Documente Academic
Documente Profesional
Documente Cultură
[Delhi]
Maximum Marks : 70 Duration : 3 Hours
Note. All the questions are compulsory.
Programming Language : C++
Examination Paper 1
main()
{ int x[5], *y, z[5], i; // Error 1
for (i = 0; i< 5; i++) // Error 2
{ x[i] = i;
z[i] = i+3;
y = z;
x = y; // Error 3
}
}
Error 1 : Semicolon missing (;)
Error 2 : Declaration syntax error, i is not declared and for statement does not closed
Error 3 : lvalue required
(d) The output is : E
(e) The output is : First = 8 second = 2
(f) // Function to convert a 2-digit octal number into binary number
void octal_to_binary(int octal) {
long binary = 0;
int decimal;
int X[10];
int d1, d2, b12, b2, q, r;
// Convert the number into decimal
d1 = octal;
int i = 0;
while (d1 >= 10) {
q = d1 / 10;
r = d1 % 10;
X[i] = q;
d1 = r;
if (d1 <= 10)
{
i++;
X[i] = r;
}
else
i++;
}
int j = i;
char *strn = “ “;
char *tstrn= “ “;
// Steps to convert the array numbers into a whole integer
// For example, suppose the octal number is 14
// then, its decimal is X[1] = 4 and X[2] = 1
// so, the number will be 41 by the following steps :
for (i = j; i >= 0; i—) {
strn = (itoa(X[i], strn,10));
tstrn = strcat(tstrn, strn);
}
// Then again the string character converted into decimal number
decimal = atoi(tstrn);
// Convert the number into decimal
d1 = decimal;
i = 0;
while (d1 >= 2) {
q = d1 / 2;
Examination Paper 3
(iv) Is the member function outputdata accessible to the objects of heavy_vehicle class ?
Ans. (a) A visibility mode specifies whether the features of the base class are privately derived, protectedly
derived or publicly derived. The default visibility mode is private. There are three visibility modes:
(i) A member (either data member or member function) declared in a private: section of a class can
only be accessed by member functions and of that class.
(ii) A member (either data member or member function) declared in a protected section of a class
can only be accessed by member functions and of that class, and by member functions and of
derived classes.
(iii) A member (either data member or member function) declared in a public: section of a class can
be accessed by anyone.
(b) // Class and function declaration of teacher class
class Teacher {
char Name[20];
char Subject[10];
float Basic, DA, HRA;
float Salary;
float Calculate() {
return (Basic + DA + HRA);
}
public :
void Readdata() {
cout << "Enter teacher name : ";
gets(Name);
cout << "Enter subject : ";
gets(Subject);
cout << "Enter basic salary : ";
cin >> Basic;
cout << "Enter DA : ";
cin >> DA;
cout << "Enter HRA : ";
cin >> HRA;
Salary = Calculate();
}
void Dispdata() {
cout << "Teacher name : " << Name<<endl;
cout << "Subject is : " << Subject << endl;
cout << "Basic Salary : " << Basic<<endl;
cout << "DA is : " << DA<<endl;
cout << "HRA is : " << HRA << endl;
cout << "Netpay is : " << Salary<<endl;
}
};
(c) (i) Base class : vehicle
(ii) make and load
Derived class : heavy_vehicle
(iii) readdata(), writedata()
(iv) No
3. (a) Suppose an one dimensional array AR containing integers is arranged in ascending order. Write a
user defined function in C++ to search for one integer from AR with the help of binary search method,
returning an integer 0 to show absence of the number and integer 1 to show presence of the number
in the array. The function should have three parameters : 4
(i) and array AR
Examination Paper 5
(c) // Function to calculate the multiplication of row elements
void Row_mult(int A[4][6]) {
int mult, i, j;
for (i=0; i<4; i++) {
mult = 1;
for (j = 0; j<6; j++)
mult = mult * A[i][j];
cout << "Multiplication of row : " << i+1 << " is : " << mult << endl;
}
}
(d) The stack operation is :
Scanned elements Operation Stack
5 PUSH 5 5
11 PUSH 11 5, 11
- POP 11
POP 5
Calculate 5-11=-6
PUSH –6 -6
6 PUSH 6 -6, 6
8 PUSH 8 -6, 6, 8
+ POP 8
POP 6
Calculate 6+8=14
PUSH 14 -6, 14
12 PUSH 12 -6, 14, 12
* POP 12
POP 14
Calculate 14*12=168
PUSH 168 -6, 168
/ POP 168
POP –6
Calculate –6/168 = -1/28
PUSH –1/28 -1/28
∴Ans = -1/28
(e) // Declares a queue structure
struct node {
float data;
node *link;
};
// Function body for delete queue elements
node *del_Q(node *front, float &val) {
node *temp;
clrscr();
if (front == NULL) {
cout << “Queue Empty “;
val = -1;
} else {
temp = front;
front = front->link;
val = temp->data;
Examination Paper 7
Write SQL commands for (b) to (g) and write output for (f) on the basis of Teacher relation given
below :
TABLE :TEACHER
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
No. Name Age Department Date_of_join Salary Sex
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1. Jugal 34 Computer 10/01/97 12000 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
2. Sharmila 31 History 24/03/98 20000 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
3. Sandeep 32 Maths 12/12/96 30000 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
4. Sangeeta 35 History 01/07/99 40000 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
5. Rakesh 42 Maths 05/09/97 25000 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
6. Shyam 50 History 27/06/98 30000 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
7. Shiv Om 44 Computer 25/02/97 21000 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
8 Shalakha 33 Maths 31/07/97 20000 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
(b)To show all information about the teacher of History department. 1
(c)To list the names of female teachers who are in Maths department. 1
(d)To list the names of all teachers with their date of joining in ascending order. 1
(e)To display teacher’s Name, Salary, Age for male teachers only. 1
(f)To cout the number of teacher’s with age < 23. 1
(g)To insert a new row in the TEACHER table with the following data :
9, “Raja”, 26, “Computer”, {13/05/95}, 23000, “M” 1
(h) Give the output of the following SQL statement : 2
(i) Select COUNT(distinct department) from TEACHER;
(ii) Select MAX(Age) from TEACHER where SEX = “F”;
(iii) Select AVG(Salary) fromTEACHER where SEX = “M”;
(iv) Select SUM(Salary) from TEACHER where Date_of_join < {12/07/96};
Ans. (a) Normalization is a process of data analysis used for grouping data elements in a record. While
dealing with databases there may be unnecessary repetition of data, which can pose problems in
storing, and retrieving of data. The unnecessary repetition of data is called redundancy. Second
normal form :A table is said to be in 2NF if it is in first normal form and each non-key attribute depends
on the entire key.
(b) SELECT * FROM TEACHER WHERE department = “History” ;
(c) SELECT name FROM TEACHER WHERE department = “Math” and SEX = “F” ;
(d) SELECT name FROM TEACHER
ORDER BY dateofjoin;
(e) SELECT name, salary, age FROM TEACHER
WHERE sex = “F” ;
(f) SELECT COUNT(*) FROM TEACHERWHEREAGE < 23;
(g) INSERT INTO TEACHER
VALUES (9, “Raja”, 26, “Computer”, {13/05/95}, 2300, “M”) ;
(h) (i) 3 (ii) 35 (iii) 23600 (iv) 0
6. (a) State the distributive law. Verify the law using truth table. 2
(b) Prove x+x’y = x+y algebraically. 2
(c) Write the dual of the Boolean expression (x+y).(x’+y’). 1
(d) Minimise F(w, x, y, z) using Karnaugh map.
F(w,x,y,z) = Σ(0, 4, 8, 12) 2
Examination Paper 9
(e) The logic circuit for a half adder is :
x sum = x + y
y
carry = x . y
y y+ z (x + y) (y + z) (z + x)
z
z z+x
x
(g) F(x,y,z) = x’yz’+ xy’z’ + xyz’ + xyz
7. (a) What is a bridge ? 1
(b) What is the purpose of using FTP ? 1
(c) Give two advantages and two disadvantages of following network topologies : 2
(i) Star (ii) Tree
(d) What is the difference between WAN and MAN ? 1
Ans. (a) A bridge device filters data traffic at a network boundary. Bridges reduce the amount of traffic on a
LAN by dividing it into two segments.
(b) FTP is the protocol or set of rules, which enables files to be transferred between computers. FTP is
a powerful tool which allows files to be transferred from “computerA” to “computer B”, or vice versa.
(c) (i) Advantages of STAR topology
1. One Device per connection
2. Easy to access.
Disadvantages of STAR topology
1. Long cable length
2. Central node dependency
(ii) Advantages of TREE topology
1. Easy to extend.
2. Fault isolation is easy.
Disadvantages of TREE topology
1. Dependent on the root computer.
2. Complex access protocols.
(d) The difference between WAN and MAN are :
(i) In MAN the distance between the nodes is limited i.e; up to one small city or town. But there is
no upper limit in WAN.
(ii) WAN operate at much higher speed than MAN.