-->

HISSAN 2071 computer science questions and solutions

 

HISSAN CENTRAL EXAMINATION – 2071 (2015)

COMPUTER SCEINCE [230-M1]

Time: 3 hrs                                                                                       Full  Marks : 75

                                                                                                      Pass Marks: 27

 

 

Group “A”

                                  

Long Answer questions 4x10=40
Attempts any Four questions:

1.Differentiate between while and do-while loop. WAP to display all prime numbers from 2 to 100.5+5

Ans:-

Differences between while and do..while loop are given below.


while loop

do while loop

In the while loop, condition is checked in the beginning.

In the do while loop, condition is checked at the end.

It is also known as a pre-test or entry control loop.

It is also known as post-test or exit control loop.

It is not terminated with a semicolon.

It is terminated with a semicolon.

In the while loop, statements are not executed if the condition is false.

In the do while loop, statements are executed once even the condition is false.

It uses the keyword ‘while’.

It uses two keywords ‘do’ and ‘while’.

The syntax of while loop is as follows:

initialization;

while(condition)

{

  statements;

  increment/decrement;

}

The syntax of do-while loop is as follows:

initialization;

do

 {

  statements;

  increment/decrement;

 }while(condition);

The operation of while loop can be represented using flowchart as follows:



The operation of do while loop can be represented using flowchart as follows:



Example:
#include<stdio.h>

int main()

{

    int i=1;

    while(i>=10)

    {

        printf("I love my country");

        i++;

    }

    return 0;

}

Output: This program displays nothing as output; as condition is evaluated false in the beginning.

Example:

#include<stdio.h>

int main()

{

    int i=1;

    do

    {

        printf("I love my country");

        i++;

    }while(i>=10);

    return 0;

}

Output: This program displays “I love my country as output at once.


Second part:-

//prime numbers in given range 2 and 100
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,count;
for(i=2;i<=100;i++)
{
      if(i<=3)
{
  printf("%d\n",i);
}
      else
      {
     count=0;
       for(j=2;j<=i-1;j++)
  {
    if(i%j==0)
      {
       count=1;
      }
  }
      }
  if(count==0)
   {
    printf("%d\n",i);
   }
}
getch();
}

2.a) Write a recursive function to calculate the factorial of any integer number.5

Ans:-

//program to get factorial value of a number using recursion
#include <stdio.h>
#include <stdlib.h>
int recur(int n);
int main()
{
 int n;
 printf("ente a number\n");
 scanf("%d",&n);
printf("the factorial value is\n");
printf("%d",recur(n));
getch();
return 0;
}
int recur(int n)
{
 if(n<=0)
  {
          return 1;
}
else
{
    return n*recur(n-1);
}

}
b) Differentiate between structure and array.5

Ans:-

Differences between array and struct are given below.                                                                                                                                                

Arraystruct
1.It stores same type of data1. It stores dis-similar type of data.
2.It uses static memory allocation .2.I uses dynamic memory allocation.
3.It takes less time to access elements.3.It takes more time to access elements.
4.It uses index value to access elements.4.It takes help of period operator(.) to access elements.
5.It is derived data type.5. IT is user's defined data type.
6.We can not define array of array.          6.We can define array of structure.
7.Its syntax is                                          
data type identifier[value];








example,int a[20];
7.Its syntax is
struct tag
{datatype member1;
datatype member2;
data type member3;
}variable;
example,
struct det
{char name[100];
char add[40];
int  roll;
}variable;

3.WAP to enter name, age and sex of 10 persons into structure and display all the information in ascending order on the basis of name.10

Ans:-

/* 

to enter name, age and sex of 10 persons into structure and display all the information in ascending order on the basis of name

*/

#include <stdio.h>

#include<string.h>

struct shorting

{

  char name[100];

  float age;

  char sex[100];

}var[10],var1;

int main()

{

    int i,j;

    printf("enter name age and sex\n");

    for(i=0;i<10;i++)

    {

        scanf("%s",var[i].name);

        scanf("%f",var[i].age);

        scanf("%s",var[i].sex);

    }

for(i=0;i<10;i++)

{

    for(j=i+1;j<10;j++)

    {

        if((strcmp(var[i].name,var[j].name))>0)

        {

            var1=var[i];

            var[i]=var[j];

            var[j]=var1;

        }

    }

}

for(i=0;i<10;i++)

    {

        printf("name=%s age=%f and sex=%s\n",var[i].name,var[i].age,var[i].sex);    

    }

    return 0;

}

4.What is control statement? WAP which selects and print the largest number from 10 different numbers.2+8

Ans:-
Control statements:-
In  control structure/statements, selection is made on the basis of condition. We have options to go when the given condition is true or false. The flow of program statement execution is totally directed by the result obtained from the checking condition. Hence, program statements using selective control structures are also called conditional Statements.

We can hav efollowing types.

1)if

2.)if..else

3.)if..else if

etc

Let's understand about if..else structure.

This is another form of selective control structure which can handle both expected as well as unexpected situations. In this control structure, statements written in the body part of if are executed if the condition is true otherwise statements written in the body part of else are executed. This is appropriate where we have to check only one condition.


Syntax of if else statement:

if(condition)

statement1;

else

statement2;

In this case if the condition is true then statement1 is executed otherwise statement2 is executed. The else portion of the if-else statement is optional.


Flowchart of if else statement:


Example:-
//'C' program to know a number is even or odd
#include<stdio.h>
#include<conio.h>
void main()
{
int x;
printf("enter a number\n");
scanf("%d",&x);
if(x%2==0)
{
printf("it is an even number");
}
else
{
printf("it is an odd number\n");
}
getch();
}

Second part:-

/*to find the greatest value*/

#include<stdio.h>

int main()

{

    int numbers[10];

    int i,great,small;

    printf("enter numbers\n");

    for(i=0;i<=9;i++)

    {

        scanf("%d",&numbers[i]);

    }

    great=numbers[4];

for(i=0;i<=9;i++)

    {

        if(great<numbers[i])

        {

            great=numbers[i];

        }

       

    }

    printf("greatest number =%d",great);

    return 0;

}

5.WAP to write name, address and id of 10 students in a file called “student.txt” and display the information stored in a file.

Ans:-

/* writing and reading data*/

#include <stdio.h>

 int main()

{

    int id;

    char name[100];

    char address[100];

    int i;

    FILE *p;

    p=fopen("student.txt","w");

    printf("enter id,name and address\n");

    for(i=0;i<=9;i++)

    {

        scanf("%d",&id);

      scanf("%s",name);

      scanf("%s",address);

      fprintf(p,"%d %s %s\n",id,name,address);

    }

    fclose(p);

    p=fopen("student.txt","r");

    for(i=0;i<=9;i++)

    {

     

      fscanf(p,"%d %s %s",id,name,address);

      printf("id=%d,name=%s address=%s\n",id,name,address);

    }

    fclose(p);

 

    return 0;

}


10

Group “B”

                                          Short Answer questions                                                7x5=35



Attempts any Seven questions:

6.What is Feasibility study? Explain any three levels of feasibility study.1+4
ans:-
feasibility study:
 It is the measure and the study of how beneficial the development of the system would be to the organization. This is known as feasibility study. The aim of the feasibility study is to understand the problem and to determine whether it is worth proceeding.

Components of feasibility study:-


1.Technical feasibility: - This is concerned with availability of hardware and software required for the development of system.The issues with can be like:
1.1) Is the proposed technology proven and practical?
1.2)the next question is: does the firm possess the necessary technology it needs. Here we have to ensure that the required technology is practical and available. Now, does it have required hardware and software?
1.3)The Last issue is related to availability of technical expertise. In this case, software and hardware are available but it may be difficult to find skilled manpower.
2.Operational feasibility:- It is all about problems that may arise during operations. There are two aspects related with this issue:
2.1) what is the probability that the solution developed may not be put to use or may not work?
                                   2.1) what is the inclination of management and end users towards solutions?
Besides these all some more issues;
                                                           a) Information: saying to provide adequate, timely, accurate and useful information to all categories of users.
                                                       b) Response time, it says about response about output in very fast time to users.
                                            c) Accuracy: A software system must operate accurately. It means, it should provide value to its users. It says degree of software performance.
           d) Services:- The system should be able to provide reliable services.
             e)Security:- there should be adequate security to information and data from frauds.
f) Efficiency: The system needs to be able to provide desirable services to users.
3) Economic feasibility: - It is the measure of cost effectiveness of the project. The economic feasibility is nothing but judging whether the possible benefit of solving the problem is worthwhile or not. Under "cost benefit analysis", there are mainly two types of costs namely, cost of human resources and cost of training.
                                                             The first one says about salaries of system analysts, software engineers, programmers, data entry operators etc. whereas 2nd one says about training to be given to new staffs about how to operate a newly arrived system.

4) Legal feasibility: - It is the study about issues arising out the need to the development of the system. The possible consideration might include copyright law, labor law, antitrust legislation, foreign trade etc.
Apart from these all we have some more types:
behaviour feasibility, schedule feasibility study etc.

7.What is hierarchical database model? List out the advantages and disadvantages of hierarchical database model.1+4
ans:-
Hierarchical database model:-

Hierarchical database is a model in which data is organized into a tree-like structure. In this,

  • Data is organized like a family tree or organization chart

  • The parent record can have multiple child records – child records can only have one parent

  • Pointers link each parent record with each child record

  • Complex and difficult to maintain

This structure allows one 1:N relationship between two types of data. This structure is very efficient to describe many relationships in the real world; recipes, table of contents, ordering of paragraphs/verses,

        Example:



We can see here a parent node with many branches called children.Each child has their own record with furhher informations.In given diagram, the first record has name “Ram” with street “Baneshwor” and city named kathmandu. It is further linked to its balance id and amount. In same fashion all others records have, they all are related or linked to  their id and amount. We can see records’ arrangement in tree like format.

Advantages:-   1) easiest model of database.

                       2) Searching is fast if parent is known.

                       3) supports one to many relationship.

Disadvantages:       1) old and outdated one.

                             2) Can not handle many to many relationships.

                                 3) More redundancy.


8.What is the purpose of the E-R diagram? List out the any three symbols used in E-R diagram with their meaning and example?2+3
ans:-

E-R diagram:-

he Entity-Relationship (E-R) data model is based on a perception of a real world that consists of a collection of basic objects, called entities, and of relationships among these objects. An entity is a “thing” or “object” in the real world that is distinguishable from other objects. For example, each person is an entity, and bank accounts can be considered as entities.

Entities are described in a database by a set of attributes. For example, the attributes account-number and balance may describe one particular account in a bank, and they form attributes of the account entity set. Similarly, attributes customer-name, customer-street address and customer-city may describe a customer entity.

A relationship is an association among several entities. For example, a depositor relationship associates a customer with each account that she has. The set of all entities of the same type and the set of all relationships of the same type are termed an entity set and relationship set, respectively.

The overall logical structure (schema) of a database can be expressed graphically by an E-R diagram, which is built up from the following components:

The overall logical structure (schema) of a database can be expressed graphically by an E-R diagram, which is built up from the following components:

  • Rectangles, which represent entity sets

  • Ellipses, which represent attributes.

  • Diamonds, which represent relationships among entity sets.

  • Lines, which link attributes to entity sets and entity sets to relationships.

for example,

1)



Advantages:-

  • Exceptional conceptual simplicity.
  • Visual representation.
  • Effective communication tool.
  • Integrated with the relational database model.

9.What is the networking? Differentiate between LAN and WAN.2+3
Ans:-

computer network, often simply referred to as a network, is a collection of computers and devices connected by communications channels that facilitates communications among users and allows users to share resources with other users. Networks may be classified according to a wide variety of characteristics. 

Purpose of networking:-

  • Networking for communication medium (have communication among people;internal or external)

  • Resource sharing (files, printers, hard drives, cd-rom/) 

  • Higher reliability ( to support a computer by another if that computer is down)

  • Higher flexibility( different system can be connected without any problems)

Differences between LAN and WAN are given below:-

Ans:-We can understand about LAN and WAN with the help of  following points.

LAN: - 

  • It is a privately-owned network done in single building or room or office to share resources or data, documents (for 100 m). 

  • It occupies small area and small number of computers.

  • Speed with which data is passed is extremely fast(1000mbps).

  • Fast connecting and sharing.

  • Uses medium like Co-axial or utp cable (mostly).

  • can use topology like bus/star/tree etc.

  • fewer error occurrences during transmission.

  • Less congestion

  • can be handled by single person/administrator. 

  • It is cost effect

WAN:-
  • is a telecommunications network, usually used for connecting computers, that spans a wide geographical area. WANs can by used to connect cities, states, or even countries. 

  • It occupies broad area(>=50km).

  • Extremely slow transfer rate(150mbps)

  • Slow connecting and file sharing.

  • Mostly uses medium like ,telephone line,leased line or satellite or optical fiber

  • Uses MESH topology.

  • more transmission error

  • high congestion.

  • due to having of complex system, it is handled by a group.

  • Expensive to set-up.

10.What is internet? Explain the uses of internet in business.2+3
Ans:-

Internet is a web of networks i.e. interconnection of large number of computers throughout the world. The computers are connected (wired or wireless via satellite) in such a way that anybody from anywhere can access anything/ information. It is the largest network in the world just like a communication service provided by different companies. It is not limited in a room or a building or just an office. But by just sitting on a chair in one corner we can access the information, we can go for meeting or conference or shopping etc. while accessing the information from remote computers, it seems that a user is retrieving information from inside the cpu/hard disk. It does not take more time to fetch the information. While getting the data/packets, all the computers use a common rule called protocol (TCP/IP). Without this, even a single computer can not communicate. The Internet can be considered as a super highway with multi lanes and with high traffic of data without letting it jam.

Uses in business:-
We can use Internet in business.It helps us to be online and be live 24x7 all over the world.Using this we can analyse thetraffic of visitors,buyers,sellers etc. we can promote our products. not only that much,We can transfer funds,get statements in just a click.

11.What is ICT? Explain the positive impacts of ICT in society?2+3
ICT:-
Internet is a web of networks i.e. interconnection of large number of computers throughout the world. The computers are connected (wired or wireless via satellite) in such a way that anybody from anywhere can access anything/ information. It is the largest network in the world just like a communication service provided by different companies.

Uses:-
It has many advantages and can not be mentioned by just writing here. But to know how it works and where it is used, let’s see some.

File sharing/transferring:-

A file can be put on a "Shared Location" or onto a File Server for instant use by colleagues does not matter what is a size of file and how many will use it. Mirror servers and peer-to-peer networks can be used to ease the load of data transfer.

Internet banking:-

We know that almost all banks now-a-days are using this technology for its customers as an extra facility. Internet Banking/ Online Banking allows bank customers to do financial transactions on a website operated by the banks. The customers can do almost any kind of transaction on the secured websites. They can check their account balance, transfer funds, pay bills, etc. but security is a major issue for this.

Relay of information/communication:-

The biggest advantage of that internet is offering of information. The internet and the World Wide Web has made it easy for anyone to access information, and it can be of any type, as the internet is a sea of information. The internet and the World Wide Web have made it easy for anyone to access information, and it can be of any type. Any kind of information on any topic is available on the Internet. As well as, it can be greatly used for communication purpose for any distance.

Dating/Personals:

People are connecting with others through internet and finding their life partners. Internet not only helps to find the right person but also to continue the relationship.

12.What is object oriented programming? How it is different from the procedural oriented programming.2+3
Ans:-
As the name suggests, Object-Oriented Programming or OOPs refers to languages that uses objects in programming. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.
Some its important chaarcteristics are:


  • Abstraction: 
  • Objects: 
  • Class: 
  • Encapsulation: 
  • Information hiding: 
  • Inheritance: I
  • Interface: 
  • Polymorphism: 
  • These all properties we can not get in POP. POP offers or has following properties.
    1.emphasisi on functions
    2.Data can move freely.
    3.Uses top-down approach
    4.Data is not secured
    5.No inheritance property
    etc

    13.Write short notes on (any two):2.5+2.5

    a) Data security b) Coaxial cable c) E-learning
    Ans:-
    a) Data security:- It simply says protection of data /information contained in database against unauthorized access, modification or destruction. The main condition for database security is to have “database integrity’ which says about mechanism to keep data in consistent form. Besides these all, we can apply different level of securities like:
      1. Physical: - It says about sites where data is stored must be physically secured.
      2. Human: - It is an authorization is given to user to reduce chance of any information leakage or manipulation.
      3. Operating system: We must take a foolproof operating system regarding security such that no weakness in o.s.
      4. Network: - since database is shared in network so the software level security for database must be maintained.
      5. Database system: - the data in database needs final level of access control i.e. a user only should be allowed to read and issue queries but not should be allowed to modify data

    b) Coaxial cable:-
    Coaxial cable, or coax,
    • It is an electrical cable with an inner conductor surrounded by a flexible, tubular insulating layer, surrounded by a tubular conducting shield.
    • The term coaxial comes from the inner conductor and the outer shield sharing the same geometric axis.
    • Coaxial cable is used as a transmission line for radio frequency signals, in applications such as connecting radio transmitters and receivers with their antennas, computer network (Internet) connections, and distributing cable television signals and uses many connectors.
    • It is available in two types thin (10base2; means 100 MBPS and upto 200 meter) and thick (10base5 coax;means 10 MBPS, and upto 5oo meter). They are different in diameter and bandwidth. Most of television operators use this. They are obsolete and no longer in use for computer networking
      figure :coaxial cable


    c) E-learning:-
    A learning system based on formalised teaching but with the help of electronic resources is known as E-learning. While teaching can be based in or out of the classrooms, the use of computers and the Internet forms the major component of E-learning. E-learning can also be termed as a network enabled transfer of skills and knowledge, and the delivery of education is made to a large number of recipients at the same or different times. Earlier, it was not accepted wholeheartedly as it was assumed that this system lacked the human element required in learning.

    14.What is multimedia? Explain the components of multimedia.1+4
    Ans:-

    Multimedia:-
    Multimedia is content that uses a combination of different content forms such as text, audio, images, animations, video and interactive content. Multimedia contrasts with media that use only rudimentary computer displays such as text-only or traditional forms of printed or hand-produced material.
    Components:-

    1)Text: Text is the most common medium of representing the information. In multimedia, text is mostly use for titles, headlines,menu etc. The most commonly used software for viewing text files are Microsoft Word, Notepad, Word pad etc. Mostly the text files are formatted with ,DOC, TXT etc extension.

    2)Audio: In multimedia audio means related with recording, playing etc. Audio is an important components of multimedia because this component increase the understandability and improves the clarity of the concept. audio includes speech, music etc. The commonly used software for playing audio files are:
    i) Quick Time
    ii) Real player
    iii) Windows Media Player

    3)Graphics: Every multimedia presentation is based on graphics. The used of graphics in multimedia makes the concept more effective and presentable.the commonly used software for viewing graphics are windows Picture, Internet Explorer etc. The commonly used graphics editing software is Adobe Photoshop through which graphics can be edited easily and can be make effective and attractive.

    4)Video: Video means moving pictures with sound. It is the best way to communicate with each other. In multimedia it is used to makes the information more presentable and it saves a large amount of time. The commonly used software for viewing videos are:
    i) Quick Time
    ii) Window Media Player
    iii) Real Player

    5)Animation: In computer animation is used to make changes to the images so that the sequence of the images appears to be moving pictures. An animated sequence shows a number of frames per second to produce an effect of motion in the user's eye.


    THE END

     

     

     

    SET -10

    HISSAN CENTRAL EXAMINATION – 2071 (2015)

    COMPUTER SCEINCE [230-D2]

    Time: 3 hrs                                                                                         Full  Marks : 75

                                                                                                              Pass Marks: 27

     

    Group “A”

                                            Long Answer questions                                                 4x10=40



    Attempts any Four questions:

    1.What do you mean by operator? What are the operators used in C language? Explain with examples.2+8
    ans:-
    operator:- It is a symbol or a character used in programming. It is used to carry out some operation.
    for example: +,-,= etc
    Types of operator:-
    It is of following types.
    1)Arithmetic operator: It is used to do arithmetic calculations/operation.
     It has following types.

     +         -----------> used for addition.example is a+b. It means we are performing addition with the help of operand a and b
    -           ------------>It is used for subtraction.Example is a-b.  It means we are performing subtraction with the help of operand a and b
    * -------------------->used for multiplication.example is a*b. It means we are performing multiplication with the help of operand a and b
    /---------------->used for division.example is a/b. It means we are performing division with the help of operand a and b
    %---------------->used for remainder division.example is a%b. It means we are performing division with the help of operand a and b.It gives us remainder after division.

    2)relational operator: 
    This operator is used to perform comparisons between variables.It supports us to take decision logically. example,x>y ,x>=y etc
    Relational operator has following types.


    >------> It is used to show greater than. like x>y
    >=----->It is used to show greater than or equals to.like x>=y
    <-------->It is used to show a variable is smaller than another.like x<y
    <=-------> It is used to show smaller than or equals to with another variable.Like x<=y
    !=----------> I simply says , two variables are not equal in value.like x!=y
    ==---------->It says two variables have same value.It is used to test values of two variables.

    3)Logical operator:-
                                       This operator is quite helpful when we want to combine multiple  conditions and take decision.It returns values in the form of 0 o 1.It works logically.
    Its types are:

            3.a)and (&&)-----------> It is called 'and'operator.It is used to combine multiple conditions.It gives us true output if all of them are true otherwise we get false output.
     example:if(a>b && a>c)
                          {
                                display a     
                            }
     we can see here that to be greatest,value of 'a' must be greater than b and c. So we use here '&&'
       
          3.b)or(||):- It is called 'or'operator.It is used to combine multiple conditions.It gives us true output if anyone of them is true or all are true otherwise we get false output.
     example:if(a==90 || b==90 || c==90)
                          {
                                display right angle triangle  
                            }
     we can see here that to be right angled triangle,either 'a'or 'b'or 'c' a must be 90 . So we use here '||'.

        3.c) !(not )operator:-
                                    It is used to reverse the result.
    example
    int a=5;
    if(!(a==5))
    {
    printf("it is\n");
    }
    else
    {
    printf("it is not\n");
    }
    here ,the value is 5 but we get output "it is not".It is called reversing the output.

    4) Assignment operator:
                                    an operator ,symbolized by '=' character,is called assignment operator.It assigns value to variable.
    example:
    int a=6;
    It means, we are assignming value 6 to variable a.

    5)Unary operator:- this operator  works on one operand only.It has two types.
                                   I) increment operator:- It increases the value of given variable by one.For example: ++y or y++
                                                 It can be classified into pre-increment and post increment.
                                                     pre-increment:- It is written as ++x.It means first increase the value and then use that.
                                                     post-increment: It is written as x++.It means, first use that and then increase its value by one.

                                   II)decrement operator:- It decreases the value of given variable by one.For example: --y or y--
                                                 It can be classified into pre-decrement and post decrement.
                                                     pre-decrement:- It is written as --x.It means first decrease the value and then use that.
                                                     post-decrement: It is written as x--.It means, first use that and then decrease its value by one.


    Besides these all, we have some other operators .like  bitwise,

    2.What is array? List its advantages. WAP to find the sum of elements of 3x3 matrix.2+8
    ans:-
    Definition: 
    A composite variable capable of holding multiple data of same data type under a single variable name is called array.
    advantages:
    ->helps us to store multiple values
    ->helps to solve complex porblem
    ->can be used as array as pointer
    ->pixel based graphics programming made easier etc

    Declaration of Array/syntax:

    datatype array_name [size];

    Example: - int marks [10]; int x[4]={1,2,3,4};

    Array size is fixed at the time of array declaration.

    Generally, we use for loop () to assign data or item in memory and also use this loop to extract data from memory location.

    Types of Array:

    There are 2 types of array.

    a) One Dimensional Array (1-D): IT is an array where we use one subscript value.It stores value in row in contigous cells.
    syntax:
    data type arra[value/size];
    For example:
    int a[10];
    This array stores ten value starting from location zero na dends at 9.

    b) Two Dimensional Array (2-D):an array where we may use two or more than two subscript values.
    In this we use matrix concept.

    syntax:
    data type arra[row size][column size];
    For example:
    int a[2][2];
    It uses two rows and two columns.
    Values are stored as:

     

    Column zero

    Column one

    Row 0 à

    1(0,0)

    2(0,1)

    Row 1à

    3(1,0)

    4(1,1)

    This array stores total four  values starting from location zero and ends at 1.


    Second part:-

    /* to find sum of two 3x3 matrices*/

    #include <stdio.h> 

    int main()

    {

        int matrix1[3][3],matrix2[3][3];

        int i,j;

        printf("enter elements of matrix 1\n");

        for(i=0;i<=2;i++)

        {

            for(j=0;j<=2;j++)

            {

                scanf("%d",&matrix1[i][j]);

            }

        }

        printf("enter elements of matrix 2\n");

        for(i=0;i<=2;i++)

        {

            for(j=0;j<=2;j++)

            {

                scanf("%d",&matrix2[i][j]);

            }

        }

        printf("sum of two matrices is \n");

        for(i=0;i<=2;i++)

        {

            for(j=0;j<=2;j++)

            {

                printf(" %d ",matrix1[i][j]+matrix2[i][j]);

            }

            printf("\n");

        }

          return 0;

    }



    3.What is file handling function? Write a program to write and read ID and name of employee and display the same from the data file in appropriate format using fsacnf() and fprintf() function.2+8
    Ans:-
    File handling function:-
                                        It is the library function which are used to handle data or record stored in a datafile. Its main functions are:
    ->to store data
    ->to read data from a datafile
    ->to append more data
    ->to update or delete data
    ->It helps us to create buffer area inside RAM to use that
    ->To delete data file and rename them
    Second part:-

    /* a program to write and read ID and name of employee and display the same from the data file in appropriate format using fsacnf() and fprintf() function.*/

    #include <stdio.h>

     int main()

    {

        int id;

        char name[100];

      

        int i;

        FILE *p;

        p=fopen("emp.dat","w");

        printf("enter id and name \n");

        for(i=0;i<=9;i++)

        {

            scanf("%d",&id);

          scanf("%s",name);

        

          fprintf(p,"%d %s \n",id,name);

        }

        fclose(p);

        p=  p=fopen("emp.dat","r");

        for(i=0;i<=9;i++)

        {

         

          fscanf(p,"%d %s ",id,name);

          printf("id=%d,name=%s \n",id,name);

        }

        fclose(p);

        return 0;

    }



    4.What is Union and Structure? Write a C program to input name and age of 10 patient and arrange them in ascending order to the name.2+8
    Ans:-
    The differences between struct and union are given below in tabular form.
                       
    struct
    Union
    1.It stores dis-similar data.Each gets separate space in memory.They do not share memory
    1. It stores dis-similar type of data.Total memory space is equal to the member with largest size.They share memory space.
    2.we can access member in any sequence .
    2.We can access that whose value is recently used.
    3.It uses keyword 'struct'
    3.It uses keyword 'union'
    4.We can initialize values of member/s and in any order
    4.We can initialize that member which is first declared.
    5.It consumes more memory
    5.It consumes less memory.
    6.Its syntax
        struct tag
    {
    datatype member1;
    datatype member2;
    datatype member3;
    }variable;

    6.Its syntax
        union tag
    {
    datatype member1;
    datatype member2;
    datatype member3;
    }variable;

    Example
    struct student
    {
    int roll;
    char sex;
    float percentage;
    }var;

    Example
    union student
    {
    int roll;
    char sex;
    float percentage;
    }var;


    5.Explain local, global and static local variables with suitable example. Write a program to find sum of first N natural numbers. The value of N should enter by user.
    Ans:-

     Local variables:-

                                Those variables which are declared inside the function are called local variables.They can not be accessed from other function or outsiders. It means scope is limited to that function where  it is declared. For local variables, either we use keyword 'auto' or simply variables with data types.

            Example:-

            void sum()

                {

                    int a,b;

                    int sum;       

                }

                Here, a,b and sum are local variables.

       



    Global variables:-

                                Those variables which are declared outside the function are called global variables.They can  be accessed from other function or outsiders. It means scope is not limited to that function. For global variables, either we use keyword 'extern' or simply variables with data types.

            Example:-

            int a=7,b=9;    

            int sum;       

            void sum()

                {

                 sum=a+b;   

                }

                Here, a,b and sum are global variables. Once we declare them , it does not need to be declared inside the function. It works.




    static variables:-

                               Compiler can know the value of variables till it is called.After calling compiler loses its content i.e. function forgets the value. i.e. our function can not retain its value after calling. To overcome this problem, we have to use keyword 'static' with variables. It retains the variables values even after calling. 

            Example:-

           #include <stdio.h>

            void sum();

             int main()

            {

                 sum();

                sum();

                return 0;

        }   

    void sum()

        {

        int a=7,b=9;    

        printf("sum is=%d\n",a+b);

        b++;

        }

              If we run this program, we will get 16 two times. It means there will be no change in output of statement 'b++'. For this we have to use static in front of int a=7,b=9 i.e. 

    static int a=7,b=9. If we use it then computer remembers old values and we will get different values.

    Now we will get first 

    16 then

    17 

    Second part-
    /* a program to find sum of first N natural numbers.*/
    //A program  to find sum of 1 to n natural numbers.
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int k=1,n,sum=0;
    printf("enter value of 'n'\n");
    scanf("%d",&n);
    while(k<=n)
       {
         sum=sum+k;
          k++;
       }
        printf("sum of N natural numbers =%d",sum);
    getch();
    }

    5+5

    Group “B”

                                              Short Answer questions                                                 7x5=35



    Attempts any Seven questions:

    6.What is feasibility study? Explain the importance of technical and economical feasibility.1+4
    Ans:-
    Feasibility study:
     It is the measure and the study of how beneficial the development of the system would be to the organization. This is known as feasibility study. The aim of the feasibility study is to understand the problem and to determine whether it is worth proceeding.

    Components of feasibility study:-


    1.Technical feasibility: - This is concerned with availability of hardware and software required for the development of system.The issues with can be like:
    1.1) Is the proposed technology proven and practical?
    1.2)the next question is: does the firm possess the necessary technology it needs. Here we have to ensure that the required technology is practical and available. Now, does it have required hardware and software?
    1.3)The Last issue is related to availability of technical expertise. In this case, software and hardware are available but it may be difficult to find skilled manpower.
    2.Operational feasibility:- It is all about problems that may arise during operations. There are two aspects related with this issue:
    2.1) what is the probability that the solution developed may not be put to use or may not work?
                                       2.1) what is the inclination of management and end users towards solutions?
    Besides these all some more issues;
                                                               a) Information: saying to provide adequate, timely, accurate and useful information to all categories of users.
                                                           b) Response time, it says about response about output in very fast time to users.
                                                c) Accuracy: A software system must operate accurately. It means, it should provide value to its users. It says degree of software performance.
               d) Services:- The system should be able to provide reliable services.
                 e)Security:- there should be adequate security to information and data from frauds.
    f) Efficiency: The system needs to be able to provide desirable services to users.
    3) Economic feasibility: - It is the measure of cost effectiveness of the project. The economic feasibility is nothing but judging whether the possible benefit of solving the problem is worthwhile or not. Under "cost benefit analysis", there are mainly two types of costs namely, cost of human resources and cost of training.
                                                                 The first one says about salaries of system analysts, software engineers, programmers, data entry operators etc. whereas 2nd one says about training to be given to new staffs about how to operate a newly arrived system.

    4) Legal feasibility: - It is the study about issues arising out the need to the development of the system. The possible consideration might include copyright law, labor law, antitrust legislation, foreign trade etc.
    Apart from these all we have some more types:
    behaviour feasibility, schedule feasibility study etc.

    7.What is DBA? Explain the major role and responsibilities of DBA.1+4
    Ans:-
    DBA:-

    A database administrator (DBA) is a person/s who is/are responsible for the environmental aspects/activities related to database. The role of a database administrator has changed according to the technology of database management systems (DBMSs) as well as the needs of the owners of the databases.
                    Duties/roles:
    1. Installation of new software.
    2. Configuration of hardware and software with the system administrator
    3. Security administration
    4. Data analysis
    5. Database design (preliminary
    6. Data modeling and optimization
    7. Responsible for the administration of existing enterprise databases and the analysis, design, and creation of new databases

    8.What do you mean by OSI model of networking? Explain the different layers of OSI model.1+4
    Ans:-

    OSI model:-

    The OSI, or Open System Interconnection, model defines a networking framework for implementing protocols in seven layers. Control is passed from one layer to the next, starting at the application layer in one station, and proceeding to the bottom layer, over the channel to the next station and back up the hierarchy.

    ---------------------->Application (Layer 7)

    • This layer supports application and end-user processes. 

    • Communication partners are identified, quality of service is identified, user authentication and privacy are considered, and any constraints on data syntax are identified. 

    ----------------------->Presentation layer (layer 6):-

    • This layer provides independence from differences in data representation (encryption) by translating from application to network format, and vice versa. 

    • The presentation layer works to transform data into the form that the application layer can accept.

    ------------------------>Session (Layer 5)

    • This layer establishes, manages and terminates connections between applications.

    ----------------------->Transport (Layer 4)

    • This layer provides transparent transfer of data between end systems, or hosts, and is responsible for end-to-end error recovery and flow control.

    •  It ensures complete data transfer.



    ------------------------->Network (Layer 3)

    • This layer provides switching and routing technologies, creating logical paths, known as virtual circuits, for transmitting data from node to node

    ------------------------>Data Link (Layer 2)

    • At this layer, data packets are encoded and decoded into bits.

    •  It furnishes transmission protocol knowledge and management and handles errors in the physical layer, flow control and frame synchronization

    ------------------------->Physical (Layer 1)

    • This layer conveys the bit stream - electrical impulse, light or radio signal -- through the network at the electrical and mechanical level. 

    • It provides the hardware means of sending and receiving data on a carrier, including defining cables, cards and physical aspects


    9.What is network database model? Compare network database model with hierarchical database model.1+4
    Ans:-We can compare both the models with the help of following points.
    Network database model:-

    he network model organizes data using two fundamental constructs, called records and sets.        The Network Model

    1. Data are represented by collections of records.

    2. Relationships among data are represented by links.

    3. Organization is that of an arbitrary graph.

    4. Figure  shows a sample network database that is the equivalent of the relational database of Figure ??

     eg.



    We have taken same example as mentioned above.but the records are arranged in graph like structure. In this we do not use concept of child /parent.In given diagram the records are linked to each other with a solid line as it is in hierarchical. Two records namely Ramesh and Hary are linked to two balance id and amounts.

    Advantages:- 1) more flexible due to many to many relationship.

                         2) Reduction of redundancy.

                         3) Searching is very fast.

    Disadvantages:-   1) very complex.

                                     2) Needs long and complex programs.

                                     3) Less security

    Hierarchical model:-

    Hierarchical database is a model in which data is organized into a tree-like structure. In this,

    • Data is organized like a family tree or organization chart

    • The parent record can have multiple child records – child records can only have one parent

    • Pointers link each parent record with each child record

    • Complex and difficult to maintain

    This structure allows one 1:N relationship between two types of data. This structure is very efficient to describe many relationships in the real world; recipes, table of contents, ordering of paragraphs/verses,

            Example:



    We can see here a parent node with many branches called children.Each child has their own record with furhher informations.In given diagram, the first record has name “Ram” with street “Baneshwor” and city named kathmandu. It is further linked to its balance id and amount. In same fashion all others records have, they all are related or linked to  their id and amount. We can see records’ arrangement in tree like format.

    Advantages:-   1) easiest model of database.

                           2) Searching is fast if parent is known.

                           3) supports one to many relationship.

    Disadvantages:       1) old and outdated one.

                                 2) Can not handle many to many relationships.

                                     3) More redundancy.


    10.Write short notes on any two:2.5+2.5

    a) Digital divide b) Cyber Law c) Virtual Reality
    Ans:-
    a) Digital divide:-
    Interaction between human and computers has greatly increased as we embark on the twenty-first century. The ability to access computers and the internet has become increasingly important to completely immerse oneself in the economic, political, and social aspects of not just America, but of the world. However, not everyone has access to this technology. The idea of the "digital divide" refers to the growing gap between the underprivileged members of society, especially the poor, rural, elderly, and handicapped portion of the population who do not have access to computers or the internet; and the wealthy, middle-class, and young Americans living in urban and suburban areas who have access.


     b) Cyber Law:-
    This law is commonly known as the law of the internet. It governs the legal issues of computers, Internet, data, software, computer networks and so on. These terms of legal issues are collectively known as cyberspace. In other words, it is a type of law which rules on the Internet to prevent Internet related crime.

    Cyber law is a new and quickly developing area of the law that pertains to persons and companies participating in e-commerce development, online business formation, electronic copyright, web image trademarks, software and data licenses, online financial transactions, interactive media, domain name disputes, computer software and hardware, web privacy, software development and cybercrime which includes, credit card fraud, hacking, software piracy, electronic stalking and other computer related offenses.

    c) Virtual Reality:-
    Virtual reality is a new computational paradigm that redefines the interface between human and computer becomes a significant and universal technology and subsequently penetrates applications for education and learning.
     
    Application fields of Virtual reality
    Virtual Reality in the Military: 
    A virtual reality simulation enables them to do so but without the risk of death or a serious injury. They can re-enact a particular scenario, for example engagement with an enemy in an environment in which they experience this but without the real world risks.
    Virtual Reality in Education: 
    Education is another area which has adopted virtual reality for teaching and learning situations. The advantage of this is that it enables large groups of students to interact with each other as well as within a three dimensional environment.
    Virtual Reality in Healthcare: 
    Healthcare is one of the biggest adopters of virtual reality which encompasses surgery simulation, phobia treatment, robotic surgery and skills training.
    Virtual Reality in Business: 
    Many businesses have embraced virtual reality as a cost effective way of developing a product or service. For example it enables them to test a prototype without having to develop several versions of this which can be time consuming and expensive.

    11.Differentiate between For and While loop with suitable examples of each.5
    ans:-
    We can understand about for and while loop with the help of following paragraphs.
    for loop:-
    It is the most common type of loop which is used to execute a program statement or block of program statements repeatedly for a specified number of times. It is a definite loop. Mainly it consists of three expressions: initialization, condition and increment / decrement. The initialization defines the loop starting point, condition defines the loop stopping points and counter helps to increment and decrement the value of counter variable.


    Syntax of for Loop:

    for(initialization;condition;increment/decrement )

    {
    statements;
    }
    Flowchart:-

    Example:-
    #include<stdio.h>
    int main()
    {
    int i;
    for(i=1;i<=5;i++)
    {
        printf("%d,",i);
    }
    return 0;
    }
    Output:-
    It prints 1,2,3,4 and 5

    While loop:-
    While loop:-

    Definition:-
    It executes the program statements repeatedly until the given condition is true. It checks the condition at first; if it is found true then it executes the statements written in its body part otherwise it just gets out of the loop structure. It is also known as entry control or pre-test loop.Syntax of while Loop:

    initialization;

    while(condition)

    {

    statements;

    increment/decrement;

    }

    Where initialization means starting point, control means stopping points and increment/decrement means counter.
    Flowchart:-




    Examaple:
    #include<stdio.h>
    int main()
    {
    int i=1;
    while(i<=20)
    {
    printf("%d,",i);
    i=i+1;
    }
    return 0;
    }

    Output:
    If we execute this we will get 1,2,3....20
    12.What is OOP? Define Polymorphism and Encapsulation.1+4
    Ans:-
    OOP:-
    The major motivating factor in the invention of object oriented is to remove some of the flaws encountered in the procedural oriented approach. Object oriented programming uses concept of “Object” and treats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the functions that operate on it, and protects it from accidental modifications from outside functions.
    Some features are:-
    1) Emphasis is on data rather than procedures or algorithms.
    2) Programs are divided into what are known as objects.
    3) Data structures are designed such that characterize the objects.
    Polymorphism :-
    Its an important OOPs concept , Polymorphism means taking more than one forms .Polymorphism gives us the ultimate flexibility in extensibility. The ability to define more than one function with the same name is called Polymorphism.Polymorphism allows the programmer to treat derived class members just like their parent class’s members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to calls of methods of the same name .If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). Each subclass overrides the speak() method inherited from the parent class Animal.
    example is:
    Simple example of Polymorphism, look at an Account (it may be checking or saving assuming each attract different dividends) you walk in a bank and ask a teller what is my balance? or dividends? you don't need to specify what kind of an account you're having he will internally figure out looking at his books and provide you the details.


    Encapsulation:-
    The wrapping up of data and functions into a single unit is called as encapsulation . Encapsulation means putting together all the variables (Objects) and the methods into a single unit called Class.The class acts like a container encapsulating the properties. It can be described as a protective barrier that prevents the code and data being randomly accessed by other code defined outside the class. Access to the data and code is tightly controlled by an interface.For example the class car has a method turn ()  .The code for the turn() defines how the turn will occur . So we don’t need  to define how Mercedes will turn and how the Ferrari will turn separately . turn() can be encapsulated with both.

    13.What are the components of multimedia? Explain them.5
    Ans:-
    Multimedia:-
    Multimedia is content that uses a combination of different content forms such as text, audio, images, animations, video and interactive content. Multimedia contrasts with media that use only rudimentary computer displays such as text-only or traditional forms of printed or hand-produced material.
    Components:-

    1)Text: Text is the most common medium of representing the information. In multimedia, text is mostly use for titles, headlines,menu etc. The most commonly used software for viewing text files are Microsoft Word, Notepad, Word pad etc. Mostly the text files are formatted with ,DOC, TXT etc extension.

    2)Audio: In multimedia audio means related with recording, playing etc. Audio is an important components of multimedia because this component increase the understandability and improves the clarity of the concept. audio includes speech, music etc. The commonly used software for playing audio files are:
    i) Quick Time
    ii) Real player
    iii) Windows Media Player

    3)Graphics: Every multimedia presentation is based on graphics. The used of graphics in multimedia makes the concept more effective and presentable.the commonly used software for viewing graphics are windows Picture, Internet Explorer etc. The commonly used graphics editing software is Adobe Photoshop through which graphics can be edited easily and can be make effective and attractive.

    4)Video: Video means moving pictures with sound. It is the best way to communicate with each other. In multimedia it is used to makes the information more presentable and it saves a large amount of time. The commonly used software for viewing videos are:
    i) Quick Time
    ii) Window Media Player
    iii) Real Player

    5)Animation: In computer animation is used to make changes to the images so that the sequence of the images appears to be moving pictures. An animated sequence shows a number of frames per second to produce an effect of motion in the user's eye.

    14.What is E-commerce? Explain the advantages of E-learning over traditional learning method.1+4
    Ans:-
    E-commerce:-


    E-commerce (electronic commerce) is the buying and selling of goods and services, or the transmitting of funds or data, over an electronic network, primarily the internet. These business transactions occur either as business-to-business (B2B), business-to-consumer (B2C), consumer-to-consumer or consumer-to-business.

    The terms e-commerce and e-business are often used interchangeably. The term e-tail is also sometimes used in reference to the transactional processes that make up online retail shopping.

    Second part:-
    A learning system based on formalised teaching but with the help of electronic resources is known as E-learning. While teaching can be based in or out of the classrooms, the use of computers and the Internet forms the major component of E-learning. E-learning can also be termed as a network enabled transfer of skills and knowledge, and the delivery of education is made to a large number of recipients at the same or different times. Earlier, it was not accepted wholeheartedly as it was assumed that this system lacked the human element required in learning.
    Advantages:-
    1.Physical presence is not needed
    2.Geographically we can be anywhere
    3.saves time and money
    4.Can be shared with friends
    5.It is effective




    THE END

     

     

     

    SET -11

    HISSAN CENTRAL EXAMINATION – 2071 (2015)

    COMPUTER SCEINCE [230-M3]

    Time: 3 hrs                                                                                         Full  Marks : 75

                                                                                                             Pass Marks: 27

     

     

    Group “A”

                                            Long Answer questions                                                  4x10=40



    Attempts any Four questions:

    1.What is selection statement? Explain the syntax and semantics of if else statement. Write a program to enter three different integer numbers and find smallest among three different numbers.1+3+6
    Ans:-
    Selection statement:
    This logical part says about “selection of certain block of statements/parts/” but under certain condition. In our daily life also we use this concept, don’t we? Let’s take an example; if i have rs. 1000 then i would do this/that, if not, then nothing i will. So, you do not think that it’s simple to understand about selection.

    second part:-

    IF ELSE STATEMENT

    This is another form of selective control structure which can handle both expected as well as unexpected situations. In this control structure, statements written in the body part of if are executed if the condition is true otherwise statements written in the body part of else are executed. This is appropriate where we have to check only one condition.

    Syntax of if else statement:

    if(condition)
    statement1;
    else
    statement2;
    In this case if the condition is true then statement1 is executed otherwise statement2 is executed. The else portion of the if-else statement is optional.
    Flowchart:-


    Example:-

    #include <stdio.h>
    int main()
    {
    int num1,num2;
    printf("Input two numbers");
    scanf("%d%d",&num1,&num2);
    if(num1>num2)
    printf("%d is greater than %d",num1,num2);
    else
    printf("%d is greater than %d",num2,num1);
    return 0;
    }
    Third part:-
    /*to pick the smallest number among three numbers*/
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int x,y,z;
    printf("enter 3 numbers\n");
    scanf("%d%d%d",&x,&y,&z);
    if(x<y && x<z)
    {
    printf("x is smallest");
    }
    elseif(y<x && y<z)
    {
    printf("y is smallest\n");
    }
    else
    {
    printf("z is smallest");
    }
    getch();
    }

    2.What is an array? Write a program to add two 3x3 matrices.2+8
    Array:
    Definition: A composite variable capable of holding multiple data of same data type under a single variable name is called array.
    Features:
    ->stores multiple values
    ->helps to solve complex porblem
    ->can be used as array as pointer
    ->pixel based graphics programming made easier etc

    Declaration of Array/syntax:

    datatype array_name [size];

    Example: - int marks [10]; int x[4]={1,2,3,4};

    Array size is fixed at the time of array declaration.

    Generally, we use for loop () to assign data or item in memory and also use this loop to extract data from memory location.

    Types of Array:

    There are 2 types of array.

    a) One Dimensional Array (1-D): IT is an array where we use one subscript value.It stores value in row in contigous cells.
    syntax:
    data type arra[value/size];
    For example:
    int a[10];
    This array stores ten value starting from location zero na dends at 9.

    b) Two Dimensional Array (2-D):an array where we may use two or more than two subscript values.
    In this we use matrix concept.

    syntax:
    data type arra[row size][column size];
    For example:
    int a[2][2];
    It uses two rows and two columns.
    Values are stored as:

     

    Column zero

    Column one

    Row 0 à

    1(0,0)

    2(0,1)

    Row 1à

    3(1,0)

    4(1,1)

    This array stores total four  values starting from location zero and ends at 1.


    Second part:-

    /* to find sum of two 3x3 matrices*/

    #include <stdio.h> 

    int main()

    {

        int matrix1[3][3],matrix2[3][3];

        int i,j;

        printf("enter elements of matrix 1\n");

        for(i=0;i<=2;i++)

        {

            for(j=0;j<=2;j++)

            {

                scanf("%d",&matrix1[i][j]);

            }

        }

        printf("enter elements of matrix 2\n");

        for(i=0;i<=2;i++)

        {

            for(j=0;j<=2;j++)

            {

                scanf("%d",&matrix2[i][j]);

            }

        }

        printf("sum of two matrices is \n");

        for(i=0;i<=2;i++)

        {

            for(j=0;j<=2;j++)

            {

                printf(" %d ",matrix1[i][j]+matrix2[i][j]);

            }

            printf("\n");

        }

          return 0;

    }


    3.Explain local, global and static local variables with suitable example. Write a program to find sum of first N natural numbers. The value of N should enter by user.5+5
    Ans:-

     Local variables:-

                                Those variables which are declared inside the function are called local variables.They can not be accessed from other function or outsiders. It means scope is limited to that function where  it is declared. For local variables, either we use keyword 'auto' or simply variables with data types.

            Example:-

            void sum()

                {

                    int a,b;

                    int sum;       

                }

                Here, a,b and sum are local variables.

       


    Global variables:-

                                Those variables which are declared outside the function are called global variables.They can  be accessed from other function or outsiders. It means scope is not limited to that function. For global variables, either we use keyword 'extern' or simply variables with data types.

            Example:-

            int a=7,b=9;    

            int sum;       

            void sum()

                {

                 sum=a+b;   

                }

                Here, a,b and sum are global variables. Once we declare them , it does not need to be declared inside the function. It works.



    static variables:-

                               Compiler can know the value of variables till it is called.After calling compiler loses its content i.e. function forgets the value. i.e. our function can not retain its value after calling. To overcome this problem, we have to use keyword 'static' with variables. It retains the variables values even after calling. 

            Example:-

           #include <stdio.h>

            void sum();

             int main()

            {

                 sum();

                sum();

                return 0;

        }   

    void sum()

        {

        int a=7,b=9;    

        printf("sum is=%d\n",a+b);

        b++;

        }

              If we run this program, we will get 16 two times. It means there will be no change in output of statement 'b++'. For this we have to use static in front of int a=7,b=9 i.e. 

    static int a=7,b=9. If we use it then computer remembers old values and we will get different values.

    Now we will get first 

    16 then

    17 

    Second part-
    /*
     a program to find sum of first N natural numbers.*/
    //A program  to find sum of 1 to n natural numbers.
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int k=1,n,sum=0;
    printf("enter value of 'n'\n");
    scanf("%d",&n);
    while(k<=n)
       {
         sum=sum+k;
          k++;
       }
        printf("sum of N natural numbers =%d",sum);
    getch();
    }

    4.Differentiate between structure and union. Write a program to read age of 50 peoples and count number of people between ages 30 to 50.5+5
    Ans:-
    The differences between struct and union are given below in tabular form.
                       
    struct
    Union
    1.It stores dis-similar data.Each gets separate space in memory.They do not share memory
    1. It stores dis-similar type of data.Total memory space is equal to the member with largest size.They share memory space.
    2.we can access member in any sequence .
    2.We can access that whose value is recently used.
    3.It uses keyword 'struct'
    3.It uses keyword 'union'
    4.We can initialize values of member/s and in any order
    4.We can initialize that member which is first declared.
    5.It consumes more memory
    5.It consumes less memory.
    6.Its syntax
        struct tag
    {
    datatype member1;
    datatype member2;
    datatype member3;
    }variable;

    6.Its syntax
        union tag
    {
    datatype member1;
    datatype member2;
    datatype member3;
    }variable;

    Example
    struct student
    {
    int roll;
    char sex;
    float percentage;
    }var;

    Example
    union student
    {
    int roll;
    char sex;
    float percentage;
    }var;


    Second part:-
    /*
     program to read age of 50 peoples and count number of people between ages 30 to 50*/

    /*Write a C program to enter age of 50 people and count number of people between 30 and 50.

    */

    #include <stdio.h>

    int main()

    {

        float age[50];

        int I,count=0;

        printf("enter age of 50 persons\n");

        for(i=0;i<=49;i++)

        {

            scanf("%f",&age[i]);

        }

        printf("Persons having age between 30 and 50 are:");

        for(i=0;i<=49;i++)

        {

            if(age[i]>=30 && age[i]<=50)

                    count++;

             

        }

        printf("total age between 30 and 50 =%d,"count);

        return 0;

    }

     


    5.List any four file handling functions. Write a program to increase the salary of employee by 20% in the file “employee.dat”. Suppose the record of employee have three fields: employ_id, name and salary.2+8

    Ans:-
    Following are four file handling functions.
    1.fopen(): It is used to opne a file in particular mode.
    2.fclose():It closes the file.
    3.fprintf():It is used to write our data or records in a a datafile.
    4.fscanf():-It help us to read the contents from a datafile.
    Second part:-

    //to update/increase salary by 20%

    #include<stdio.h>

    int main()

    {

    int employ_id;

    char name[100];

    float salary,updated_sal;

     FILE *k,*k1;

    k=fopen("employee.dat","r");

    k1=fopen("second.dat","w");

    while((fscanf(k,"%d %s %f",&employ_id,name,&salary))!=EOF)

    {

      updated_sal=salary+0.2*salary;

      fprintf(k1,"%d %s %f\n",employ_id,name,updated_sal);

    }

    fclose(k);

    fclose(k1);

    printf("data updated!!!!\n");

    remove("employee.dat");

    rename("second.dat","employee.dat");

    return 0;

    }

    Group “B”

                                              Short Answer questions                                               7x5=35



    Attempts any Seven questions:

    6.What is feasibility study? Explain the importance of feasibility study in system analysis phase.1+4
    Ans:-

    It is the measure and the study of how beneficial the development of the system would be to the organization. This is known as feasibility study. The aim of the feasibility study is to understand the problem and to determine whether it is worth proceeding. A well-researched and well-written feasibility study is critical when making "Go/do not Go" decisions regarding entry into new businesses.    

    why feasibility study?

    • What exactly is the project? Is it possible? Is it practicable? Can it be done?

    • Economic feasibility, technical feasibility, schedule feasibility, and operational feasibility - are the benefits greater than the costs?

    • Technical feasibility - do we 'have the technology'? If not, can we get it?

    • Schedule feasibility - will the system be ready on time?

    • Customer profile: Estimation of customers/revenues.

    • Determination of competitive advantage.

    • Operational feasibility - do we have the resources to build the system? Will the system be acceptable? Will people use it?

    • Current market segments: projected growth in each market segment and a review of what is currently on the market.

    • Vision/mission statement.

    ·     Definition of proposed operations/management structure and management method

    7.What is ICT? Explain the positive impacts of ICT in society.1+4
    Ans:-
    ICT:
    Internet is a web of networks i.e. interconnection of large number of computers throughout the world. The computers are connected (wired or wireless via satellite) in such a way that anybody from anywhere can access anything/ information. It is the largest network in the world just like a communication service provided by different companies.
    Positive impacts in society:-
    1.File sharing/transferring:-

    A file can be put on a "Shared Location" or onto a File Server for instant use by colleagues does not matter what is a size of file and how many will use it. Mirror servers and peer-to-peer networks can be used to ease the load of data transfer.

    2.Internet banking:-

    We know that almost all banks now-a-days are using this technology for its customers as an extra facility. Internet Banking/ Online Banking allows bank customers to do financial transactions on a website operated by the banks. The customers can do almost any kind of transaction on the secured websites. They can check their account balance, transfer funds, pay bills, etc. but security is a major issue for thi


    Negative impacts in society:

    1.Spamming

    Spamming refers to sending unwanted emails in bulk, which provide no purpose and needlessly obstruct the entire system. Such illegal activities can be very frustrating for you as it makes your Internet slower and less reliable.

    2.Virus Threat:

    Internet users are often plagued by virus attacks on their systems. Virus programs are inconspicuous and may get activated if you click a seemingly harmless link. Computers connected to Internet are very prone to targeted virus attacks and may end up crashing.

    8.What is network topology? Explain star topology with neat and clean diagram.1+4
    Ans:-
    Network topology:
    Network topology is the arrangement of the elements of a communication network. Network topology can be used to define or describe the arrangement of various types of telecommunication networks, including command and control radio networks, industrial fieldbusses and computer networks.
    Basically, ring topology is divided into the two types which are Bidirectional and Unidirectional. Most Ring Topologies allow packets to only move in one direction, known as a one-way unidirectional ring network. Others allow data to go, either way, called bidirectional.
    star topology:
    A star topology is designed with each node (file server, workstations, and peripherals) connected directly to a central network hub, switch, or concentrator (See fig. 2).
    Data on a star network passes through the hub, switch, or concentrator before continuing to its destination. The hub, switch, or concentrator manages and controls all functions of the network.
     It also acts as a repeater for the data flow. This configuration is common with twisted pair cable; however, it can also be used with coaxial cable or fiber optic cable.



                    Fig. 2. Star topology

    Advantages of a Star Topology

    • Easy to install and wire.

    • No disruptions to the network when connecting or removing devices.

    • Easy to detect faults and to remove parts.

    Disadvantages of a Star Topology

    • Requires more cable length than a linear topology.

    • If the hub, switch, or concentrator fails, nodes attached are disabled.



    9.What is E-leaning? Explain its advantages and disadvantages .2+3
    Ans:-
    E-learning system based on formalised teaching but with the help of electronic resources is known as E-learning. While teaching can be based in or out of the classrooms, the use of computers and the Internet forms the major component of E-learning. E-learning can also be termed as a network enabled transfer of skills and knowledge, and the delivery of education is made to a large number of recipients at the same or different times. Earlier, it was not accepted wholeheartedly as it was assumed that this system lacked the human element required in learning.

    Advantages:-
    1
    .Fast learning
    2.Physical presence is not needed.
    3.We may study in a group.
    4.We can use Forum for questions and answers.


    Disadvantages:-
    1.Unstable Internet may cause interrupt while study.
    2.Students may not response.
    3.Not so interactive
    etc

    10.What is transmission medium? Differentiate between wired and wireless communication media.1+4
    Ans:-
    Transmission medium:-
    It is a path through which data is transmitted.this path contains wires or soemtimes thin glasses.
    Difference between guided and unguided are given below.

    S.No.

    Guided Media

    Unguided Media

    1.

    The signal energy propagates through wires in guided media.

    The signal energy propagates through air in unguided media.

    2.

    Guided media is used for point to point communication.

    Unguided media is generally suited for radio broadcasting in all directions.

    3.

    Discrete network topologies are formed by the guided media.

    Continuous network topologies are formed by the unguided media.

    4.

    Signals are in the form of voltage, current or photons in the guided media.

    Signals are in the form of electromagnetic waves in unguided media.

    5.

    <Examples of guided media are twisted pair wires, coaxial cables, optical fiber cables.

    Examples of unguided media are microwave or radio links and infrared light.

    6.

    By adding more wires, the transmission capacity can be increased in guided media.

    It is not possible to obtain additional capacity in unguided media.


    11.What is OOP? Explain Object and class.1+4
    Ans:-
    OOP:-
    The major motivating factor in the invention of object oriented is to remove some of the flaws encountered in the procedural oriented approach. Object oriented programming uses concept of “Object” and treats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the functions that operate on it, and protects it from accidental modifications from outside functions.
    Some features are:-
    1) Emphasis is on data rather than procedures or algorithms.
    2) Programs are divided into what are known as objects.
    3) Data structures are designed such that characterize the objects.

    Second part:-

    Class:-

    In the real world, you'll often find many individual objects all of the same kind. There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. A class is the blueprint from which individual objects are created. So it can be said as collection of same type of objects.for example in java,


    simply we can create by writing ,

    class name

    {

    members;

    functions;

    }

    here, we can see a class named helloworld.It displays output hello world! by creating a class we create an object/s.

    Object:-

    An object can be considered a "thing" with some attributes and  can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the hand can grip something or a Student(object) can give the name or address. They all have state and behavior. like ,Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes).

       For example if “customer” and “account.” are two objects in a program, then the customer object may send a message to the account object requesting for the bank balance. Each object contains data and code to manipulate the data. Objects can interact without having to know details of each other’s data or code. 




    12.What is multimedia? Explain the components of multimedia.1+4
    Ans:-
    Multimedia:-
    Multimedia is content that uses a combination of different content forms such as text, audio, images, animations, video and interactive content. Multimedia contrasts with media that use only rudimentary computer displays such as text-only or traditional forms of printed or hand-produced material.
    Components:-

    1)Text: Text is the most common medium of representing the information. In multimedia, text is mostly use for titles, headlines,menu etc. The most commonly used software for viewing text files are Microsoft Word, Notepad, Word pad etc. Mostly the text files are formatted with ,DOC, TXT etc extension.

    2)Audio: In multimedia audio means related with recording, playing etc. Audio is an important components of multimedia because this component increase the understandability and improves the clarity of the concept. audio includes speech, music etc. The commonly used software for playing audio files are:
    i) Quick Time
    ii) Real player
    iii) Windows Media Player

    3)Graphics: Every multimedia presentation is based on graphics. The used of graphics in multimedia makes the concept more effective and presentable.the commonly used software for viewing graphics are windows Picture, Internet Explorer etc. The commonly used graphics editing software is Adobe Photoshop through which graphics can be edited easily and can be make effective and attractive.

    4)Video: Video means moving pictures with sound. It is the best way to communicate with each other. In multimedia it is used to makes the information more presentable and it saves a large amount of time. The commonly used software for viewing videos are:
    i) Quick Time
    ii) Window Media Player
    iii) Real Player

    5)Animation: In computer animation is used to make changes to the images so that the sequence of the images appears to be moving pictures. An animated sequence shows a number of frames per second to produce an effect of motion in the user's eye.

    13.What is DMBS? Explain the advantages of normalization.2+3
    Ans:-
    DMBS:-
    A DBMS is a system software package that helps the use of integrated collection of data records and files known as databases. It allows different user application programs to easily access the same database. DBMSs may use any of a variety of database models, such as the network model or relational model. In large systems, a DBMS allows users and other software to store and retrieve data in a structured way. Instead of having to write computer programs to extract information, user can ask simple questions in a query language. 
    Normalization:-

    In the field of relational database design, normalization is a systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain undesirable characteristics—insertion, update, and deletion anomalies that could lead to a loss of integrity.
    It is of following types:
    1N
    2N
    3N
    4N
    and 5N
    Advantages:-

    Some of the major benefits include the following :

    • Greater overall database organization
    • Reduction of redundant data
    • Data consistency within the database
    14.Write short notes on any two:2.5+2.5

    a) Data Security b) Cyber Law c) System Testing
    Ans:-

    a) Data Security
    Ans:-


     It simply says protection of data /information contained in database against unauthorized access, modification or destruction. The main condition for database security is to have “database integrity’ which says about mechanism to keep data in consistent form. Besides these all, we can apply different level of securities like:

      1. Physical: - It says about sites where data is stored must be physically secured.
      2. Human: - It is an authorization is given to user to reduce chance of any information leakage or manipulation.
      3. Operating system: We must take a foolproof operating system regarding security such that no weakness in o.s.
      4. Network: - since database is shared in network so the software level security for database must be maintained.
      5. Database system: - the data in database needs final level of access control i.e. a user only should be allowed to read and issue queries but not should be allowed to modify data

    b) Cyber Law
    :-
    This law is commonly known as the law of the internet. It governs the legal issues of computers, Internet, data, software, computer networks and so on. These terms of legal issues are collectively known as cyberspace. In other words, it is a type of law which rules on the Internet to prevent Internet related crime.

    Cyber law is a new and quickly developing area of the law that pertains to persons and companies participating in e-commerce development, online business formation, electronic copyright, web image trademarks, software and data licenses, online financial transactions, interactive media, domain name disputes, computer software and hardware, web privacy, software development and cybercrime which includes, credit card fraud, hacking, software piracy, electronic stalking and other computer related offenses.

    c) System Testing

    :-

      Before actually implementing the new system into operations, a test run of the system is done removing all the bugs, if any. It is an important phase of a successful system. After codifying the whole programs of the system, a test plan should be developed and run on a given set of test data. The output of the test run should match the expected results.

    Using the test data following test run are carried out:

    • Unit test

    • System test

    • Black box

    • white box etc

    Unit test: When the programs have been coded and compiled and brought to working conditions, they must be individually tested with the prepared test data. Any undesirable happening must be noted and debugged (error corrections).

    System Test: After carrying out the unit test for each of the programs of the system and when errors are removed, then system test is done. At this stage the test is done on actual data. The complete system is executed on the actual data. At each stage of the execution, the results or output of the system is analysed. During the result analysis, it may be found that the outputs are not matching the expected out of the system. In such case, the errors in the particular programs are identified and are fixed and further tested for the expected output.

    When it is ensured that the system is running error-free, the users are called with their own actual data so that the system could be shown running as per their requirements.



    THE END

     

    1 comment:

    1. Shooting Casino Slots Online
      Shooting Casino Slots 메리트 카지노 가입 Online luckyclub ✓ Play 7700+ FREE 카지노 사이트 제작 Online Slots 제왕 카지노 보증 ✓ Great Jackpots ✓ Top Rated Casino Software Providers ✓ Free Spins ✓ Best Bonus 바카라 규칙 Offers.

      ReplyDelete