stmat computer sc

Upload: siddhant-gangapurwala

Post on 07-Apr-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 StMat Computer Sc

    1/45

    Kendriya Vidyalaya Sangathan

    Lucknow Region

    Study MaterialSubject : Computer Science

    Class - XII

    Prepared under supervision of

    Sh. M.S. Chauhan

    Astt. Commissioner KVS (LR)

    Under Guidance of

    Sh. B.K. Gupta

    Principal

    Kendriya Vidyalaya No. 3 AFS Chakeri Kanpur

    Prepared By

    Ms. Jayati PGT(Comp. Sc.) KV No. 3 AFS Chakeri, Kanpur

    Ms. Neetu Saxena PGT(Comp. Sc.) KV Cantt, Kanpur (I Shift)

  • 8/4/2019 StMat Computer Sc

    2/45

    Mr. Ratnesh Jain PGT(Comp. Sc.) KV Cantt, Kanpur (II Shift)

    Mr. A. K. Joshi PGT(Comp. Sc.) KV No. 1 AFS Chakeri, Kanpur

    Ms. Preeti Sharma PGT(Comp. Sc.) KV No.1 Armapur, Kanpur

    IndexUnit Concept Name Page No.

    1 :

    Programming

    in C++

    Flow Chart of concepts under Unit 1

    1.1 C++ Revision Tour

    1.2 Object Oriented Programming1.3 Function overloading

    1.4 Classes and objects

    1.5 Constructors & Destructors1.6 Inheritance : Extending Classes

    1.7 Data file handling

    1.8 Pointers

    3-5

    6

    1111

    13

    1518

    21

    27

    2 : Data

    StructureFlow Chart of concepts under Unit 2

    2.1 Static representation

    2.2 Linked representation

    31

    32

    33

    3: Database

    & SQLFlow Chart of concepts under Unit 3

    3.1 Definitions and terms used in DBMS3.2 Working with DDl Commands

    3.3Working with DML commands3.4 Writing SQL Select command3.5 Working with aggregate functions

    34

    3535

    373737

    4 : Boolean

    AlgebraFlow Chart of concepts under Unit 4

    4.1 Verification of laws of associativity4.2 Verification of laws using Truth Table

    4.3 Working with SOP and POS forms of expressions

    4.4 Reducing Boolean Expression4.5 Design of logic circuits

    38

    3939

    39

    3940

    5 :

    Communication & Open

    Source

    Concepts

    Flow Chart of concepts under Unit 55.1 Terminologies in Data Communication

    5.2 Use of various transmission medias in data communication

    5.3 Bus, Star & Tree topologies & LAN, MAN, WAN5.4 Setting up a LAN

    5.5 Network protocol, Security concepts, Web Server

    5.6 Open source terminologies

    5.7 Abbreviations

    4142

    42

    4243

    45

    45

    45

    2

  • 8/4/2019 StMat Computer Sc

    3/45

    3

  • 8/4/2019 StMat Computer Sc

    4/45

    4

    Tokens, Fundamental Data types, Variables, Operators, Type

    Conversion, Header files, Type of errors.

    Flow of Control: ifelse, switch, for loop, while loop and do

    while loop.

    C++ Revision Tour

    Structure: Definition, variable declaration, access to the

    members using structure variable, passing structure type

    variable to function.

    Library Functions: Character and random functions

    User Defined Function: Prototype Declaration, Function

    Definition, Passing and returning values, calling function: call by

    value and call by reference.

    One Dimensional Array and character array: Declaration,

    Initialization and Access to the array members.

    Unit 1 : Programming with C++

    Object Oriented Programming

    Comparison between Object Oriented Programming and Procedural

    Programming

    Object Oriented Programming Concepts and their implementation:Object, Class, Data Abstraction, Inheritance, Data Encapsulation,

    Polymorphism, Modularity.

    Function Overloading

    Define Function Overloading, Declaration and Definition, How

    compiler resolve the call to the overloaded function or Steps Involved

    in Finding the Best Match, Calling Overloaded function

    Classes And Objects

    Class Specification: Class definition: Visibility modes, Class

    method definitions: Inside the Class Definition, Outside the ClassDefinition, Referencing Class Members, Array as class member.Destructor: Declaration and Definition, Characteristics ofDestructors

    Constructors And Destructors

    Constructor Overloading

    Constructor and Its Type: Declaration and Definition

  • 8/4/2019 StMat Computer Sc

    5/45

    5

    Inheritance: Extending Classes

    Inheritance: Definition, Uses/Advantages, Base and Derived Classes,

    public and private derivation, visibility/Accessibility of Inherited Base

    class Member in Derived class, Type of inheritance, Objects byte size.

    Stream class: Class hierarchy, functions belongs to stream

    classes, Opening and Closing files, File Modes.

    Sequential Input/Output with Files: get( ), getline( ) and put( )

    functions, and checking end of file using EOF.

    Data File Handling

    Basic Operations on Binary Files: Searching, Appending,

    Inserting, Modifying, Deleting records

    File Pointers and Random Access: seekg( ), seekp( ), tellg( ), tellp().

    Reading and Writing Class objects

    String Pointer

    Pointers

    Dynamic allocation Operators: new and delete, creating dynamic

    array, array pointer, pointer arithmetic.

    Pointer Declaration and Initialization

    Const Pointer, Structure Pointer, this Pointer

  • 8/4/2019 StMat Computer Sc

    6/45

    CHAPTER-1C++ Revision Tour

    1. Tokens, Fundamental Data types, Variables, Operators, Expressions and Type Conversion,

    Header files, Type of errors.

    Q.1. What is an identifier? List the rules of naming an identifier of C++.

    Q.2. Name the header file, to which following built-in functions belong to:

    (i) strcpy( ) (ii) gets( ) (iii) abs( ) (iv) isalnum

    (v) sqrt( ) (vi) write( ) (vii) strcmp( ) (viii) exit( )Q.3. Name the header file(s) that shall be needed for successful compilation of the following C++ code:

    void main ( )

    { char Text [40];strcpy (Text, AISSCE);

    puts (Text);

    }Q.4. Differentiate between

    i. Logical and Syntax Error

    ii. Run Time and Syntax Error

    Also give suitable example of each.Q.5. Why main function is special? Give two reasons.

    Q.6. Write two advantages of using include compiler directive.

    Q.7. What is the difference between type casting and automatic type conversion? Explain with suitableexample.

    Q.8. Given the following code fragment:

    int ch = 20;cout

  • 8/4/2019 StMat Computer Sc

    7/45

    Q.3. Find the output of the following program:

    #include void main( )

    {

    long Number = 7583241;int First = 0, Second = 0;

    do

    {

    int R = Number%10;if (R %2 = = 0)

    First += R;

    elseSecond += R;

    Number /= 10;

    }while(Number > 0);coutArray [Ctr];

    }

    Q.2. Rewrite the following program after removing all the syntax error(s), if any. Underline eachcorrection.

    i. #include (iostream.h)

    void main( )

    {int X[ ] = { 60,50,30,40}, Y; Count = 4;

    cin >> Y ;

    for ( I = Count 1 ; I >= 0, I - -)switch( I )

    {

    case 0 :

    case 2 : cout

  • 8/4/2019 StMat Computer Sc

    8/45

    ii) #include

    Void main ( ){ int P[ ] = {90, 10, 24, 15} : Q, Number = 4 ;

    Q = 9;

    For [ int I = Number 1 ; I >= 0, I--]Switch ( I )

    {

    Case 0 :

    Case 3 : cout >> P [ I ] * Q

  • 8/4/2019 StMat Computer Sc

    9/45

    Q.2. Find the output of the following program : 3#include

    void Indirect(int Temp=20)

    {for (int 1=10; I

  • 8/4/2019 StMat Computer Sc

    10/45

    Q.2. In the following program, if the value of N given by the user is 15, what maximum and minimum

    values the program could possibly display?#include

    #include

    void main()

    {

    int N,Guessme;

    randomize();

    cin>>N;

    Guessme=random(N)+10;cout

  • 8/4/2019 StMat Computer Sc

    11/45

    cout

  • 8/4/2019 StMat Computer Sc

    12/45

    CHAPTER-2

    Object Oriented Programming

    1. Comparison between Object Oriented Programming and Procedural Programming.

    Q.1. Write two major differences between Object Oriented Programming and ProceduralProgramming.

    Q.2. What is procedural programming paradigm and what are its limitations?Q.3. Write any two advantages and two disadvantages of Object Oriented Programming.

    2. Object Oriented Programming Concepts and their implementation: Object, Class, Data

    Abstraction, Inheritance, Data Encapsulation, Polymorphism, Modularity.

    Q.1. What do you understand by Polymorphism? Give an example in C++ to show its implementation

    in C++.Q.2. What do you understand by Data Encapsulation and Data Hiding?

    Q.3. What is Inheritance? Give an example in C++ to show its implementation in C++.

    Q.4. Illustrate the concept of Inheritance with the help of an example.

    Q.5. Encapsulation is one of the major properties of OOP. How is it implemented in C++?

    Q.6. Reusability of classes is one of the major properties of OOP. How is it implemented in C++?Q.7. Define the term Data Hiding in the context of Object Oriented Programming. Give a suitable

    example using a C++ code to illustrate the same.

    CHAPTER-3

    Function Overloading

    1. Define Function Overloading, Declaration and Definition, How compiler resolve the call to the

    overloaded function or Steps Involved in Finding the Best Match, Calling Overloaded

    function.

    Q.1. What is function overloading?

    Q.2. Illustrate the concept of function overloading with the help of an example.Q.3. What do you understand by function overloading? Give an example illustrating its use in

    a C++ program.

    12

  • 8/4/2019 StMat Computer Sc

    13/45

    CHAPTER-4Classes And Objects

    1. Class Specification: Class definition: Visibility modes, Class method definitions: Inside the

    Class Definition, Outside the Class Definition, Referencing Class Members, Array as class

    member.

    Q.1. Define a class TEST in C++ with following description:

    Private Membersa. TestCode of type integer

    b. Description of type string

    c. NoCandidate of type integer

    d. CenterReqd (number of centers required) of type integere. A member function CALCNTR() to calculate and return the number of centers as

    (NoCandidates/100+1)

    Public Members

    A function SCHEDULE() to allow user to enter values for TestCode, Description,NoCandidate & call function CALCNTR() to calculate the number of Centres

    A function DISPTEST() to allow user to view the content of all the data membersQ.2. Define a class Tour in C++ with the description given below :

    Private Members :TCode of type string

    NoofAdults of type integer

    NoofKids of type integer

    Kilometres of type integerTotalFare of type float

    Public Members : A constructor to assign initial values as follows :TCode with the word NULL

    NoofAdults as 0

    NoofKids as 0Kilometres as 0

    TotalFare as 0

    A function AssignFare ( ) which calculates and assigns the value of the data member

    TotalFare as followsForeach Adult

    Fare(Rs) For Kilometres

    500 >=1000300 =500

    200

  • 8/4/2019 StMat Computer Sc

    14/45

    A function EnterTour( ) to input the values of the data members TCode, NoofAdults,

    NoofKids and Kilometres; and invoke the Assign Fare( ) function. A function ShowTour( ) which displays the content of all the data members for a Tour.

    Q.3. Define a class named HOUSING in C++ with the following descriptions:

    Private Members:

    REG_NO integer (Ranges 10- 1000)

    NAME Array of characters (String)TYPE Character

    COST Float

    Public Members:

    Function Read_Data() to read an object of HOUSING type.

    Function Display() to display the details of an object.

    Function Draw_Nos() to choose and display the details of 2 houses selected randomly

    from an array of 10 objects of type HOUSING. Use random function to generate the

    registration nos. to match with REG_NO from the array.

    Q.4. Differentiate between private and protected visibility modes in context of Object Oriented

    Programming using a suitable example illustrating each.

    Q.5. What do you understand by visibility modes in class derivations? What are these modes?

    14

  • 8/4/2019 StMat Computer Sc

    15/45

    CHAPTER-5Constructors And Destructors

    1. Constructor and Its Type: Declaration and Definition

    Q.1. What is the use of a constructor function in a class? Give a suitable example of a constructorfunction in a class.

    Q.2. What do you understand by default constructor and copy constructor functions used in classes?

    How are these functions different form normal constructors?Q.3. Differentiate between default constructor and copy constructor, give suitable examples of each.

    Q.4. What is copy constructor? Give an example in C++ to illustrate copy constructor.

    Q.5. Answer the questions (i) and (ii) after going through the following program:

    #include #include

    class Bazar

    {char Type[20];

    char Product[20];

    int Qty;float Price;

    Bazar( ) //Function 1{

    strcpy (Type, Electronic);

    strcpy(Product, Calculator);

    Qty = 10;

    Price = 225;}

    public :

    void Disp( ) //Function 2{

    cout

  • 8/4/2019 StMat Computer Sc

    16/45

    Q.6. Answer the questions (a) and (b) after going through the following class:

    Class Interview{

    Int Month:

    Public:Interview(int y) { Month=y;}

    Interview(Interview & t);

    };

    (a) Create an object, such that it invokes Constructor 1.(b) Write complete definition for Constructor 2.

    2. Constructor Overloading

    Q.1. Answer the questions (i) and (ii) after going through the following program:

    class Match

    {int Time;

    public:

    Match() //Function 1{

    Time=0;cout

  • 8/4/2019 StMat Computer Sc

    17/45

    3. Destructor: Declaration and Definition , Characteristics of Destructors

    Q.1. What is default constructor? How does it differ from destructor?

    Q.2. Why is a destructor function required in classes? Illustrate with the help of an example.Q.3. Answer the questions (i) and (ii) after going through the following class:

    class Science

    {

    char Topic[20];int Weightage;

    public:

    Science ( ) //Function 1

    {

    strcpy (Topic, Optics );

    Weightage = 30;

    cout

  • 8/4/2019 StMat Computer Sc

    18/45

    CHAPTER-6Inheritance: Extending Classes

    1. Inheritance: Definition, Uses/Advantages, Base and Derived Classes, public and private

    derivation, visibility/Accessibility of Inherited Base class Member in Derived class, Type of

    inheritance, Objects byte size.

    Q.1. Differentiate between Protected and Private members of a class in context of Inheritance usingC++.

    Q.2. Define Multilevel and Multiple inheritances in context of Object Oriented Programming. Give

    suitable example to illustrate the same.Q.3. Answer the questions (i) to (iv) based on the following code :

    class Teacher

    {char TNo[5], TName[20], DeptflO];

    int Workload;

    protected:

    float Salary;

    void AssignSal(float);public:

    Teacher( ) ;void TEntry( ) ;

    void TDisplay( );

    };class Student

    {

    char Admno[10], SName[20], Stream[10];protected:

    int Attendance, TotMarks;

    public:Student( );void SEntry( );

    void SDisplay( );

    };class School : public Student, public Teacher

    {

    char SCode[10], SchName[20];public:

    School ( ) ;

    void SchEntry( );

    void SchDisplay( );};

    (i) Which type of Inheritance is depicted by the above example ?

    (ii) Identify the member functiion(s) that cannot be called directly from the objects of classSchool from the following :

    TEntry( )

    SDisplay( )SchEntry( )

    (iii) Write name of all the member(s) accessible from member functions of class School.

    18

  • 8/4/2019 StMat Computer Sc

    19/45

    (iv) If class School was derived privately from class Teacher and privately from class Student

    then, name the member function(s) that could be accessed through Objects of class School.

    Q.4. 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) Write the names of data members which are accessible from objects belonging to classCUSTOMER.

    (ii) Write the names of all the member functions which are accessible from objects belonging to

    class SALESMAN.(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 SHOP?

    Q. 5. Answer the questions (a) to (d) based on the following:

    class PUBLISHER

    {class Pub[12];

    double Turnover;

    protected:

    void Register();

    19

  • 8/4/2019 StMat Computer Sc

    20/45

    public:

    PUBLISHER();void Enter();

    void Display();

    };class BRANCH

    {

    char CITY[20];

    protected:float Employees;

    public:

    BRANCH();void Haveit();

    void Giveit();

    };class AUTHOR: private BRANCH, public PUBLISHER

    {

    int Acode;char Aname[20];

    float Amount;public:

    AUTHOR();void Start();

    void Show();

    };

    a. Write the names of data members, which are accessible from objects belonging to class

    AUTHOR.

    b. Write the names of all the member functions which are accessible from objects belonging toclass BRANCH.

    . Write the names of all the members which are accessible from member functions of class

    AUTHOR.d. How many bytes will be required by an object belonging to class AUTHOR?

    20

  • 8/4/2019 StMat Computer Sc

    21/45

    CHAPTER-7Data File Handling

    1. Stream class: Class hierarchy, functions belongs to stream classes, Opening and Closing files,

    File Modes.

    Q.1. Write two member functions belonging to fstream class.

    Q.2. Differentiate between ifstream class and ofstream class.Q.3. Name two member functions of ofstream class.

    Q.4. Name the stream classes supported by C++ for file input and output.

    Q.5. Distinguish between ios::out and ios::app.Q.6. Read the code given below and answer the question:

    void main( )

    {

    char ch = A;fstream outFile (data.dat, ios::out);

    outFile

  • 8/4/2019 StMat Computer Sc

    22/45

    There is a playground.

    An aeroplane is in the sky.Numbers are not allowed in the password.

    The function should display the output as 3.

    Q.7. Write a C++ program, which reads one line at a time from the disk file TEST.TXT, and displaysit to a monitor. Your program has to read all the contents of the file. Assume the length of the

    line not to exceed 80 characters. You have to include all the header files if required.

    3. Reading and Writing Class objects

    Q.1. Differentiate between functions read( ) and write( ).

    Q.2. Assuming the class STOCK, write functions in C++ to perform following:i. Write the objects of STOCK to a binary file.

    ii. Reads the objects of STOCK from binary file and display them on screen:

    class STOCK

    { int ITNO;

    char ITEM[10];

    public:void GETIT( ) { cin >>ITNO ; gets(ITEM); }

    void SHOWIT( ) { cout

  • 8/4/2019 StMat Computer Sc

    23/45

    4. File Pointers and Random Access: seekg( ), seekp( ), tellg( ), tellp( ).

    Q.1. Observe the program segment given below carefully, and answer the question that follows:

    class PracFile

    {intPracno;

    char PracName[20];

    int TimeTaken;int Marks;

    public:

    // function to enter PracFile details

    void EnterPrac( );// function to display PracFile details

    void ShowPrac( ):

    // function to return TimeTakenint RTime() {return TimeTaken;}

    // function to assign Marks

    void Assignmarks (int M){ Marks = M;}

    };void AllocateMarks( ){ fstream File;File.open(MARKS.DAT,ios::binary|ios::in|ios::out);

    PracFile P;

    int Record = 0;

    while (File.read(( char*) &P, sizeof(P)))

    {

    if(P.RTime()>50)

    P.Assignmarks(0)

    else

    P.Assignmarks(10)

    ______________ //statement 1______________ //statement 2

    Record + + ;

    }

    File.close();

    }

    If the function AllocateMarks () is supposed to Allocate Marks for the records in the fileMARKS.DAT based on their value of the member TimeTaken. Write C++ statements for the

    statement 1 and statement 2, where, statement 1 is required to position the file write pointer to an

    appropriate place in the file and statement 2 is to perform the write operation with the modified

    record.

    Q.2. Observe the program segment given below carefully and fill the blanks marked as Statement 1 andStatement 2 using seekp() and seekg() functions for performing the required task.

    #include

    class Item{

    int Ino;char Item[20];

    public:

    23

  • 8/4/2019 StMat Computer Sc

    24/45

    //Function to search and display the content from a particular //record number

    void Search(int );//Function to modify the content of a particular record number

    void Modify(int);

    };void Item::Search(int RecNo)

    {

    fstream File;

    File.open(STOCK.DAT,ios::binary|ios::in); ______________________ //Statement 1

    File.read((char*)this,sizeof(Item));

    cout

  • 8/4/2019 StMat Computer Sc

    25/45

    File.close() ;}

    If the function modify( ) is supposed to modify a record in the file item.dat , which item_no is y, with

    the values of item x passed as argument, write the appropriate statement for the missing statement using

    seekp( ) or seekg( ), whichever is needed, in the above code that would write the modified record at itsproper place.

    5. Basic Operations on Binary Files: Searching, Appending, Inserting, Modifying, Deleting

    records.

    Q.1. Write a function in C++ to search for a BookNo from a binary file BOOK.DAT, assuming the

    binary file is containing the objects of the following class.

    class BOOK{

    int Bno;

    char Title[20];public:

    int RBno(){return Bno;}

    void Enter(){cin>>Bno;gets(Title);}void Display(){cout

  • 8/4/2019 StMat Computer Sc

    26/45

    int Rno;

    char Name[20];public:

    void Enter(){cin>>Rno;gets(Name);}

    void Display(){cout

  • 8/4/2019 StMat Computer Sc

    27/45

    CHAPTER-8

    Pointers1. Pointer Declaration and Initialization

    Q.1. Distinguish betweenint * ptr = new int(5);

    int * ptr = new int[5];

    Q.2. Give the output of the following program:#include

    void main( )

    { int a =32, *ptr = &a;

    char ch = A, &cho = ch;cho += a; *ptr += ch;

    cout

  • 8/4/2019 StMat Computer Sc

    28/45

    }

    for (int i = 4; i >= 1; i --){

    cout

  • 8/4/2019 StMat Computer Sc

    29/45

    strcat(state_name, b.state_name);

    }};

    void main( )

    {char * temp = Delhi;

    state state1 (temp), state2(Mumbai), state3(Nagpur), S1, S2;

    S1.Replace(state1, state2);

    S2.Replae(S1, State3);S1.display();

    S2.display();

    }

    Q.2. Find the output of the following program:

    #include

    #include

    class country{ char *country name;

    int length;

    public:.

    country ( ) {length =0; country_name=new char [length+1];}country (char *s)

    { length = strlen(s);

    country_name=new char [length +1];strcpy (country_name, s);

    }

    void display ( ){ cout

  • 8/4/2019 StMat Computer Sc

    30/45

    Q.3. What will be the output of the following program

    #include

    #include#include

    #include

    void changestring(char text[], int &counter)

    {char *ptr = text;

    int length=strlen(text);

    for(;counter

  • 8/4/2019 StMat Computer Sc

    31/45

    31

    1. STATIC REPRESENTATION

    (A) Insertion of an element

    1.1 Operations on one dimensional arrays

    (Includes Stack & Queue)

    ( B) Deletion of an element

    ( C) Searching of an element

    (F) Evaluation of a Postfix

    expression

    (E) Traversal

    (D) Sorting of Array

    1.2 Operations on Two Dimensional Arrays

    2.1 Insertion of nodes in a Stack & Queue

    2.2 Deletion of nodes from Stack & Queue

    Unit 2 : Data Structure

    2. LINKED REPRESENTATION

  • 8/4/2019 StMat Computer Sc

    32/45

    Write a function to insert an element in an integer array at the specified location.

    Write a function to insert an element in a Stack.Write a function to insert an element in a Queue

    (i) Write a function to delete a user given element from an array.

    (ii) Write a function to perform pop operation in a stack(iii) Write a function to delete an element from a Queue.

    Write a function to search an element using Linear SearchWrite a function to search an element using Binary Search.

    (i) Write a function using Bubble sort method(ii) Write a function using Selection sort method(iii) Write a function using Insertion sort method

    Write a function to display the content of an Array.

    Write a function to display the content of a Stack.

    Write a function to display the contents of a Queue.

    50,40,+,18,14,-, 4,*,+

    True,False,AND,Trua,True,NOT,OR,AND100,40,8,+,20,10,-,+,*

    32

    1. STATIC REPRESENTATION

    1.1 Operations on one dimensional arrays

    (Includes Stack & Queue)

    (A) Insertion of an element

    ( B) Deletion of an element

    ( C) Searching of an element

    (D) Sorting of Array

    (E) Traversal

    (F) Evaluation of a Postfix expression

  • 8/4/2019 StMat Computer Sc

    33/45

    (i) Write a function in c++ which accepts a 2D array of integers, number of rows

    and number of columns as arguments and assign the elements which are

    divisible by 3 or 5 into a one dimensional array of integers.

    If the 2D array is

    1828511

    27453219

    31162524

    149312

    The resultant 1D arrays is 12 , 3 , 9 , 24 , 25 , 45 , 9 , 5 , 18

    Write a function to multiply two matrices

    Write a function to find Transpose of a Matrix

    1. Write a function to perform a Push operation in a dynamically allocated stack

    considering the following description

    struct node

    {int data;

    struct node * next;};

    2. Write a function in C++ to perform Insert operation in a dynamically

    allocated Queue containing names of students.

    1. Write a function in C++ to delete a node containing Books Information , from a dynamically allocatedStack of Books implemented with the help of the following structure:

    struct book

    {int bno;

    char bname[20];

    book * next;};

    2. Write a insert function in c++ in a dynamically allocated Queue containing Phonno and names of

    customer.

    33

    1.2 Operations on Two Dimensional Arrays

    2. LINKED REPRESENTATION

    2.1 Insertion of nodes in a Stack & Queue

    2.2 Deletion of nodes from Stack & Queue

  • 8/4/2019 StMat Computer Sc

    34/45

    34

    1. Definitions and terminologies used in DBMS

    2.1 Creation of a database using DDL

    commands

    2. Working with DDL Commands

    2.2. Modification in the existing Database

    2.3 Deletion of a table or view

    3. Working with DML Commands

    3.1 To insert records in a table

    3.2 To delete records from a table

    3.3 To update records in a table

    5. Working with Aggregate functions

    4. Writing SQL SELECT command

    Unit 3 : Database and SQL

  • 8/4/2019 StMat Computer Sc

    35/45

    1. What do you understand by Degree and Cardinality of a table?2. What do you understand by Primary Key and Candidate Keys?

    3. What is Data Abstraction?

    4. What is an Alternate Key?

    Consider the following tables while working with SQL commands

    Table : Item

    No ItemName CostPerItem Quantity Dateofpurchase Warranty Operational

    1 Computer 60000 9 21/5/96 2 72 Printer 15000 3 21/5/97 4 2

    3 Scanner 18000 1 29/8/98 3 1

    4 Camera 21000 2 13/10/96 1 1

    5 Switch 8000 1 31/10/99 2 1

    6 UPS 5000 5 21/5/96 1 4

    7 Router 25000 2 11/1/2000 2 5

    Table : Book

    Book_id Book name Author_name Publisher Price Type Quantity

    C0001 Fast Cook Lata Kapoor EPB 355 Cookery 5

    F0001 The Tears

    William

    Hopkins First Publi. 650 Fiction 20

    T0001 My First c++

    Brain &

    Brooke FPB 350 Text 10

    T0002

    C++ Brain

    works

    A.W.

    Rossaine TDH 350 Text 15

    F0002 Thunderbolts Anna Roberts First Publ. 750 Fiction 50

    Table : issued

    Book_Id Quantity Issued

    T0001 4C0001 5

    F0001 2

    35

    1. Definitions and terminologies used in DBMS

    2. Working with DDL commands Commands

  • 8/4/2019 StMat Computer Sc

    36/45

    1. Create table Lab with the following specifications-

    Column Name Data type Size Constraint

    No Number 2 Primary Key

    Itemname Varcahr2 50 NOT Null

    CostperItem Number 7,2Quantity Number 3

    Dateofpurchase Date

    Warranty Number 2

    Optional Varchar2 50

    Create a view Bookview which includes the details of Book_id, Author_name, Price.

    Consider the following structure exists.

    1. Write command to add columns

    Publisher varchar2 50

    Type varcahr2 20Quantity Number 3

    2. Write commands to change the size of Itemname from 50 to 60.3. Write command to delete a column warranty from Item table.

    1.Write command to physically remove itam table

    2. Write command to delete Bookview.

    36

    Column Name Data type Size Constraint

    Book_ id Number 2 Primary Key

    Book_name Varcahr2 50 NOT Null

    Price Number 7,2

    Author_name Varchar2 80

    2.2. Modification in the existin Database

    2.3 Deletion of a table or view

    2.1 Creation of a database using DDL commands

  • 8/4/2019 StMat Computer Sc

    37/45

    1. Write commands to insert two records in Item table

    2. Write commands to insert records in issued table

    1. Write command to delete all the records from item table where warranty is less than 3 years.

    2. Write command to delete all the record from issued table.3. Write command to delete records from Book table where type is Cookery

    1. Write command to increase the price in book table by 10%

    2. Write command to update the publisher name from TDH to TMH3. Write command to update the value of quantity as 6 in issued table for

    book_id T001.

    (a) To show book name, Author name and price of books of First Pub. Publisher

    (b) To list the names from books of text type

    (c) To Display the names and price from books in ascending order of their prices.(d) To display the Book_Id, Book_name and quantity issued for all books which have been issued(e) To show No, Item name , Quantity and warranty where cost per item is less than 20000

    (f) To show the details of items whose date of purchase is before 31 october 97.

    Give the output of the following

    a) Select Count(*) from Books

    b) Select Max(Price) from books where quantity >=15

    c) Select book_name, author_name from books where publishers=first publ.d) Select count(distinct publishers) from books where Price>=400

    e) Select Min(costperitem) from Item

    f)Select Sum( Quantity) from item where warranty is more than 3g) Select count(*) from issued

    h) Select Avg( costperitem) from Item where Operational=1

    37

    3. Working with DML Commands

    3.1 To insert records in a table

    3.3 To update records in a table

    4. Working with Aggregate functions

    3.2 To delete records from a table

    5. Working with Aggregate functions

    4. Writing SQL SELECT command

  • 8/4/2019 StMat Computer Sc

    38/45

    38

    1. Verification of Laws Algebrically

    3. Working with S-O-P and P-O-S forms of

    expressions

    2. Verification of Laws using Truth Table

    4. To reduce a Boolean Expression

    4.1 Algebraic Method

    4.2 Using Karnaugh Map

    5. Design of circuit using Logic gates

    5.2 Universal Logic Gates

    5.1 Basic Logic Gates

    Unit 4 : Boolean Algebra

  • 8/4/2019 StMat Computer Sc

    39/45

    1. State DeMorgans Laws . Verify one of them

    2. State & verify Associative Property3. State Absorption Laws and verify one of the Laws

    1. State Distributive Laws and verify same using Truth table2. State DeMorgans Law and verify one of them using truth table.

    3. Verify commutative Properties using Truth Table

    1. Write the S-O-P form of the function F(A,B,C) for the given truth table

    2. Write the P-O-S form of the function F(A,B,C) for the given truth table

    A B C F

    0 0 0 10 0 1 1

    0 1 0 0

    0 1 1 1

    1 0 0 0

    1 0 1 1

    1 1 0 1

    1 1 1 0

    1. Reduce AB+ (AC) +ABC( AB+C)

    2. AB+(A+B)B

    39

    A B C F0 0 0 10 0 1 1

    0 1 0 0

    0 1 1 1

    1 0 0 0

    1 0 1 1

    1 1 0 0

    1 1 1 0

    1. Verification of Laws Algebrically

    2. Verification of Laws using Truth Table

    3. Working with S-O-P and P-O-S forms of expressions

    4. To reduce a Boolean Expression

    4.1 Algebraic Method

  • 8/4/2019 StMat Computer Sc

    40/45

    1. Obtain a simplified form for a Boolean expressionF( U,V,W,Z)= (0,1,3,4,5,6,7,9,10,11,13,15) using K-Map

    2. Reduce the following Boolean Expression using K- map

    F(A,B,C,D) = (0,2,4,6,8,10,13,14)

    3. Reduce the following Boolean Expression using K-Map:F(U,V,W,Z)= (0,1,2,4,5,6,8,10)

    1. Write the equivalent Boolean Expression for the following Logic Circuit

    2. Design circuit diagram for given expressions

    i)- XYZ+XYZ+XYZ

    ii)- (A+B) (A+B)

    1. Draw circuit diagram forX(Y+Z)

    using NAND gates only

    2. Represent the Boolean expression(X+Y)(Y+Z)(X+Z) with the help of NOR Gates only

    40

    4.2 Using Karnaugh Map

    5. Design of circuit using Logic gates

    5.1 Basic Logic Gates

    U

    V

    5.2 Universal Logic Gates

  • 8/4/2019 StMat Computer Sc

    41/45

    UNIT 5 : COMMUNICATION AND OPEN SOURCE

    CONCEPTS

    41

    1. Terminologies in Data Communication

    2. uses of various transmission Medias in Data

    Communication.

    3. Bus, star and tree topologies LAN, WAN, MAN

    6. Open source terminologies

    5. Network protocol, security concepts, web server.

    7. Abbreviations

    4. Settling Up A LAN

    Placement of various networking devices in a network, i.e,

    Switch, gateway, repeater

  • 8/4/2019 StMat Computer Sc

    42/45

    1. Define the term Bandwidth. Give unit of Bandwidth.

    2. Explain the terms nodes and server3. Diffrentiate between Circuit switching and Message switching.

    4. What do you understand by Data transfer rate?

    5. Explain the function of Modem and Switch.

    1. Give two advantages ans two disadvantages of Coaxial cables.

    2. How is Radiowave transmission different from Microwave transmission ?

    3. What is the difference between baseband and broadband transmission?

    4. Give the advantages of using optical fibre cables.

    1. Give two advantages of star topology as compared to Bus topology .

    2. Differentiate between Tree and Bus topologies of Network.

    3. What is the difference between LAN and MAN?

    42

    1. Terminologies in Data Communication

    2. Uses of various transmission Medias in Data

    Communication.

    3. Bus, star and tree topologies , LAN MAN WAN

  • 8/4/2019 StMat Computer Sc

    43/45

    1. ABC Carporation has set up its new center at Delhi for its office and web

    based activities. It has 4 blocks of buildings as shown in the diagrambelow:

    Center to center distances between various blocks

    Black A to Block B 50 mBlock B to Block C 150 mBlock C to Block D 25 mBlock A to Block D 170 mBlock B to Block D 125 mBlock A to Block C 90 m

    Number of Computers

    Black A 25Block B 50Block C 125

    Block D 10

    a) Suggest a cable layout of connections between the blocks.b) Suggest the most suitable place (i.e. block) to house the server of this

    organization with a suitable reason.c) Suggest the placement of the following devices with justification

    (i) Repeater(ii) Hub/Switch

    43

    Block A Block B

    Block C Block D

    4. Setting Up A LAN

    Placement of various networking devices in a network, i.e, Switch, gateway,

  • 8/4/2019 StMat Computer Sc

    44/45

    d) The organization is planning to link its front office situated in the city in a hillyregion where cable connection is not feasible, suggest an economic way toconnect it with reasonably high speed?

    2. A company in Reliance has 4 wings of buildings as shown in the diagram:

    ` Center to center distances between various Buildings:

    W3 to W1 50m

    W1 to W2 60mW2 to W4 25m

    W4 to W3 170m

    W3 to W2 125m

    W1 to w4 90m

    Number of computers in each of the wing:

    W1 150W2 15

    W3 15

    W4 25Computers in each wing are networked but wings are not networked. The

    company has now decided to connect the wings also.

    i) Suggest a most suitable cable layout & topology of the connection between the

    wings.

    ii) The company wants internet accessibility in all the wings. Suggest an

    economic technology .iii) Suggest the placement of the following devices with justification if the

    company wants minimized network traffic :

    1)Repeater2) Hub

    3) Switch

    3. What is the difference between Bridge and Router?\

    4. Discuss the role of Gateway in Networking.

    44

    W1

    W2

    W3 W

    4

  • 8/4/2019 StMat Computer Sc

    45/45

    1.Name different layer of the ISO OSI Model.

    2. What is the differences between POP3 and IMAP Mail Server?

    3.Name different layer of the ISO OSI Model.4. Give the advantages and disadvantages of e-mail.

    5. What do you understand by uploading and downloading of files?

    6. What is the difference between XML and HTML? Write two differences.7. Differentiate between Hackers and crackers.

    8. What kind of security are available to Internet users?

    9. What is URL?10. Discuss about firewall.

    1. What do you understand by the term Freeware and Shareware?2. Write a note on Apache server.

    3. Write the components of Mozilla software suite.

    4. Write down any two applications of PHP.5. Explain W3C.

    1. Give fullforms of the following:

    A) CDMA

    B) GSMC) FTP

    D) SLIP

    E) TCP/IPF) WLL

    G) EDGE

    H) FLOSS

    I) GNUJ) FSF

    K) POP

    L) SMTPM) NTP

    N) IMAP

    5. Network protocol, security concepts, web server.

    6. Open source terminologies

    7. Abbreviations