ai1999

11
Examination Paper 1 Examination Papers, 1999 [All India] Maximum Marks : 70 Duration : 3 Hours Note. All the questions are compulsory. Programming Language : C++ 1. (a) Write two advantages of using include compiler directive. 2 (b) Name the header files of C++ to which the following functions belong : 2 (i ) strcpy (ii) getxy (iii ) puts (iv) gets (c) Find syntax error(s), if any, in the following program : 2 #include<iostream.h> void main() { int x, y; cin >> x; for (x=0; x<5; << ++x) cout y else cout << x << y; } (d) Give the output of the following program : 2 void main() { int i = 3; printf("%d%d%d"), i+5, i-4, scanf("%d", &i); } (e) Write the output of the following program : 3 #include <iostream.h> static int i = 100; void Print(char *P) { p = "Press"; cout <, "value is : " << p << endl; } void main() { char *q = "Best of Luck"; Print(q); cout << "New value is : " << q; } (f ) Write a C++ function that converts a 2-digit decimal number between 0 to 63 into a 8-bit binary number and prints the binary equivalent. 4 Ans. (a) (i ) The #include compiler directive include desired header files in our program. (ii ) It supports modularity i.e. , a bigger program can be decomposed in terms of header files and later included as pre-processor directive. (b) (i ) string.h (ii) conio.h (iii ) stdio.h (iv) stdio.h (c) The correct program is : #include <iostream.h> // Correction 1 void main() { int x, y; cin>> x; for (x = 0 ; x<5 ; ++x) // Correction 2 cout<< y cout<<x<<y ; // Correction 3 } Correction 1 : The condition is terminated by a comma (,), instead of a semicolon (;) . Correction 2 : ‘<<’ is missing.

Upload: ajay-rana

Post on 20-Nov-2015

213 views

Category:

Documents


0 download

DESCRIPTION

board paper comp

TRANSCRIPT

  • Examination Paper 1

    Examination Papers, 1999[All India]

    Maximum Marks : 70 Duration : 3 HoursNote. All the questions are compulsory.

    Programming Language : C++

    1. (a) Write two advantages of using include compiler directive. 2(b) Name the header files of C++ to which the following functions belong : 2

    (i) strcpy (ii) getxy (iii) puts (iv) gets(c) Find syntax error(s), if any, in the following program : 2

    #includevoid main(){

    int x, y;cin >> x;for (x=0; x

  • 2 Together with Computer Science (C++) XII

    Correction 3 : else cannot exist without if.(d) The output is :

    8 13(e) value is :Pass

    New value is : Best of luck(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 decimald1 = octal;int i = 0;while (d1 >= 10) {

    q = d1 / 10;r = d1 % 10;X[i] = q;d1 = r;if (d1 = 0; i) {

    strn = (itoa(X[i], strn,10));tstrn = strcat(tstrn, strn);

    }// Then again the string character converted into decimal numberdecimal = atoi(tstrn);// Convert the number into decimald1 = decimal;i = 0;while (d1 >= 2) {

    q = d1 / 2;r = d1 % 2;X[i] = r; // Stores the remainder in arrayd1 = q;if (d1 < 2) {

    i++;X[i] = d1; // Stores the last remainder in array X

    } elsei++;

    }j = i;cout = 0; i --) {

  • Examination Paper 3

    cout

  • 4 Together with Computer Science (C++) XII

    A copy constructor is that constructor which is used to initialize one object with the values fromanother object of same class during declaration.

    (b) // Class and function declaration of the student dataclass student {

    int roll_no;char name[20];char sclass[8];int marks[5];float percentage;float Calculate() {

    float Tot = 0;for (int i=0; i roll_no;cout

  • Examination Paper 5

    (c) Write a User defined function in C++ to display the sum of row element of two dimensional arrayA[5][6] containing integer. 2

    (d) Evaluate the following postfix expression using a stack and show the contents of the stack afterexecution of each operation 2

    5, 6, 9, +, 80, 5,,*,-,/.(e) Give the necessary declaration of a linked list implemented queue containing float type values. Also

    write a user defined function in C++ to add a float type number in the queue. 4Ans. (a) // This function search an element in an array using binary search.

    int binary(int AR[10], int data ,int n) {int i, flag = 0, first = 0, last, pos = 1, mid;last = n - 1;while ((first

  • 6 Together with Computer Science (C++) XII

    for (i=0; i

  • Examination Paper 7

    char name[10];public:

    void getdata() {cin >> quantity;gets(name);

    }void showdata() {

    cout

  • 8 Together with Computer Science (C++) XII

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234

    afile.close();}

    5. (a) What is normalization ? Define first normal form. 2Given the following Student relation :

    Table :Student

    No. Name Age Department Dateofadm Fee Sex1. Pankaj 24 Computer 10/01/97 120 M2. Shalini 21 History 24/03/98 200 F3. Sanjay 22 Hindi 12/12/96 300 M4. Sudha 25 History 01/07/99 400 F5. Rakesh 22 Hindi 05/09/97 250 M6. Shakeel 30 History 27/06/98 300 M7. Surya 34 Computer 25/02/97 210 M8 Shikha 23 Hindi 31/07/97 200 F

    Write SQL commands for (b) to (g) and write output for (h).(b) To show all information about the students of History department. 1(c) To list the names of female students who are in Hindi department. 1(d) To list the names of all students with their date of admission in ascending order. 1(e) To display students Name, Fee, Age for male students only. 1(f) To count the number of students with Age > 23. 1(g) To insert a new row in the STUDENT table with the following data :

    9, Zaheer, 36, Computer, {12/03/97}, 230, M 1(h) Give the output of the following SQL statement : 2

    (i) Select COUNT(distinct department) from STUDENT;(ii) Select MAX(Age) from STUDENT where SEX = F;

    (iii) Select AVG(Fee) from STUDENT where SEX = M;(iv) Select SUM(Fee) from STUDENT where Dateofadm < {01/01/98};

    Ans. (a) Normalization is a process of data analysis used for grouping data elements in a record. Whiledealing with databases there may be unnecessary repetition of data, which can pose problems instoring, and retrieving of data. The unnecessary repetition of data is called redundancy. Normalizationis the process of analyzing data. So, the redundancy gets reduced. First Normal Form : A table is saidto be in first normal form if no two rows are identical and each entry is single value.

    (b) SELECT * FROM STUDENTWHERE department = History ;

    (c) SELECT name FROM STUDENTWHERE department = Hindi and SEX = F ;

    (d) SELECT name FROM STUDENTORDER BY dateofadm ;

    (e) SELECT name, fee, age FROM STUDENTWHERE sex = M ;

    (f) SELECT COUNT(*) FROM STUDENTWHERE AGE > 23 ;

    (g) INSERT INTO STUDENT VALUES (9, ZAHEER, 36, Computer, {12/03/97}, 230 M) ;(h) (i) 3 (ii) 25 (iii) 236.00 (iv) 1080

  • Examination Paper 9

    6. (a) State the idempotence law. Verify the law using truth table. 2(b) Prove (x+y)(x+z) = x+yz abgebraically. 2(c) Write the dual of the Boolean expression (x+y).(x'+y').(y+z). 1(d) Minimise F(w, x, y, z) using Karnaugh map.

    F(x, y, z, w) = (0, 2, 7, 8, 10, 15) 2(e) Draw logic circuit for Full Adder. 1(f) Represent the Boolean expression yz + xz with the help of NAND gates only.(g) Write sum of product form of the following F(x, y, z). The truth table representation for the function

    F is given below : 1

    x y z F0 0 0 00 0 1 10 1 0 00 1 1 01 0 0 11 0 1 11 1 0 01 1 1 1

    Ans. (a) The Idempotent laws states that(i) X + X = X (ii) X.X = X

    The truth table for first part is :

    Input OutputX X X+X0 0 01 1 1

    (b) R. H. S = x + yz= ( x + y).(x + z) [ According to commutative Law X + Y.Z = (X + Y) . (X+Z)]

    (c) x.y + x'z' + y.z(d)

    F = BCD + B'D'

    00 0100

    ABCD

    11 10

    01

    11

    10

    1

    11

    1

    1

    1

  • 10 Together with Computer Science (C++) XII

    (e) The logic circuit of Full Adder is :

    (f) The logic circuit for yz+xz using NAND gate is :

    (g) F(x, y, z) = x'y'z + xy'z' + xy'z + xyz7. (a) What are Repeaters ? 1

    (b) What is the purpose of using a router ? 1(c) Give two advantages and two disadvantages of following network topologies : 2

    (i) Bus (ii) Tree(d) What is the difference between LAN and WAN ? 1

    Ans. (a) Repeater is used to regenerate data and voice signals when they become weaker before reachingdestination node. Repeater read the incoming packet and amplified it and transmitted to anothersegment of the network.

    (b) Router tries to load balance between various paths that exist on networks.(c) (i) Advantages of BUS topology

    1. Short Cable length2. Easy to extend.Disadvantages of BUS topology1. Fault diagnosis is difficult.2. Nodes must be intelligent to select the data send.

    (ii) Advantages of TREE topology1. Easy to extend.2. Fault isolation is easy.Disadvantages of TREE topology1. Dependent on the root computer.2. Complex access protocols.

    yx sum = x + y + z

    carry = x . y + y . z + x . z

    yz+xz

    y

    x

    z

    z

  • Examination Paper 11

    (d) The difference between LAN and WAN are :(i) In LAN the distance between the nodes is limited. But there is no upper limit in WAN. LAN does

    not inherently provide privacy but WAN provide privacy.(ii) WAN operate a speed of less than 1 mbps while LAN operate at between 1 and 10 mbps.

    (iii) WAN interconnect communication facilities in different parts of a country or are used as apublic utility. But LAN is generally owned, used and operated by a single organization.

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile (None) /PDFXOutputCondition () /PDFXRegistryName (http://www.color.org) /PDFXTrapped /False

    /Description >>> setdistillerparams> setpagedevice