-->

HISSAN 2070 computer science questions and solutions

 

HISSAN CENTRAL EXAMINATION – 2070 (2014)

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.a) What is loop? Differentiate between while and do while loop.1+4
Ans:-
Loop:-
It simply says execution of different statements/blocks again and again repeatedly under certain condition. When the condition dissatisfies, the execution stops. This is called iteration or looping.
Second part:-
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.



b) What is union? Explain.5
ans:-
 It stores dis-similar type of data.Total memory space is equal to the member with largest size.They share memory space.We can access that whose value is recently used.It uses keyword 'union'.We can initialize that member which is first declared.It consumes less memory.
Its syntax
    union tag
{
datatype member1;
datatype member2;
datatype member3;
}variable;
Example
union student
{
int roll;
char sex;
float percentage;
}var;


2.What is function? What are the advantages of using function? Write a program to find factorial of a number using function.1+4+5
Ans:-

Definition:-
A self –contained block of code that performs a particular task is called Function.


A function has 4 elements.

1. Function Declaration (Function Prototype)

2. Function Call

3. Function Definition
4.Returning some value


For example,
int sum(int,int);
int main()
{
  sum(2,3);
  return 0;
}
int sum(int a,int b)
{
 return a+b;
}
Here,
int sum(int,int); is called prototype.It contains two parameters.
sum(2,3) is called calling of function.
In sum(2,3), 2 and 3 are called real arguments.
int sum(int a,int b)
{
 return a+b;
}
is called body part of function.
Advantages of function:
1.fast development
2.can be developed in team
3.More flxibility
4.Fast fault finding
5.Top-down approach to solve the problem.
6.It keeps our code well organized.
7.It makes the code re-usable
etc
second part:-
//program to get factorial value of a number using recursive function
#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);
}

}

3.Differentiate between array and structure. WAP to enter 20 integer numbers into an array and find the greatest and smallest number.5+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;

second part:-

/*to find the greatest and smallest value*/

#include<stdio.h>

int main()

{

    int numbers[10];

    int i,great,small;

    printf("enter numbers\n");

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

    {

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

    }

    great=numbers[4];

    small=numbers[3];

   

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

    {

        if(great<numbers[i])

        {

            great=numbers[i];

        }

        else if(small>numbers[i])

        {

            small=numbers[i];

        }

    }

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

    return 0;

}

4.What is string? Explain any two string manipulation function. Write a program to check whether a given string is palindrome or not.1+4+5
Ans:-
String:-
String--
           It means series of characters used in our program. We can also use digits with characters. They also act as string or a part of it. It is used when we input our name or address or somewhere their combination.

Syntax
char identifier[value];
or char identifier[value][value];

We can use he upper one if we want to input single string then. And if we want to input multiple values then we use lower one(called 2-dimensional array in string).

For example,
char name[100];
gets(name)
Here, the variable accepts value having maximum characters 100. We can also write ,
char name[10]="kathmandu";
IT stores the value in following way.

It stores values from cell location '0' and ends at null character called escape sequence. This is used to show that there is no more character beyond that. This null character is used with strings only. For  numbers, it is not used.
                        Similarly, if we want to store multiple string with same name then one-dimensional is not applicable. We use two dimensional string.
We declare:

char name[5][50];
It means, we are going to store any five names having optimum 50 characters.
Let's look below. If we have five names :RAM,SHYAM,Nita then it would like

so sequentially it stores data in different row. We use loop to execute it with different data.
Or, instead of inputting string, if we initialize strings then it can be written as
  char name[5][50]={"RAM","Shyam","Nitu"};

Two string manipulating function:-
1) strlen(string);-It is used to get length of given string.

 syntax:
identifer=strlen(string);
For example,
#include<stdio.h>
#include<string.h>
void main()
{
char string[100]="apple";
int k;
k=strlen(string);
printf("length=%d",k);
}
It returns 5. It also counts white spaces present in a string.
If we want want , we can also input string using scanf() or gets().

2)strrev():- It reverses the string given by us.

syntax:- strrev(string);
example:

#include<stdio.h>
#include<string.h>
void main()
{
char string[100]="apple";
printf("reverseed string=%s",strrev(string));
}

We get output "elppa". Instead of putting in output line, we can put it before printf.

Third part:-
/*to know a string is Palindrome or not*/

#include<stdio.h>
include<conio.h>
void main()
{                                                           
char name[30];                                                    
char temp[30];
printf("enter string\n");
gets(name);
strcpy(temp,name);
if((strcmp(strrev(name),temp))==0)
{
  print("it is palindrome\n");
}
else
{
printf("it is not\n");
}
getch();
}
 

5.Write a program to write roll, name and mark of computer of 20 students into a file named “student.dat” and display them in monitors.
Ans:-
/*
program to write roll, name and mark of computer of 20 students into a file named “student.dat” and display them in monitors.
*/

#include<stdio.h>

int main()

{

int roll;

char name[100];

int c_marks;

 FILE *k;

k=fopen("student.dat","w");

printf("enter student roll,name and computer marks\n");

printf("\nand press ctrl+z to exit\n");

while((scanf("%d %s %d",&roll,name,&c_marks))!=EOF)

{

  fprintf(k,"%d %s %d\n",roll,name,c_marks);

}

fclose(k);

printf("data stored successfuly");

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

while((fscanf(k,"%d %s %d",&roll,name,&c_marks))!=EOF)

{

  printf("roll=%d name=%s computer marks=%d\n",roll,name,c_marks);

}

fclose(k);

return 0;

}

 

10

Group “B”

                                          Short Answer questions                                                7x5=35


Attempts any Seven questions:
6.What is feasibility study? Explain different types 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.Differentiate between bus and star topology.5
Ans:-
We can understand about bus and star topology from following paragraphs.
Bus topology:
A linear bus topology consists of a main run of cable with a terminator at each end (See fig. 1). All nodes (file server, workstations, and peripherals) are connected to the linear cable.

Fig. 1. Linear Bus topology

Advantages of a Linear Bus Topology

  • Installation is easy and cheap to connect a computer or peripheral to a linear bus.
  • Requires less cable length than a star topology.

Disadvantages of a Linear Bus Topology

  • Entire network shuts down if there is a break in the main cable.
  • Difficult to identify the problem if the entire network shuts down.
  • Not meant to be used as a stand-alone solution in a large building.
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.


8.What is an AI? Explain the application area of AI.1+4
Ans:-
Artificial intelligence is where machines can learn and make decisions similarly to humans. There are many types of artificial intelligence including machine learning, where instead of being programmed what to think, machines can observe, analyse and learn from data and mistakes just like our human brains can. This technology is influencing consumer products and has led to significant breakthroughs in healthcare and physics as well as altered industries as diverse as manufacturing, finance and retail.
Uses:-We can use AI in following fields.

game playing
You can buy machines that can play master level chess for a few hundred dollars. There is some AI in them, but they play well against people mainly through brute force computation--looking at hundreds of thousands of positions. To beat a world champion by brute force and known reliable heuristics requires being able to look at 200 million positions per second.
speech recognition
In the 1990s, computer speech recognition reached a practical level for limited purposes. Thus United Airlines has replaced its keyboard tree for flight information by a system using speech recognition of flight numbers and city names. It is quite convenient. On the the other hand, while it is possible to instruct some computers using speech, most users have gone back to the keyboard and the mouse as still more convenient.
understanding natural language
Just getting a sequence of words into a computer is not enough. Parsing sentences is not enough either. The computer has to be provided with an understanding of the domain the text is about, and this is presently possible only for very limited domains.
computer vision
The world is composed of three-dimensional objects, but the inputs to the human eye and computers' TV cameras are two dimensional. Some useful programs can work solely in two dimensions, but full computer vision requires partial three-dimensional information that is not just a set of two-dimensional views. At present there are only limited ways of representing three-dimensional information directly, and they are not as good as what humans evidently use


9.What is network architecture? Differentiate between peer to peer and client/server network architecture.1+4
Ans:-

Network Architecture:-

Network architecture refers to the way network devices and services are structured to serve the connectivity needs of client devices. Network devices typically include switches and routers. Types of services include DHCP and DNS. Client devices comprise end-user devices, servers, and. smart things.

             Client –server:
  • In this, one or two computers work as server and left all work as clients.

  • Clients computers give request to server for a task to be performed.

  • Clients computers may or may not have self processing capability. they rely on server.

  • Mostly servers use a powerful operating system like, Linux or Unix or Win advanced server2008 etc.

  • Through server, the sharing of files is done.

  • Everything is controlled by server so in the case of down, services can not be completed.

  • under heavy load, many servers share the tasks.

  • there is high level security in networking.

  • High traffic towards servers while processing.

       Peer to peer(P2P):
  • In this all the computers are treated equally.

  • No one computer is server or client.

  • All computers can be said working as client or server.

  • Computers have self processing capability and do not rely on others.

  • Computers have or can run with normal operating system like, XP, Me etc and application.

  • Easy sharing of files and allows us to have chatting.

  • failure of one does not mean others are down; networking goes on.

  • If heavy load is given, they may not give same performance. etc

  • low level security.


10.Differentiate between Centralized database and Distributed database with clean figure.5
Ans:-
We can understand about centralized and distributed from following explanation.
Centralized database:-
A centralized database (sometimes abbreviated CDB) is a database that is located, stored, and maintained in a single location. ... Users access a centralized database through a computer network which is able to give them access to the central CPU, which in turn maintains to the database itself.

This centralized database is mainly used by institutions or organizations. Since all data is stored at a single location only thus it is easier to access and co-ordinate data. The centralized database has very minimal data redundancy since all data is stored at a single place.

Benefits:-

->Job is centralized.

->It Can not process if main server fails.

->Its Security is given to one machine.

->No need to have network for communication.Not so expensive to set up.

->Data speed is comparatively fast.

Distributed database system:-

A distributed database is basically a database that is not limited to one system, it is spread over different sites, i.e, on multiple computers or over a network of computers. A distributed database system is located on various sites that don’t share physical components. This may be required when a particular database needs to be accessed by various users globally. It needs to be managed such that for the users it looks like one single database.

 

Following are some advantages over centralized daatbase.

1.It is highly secured.

2.If  a computer fails, entire system keeps on runnig.

3.There is load balancing.

4.High performance.

5.Faster response time.

6.Fast data sharing.

etc.



11.What is e-governance? Explain.5
Ans:-
Electronic governance or e-governance is the application of information and communication technology (ICT) for delivering government services, exchange of information, communication transactions, integration of various stand-alone systems and services between government-to-customer (G2C), government-to-business (G2B), government-to-government (G2G) as well as back office processes and interactions within the entire government framework.
The objectives of e governance are as follows-
1.One of the basic objectives of e-governance is to make every information of the government available to all in the public interest.
2.One of its goals is to create a cooperative structure between the government and the people and to seek help and advice from the people, to make the government aware of the problems of the people.
3.To increase and encourage people’s participation in the governance process.
4.e-Governance improves the country’s information and communication technology and electronic media, with the aim of strengthening the country’s economy by keeping governments, people and businesses in tune with the modern world.
5.One of its main objectives is to establish transparency and accountability in the governance process.

12.What is an OOP? Explain polymorphism and inheritance with example.1+4
Ans:-
OOP:-
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.
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.

Inheritance
Inheritance is mainly used for code reusability.In the real world there are many objects that can be specialized. In OOP, a parent class can inherit its behavior and state to children classes. Inheritance means using the Predefined Code. This is very main feature of OOP, with the advantage of Inheritance we can use any code that is previously created. This concept was developed to manage generalization and specialization in OOP.  Lets say we have a class called Car and Racing Car . Then the attributes like engine no. , color of the Class car can be inherited by the class Racing Car . The class Car will be Parent class , and the class Racing Car will be the derived class or child class
The following OO terms are commonly used names given to parent and child classes in OOP:
Superclass: Parent class.
Subclass: Child class.
Base class: Parent class.
Derived class: Child class

13.What is multimedia? How is multimedia used in film industry? Explain.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.

Multimedia in Film Industry:-
Multimedia is heavily used in the entertainment industry, especially to develop special effects in movies and animations (VFX, 3D animation, etc.). Video games class as multimedia, as such games meld animation, audio, and, most importantly, interactivity, to allow the player an immersive experience. Not only this much, it helps us to create effects which are not possible in real world.For this we use some called green effects. Then that is converted into other effects.


14.What is database? What are the advantages of normalization?1+4
Ans:-
Database:-
Simply well organized collection of data is database.
One way of classifying databases involves the type of content, for example: bibliographic, full-text, numeric, and image. Databases consist of software-based "containers" that are structured to collect and store information so users can retrieve, add, update or remove such information in an automatic fashion. Database programs are designed for users so that they can add or delete any information needed. The structure of a database is tabular, consisting of rows and columns of information.


Advantages
  • Reduced data redundancy
  • Improved data security
  • Reduced data entry, storage, and retrieval costs

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
  • A much more flexible database design
  • A better handle on database security
  • Fewer indexes per table ensures faster maintenance tasks (index rebuilds).

  • Also realizes the option of joining only the tables that are needed.


15.Write short notes on :2.5+2.5

a) Computer Crime b) Virtual Reality
Ans:-
a) Computer Crime:-
Alternatively referred to as cyber crime, e-crime, electronic crime, or hi-tech crime. Computer crime is an act performed by a knowledgeable computer user, sometimes referred to as a hacker that illegally browses or steals a company's or individual's private information. In some cases, this person or group of individuals may be malicious and destroy or otherwise corrupt the computer or data files.


Below is a listing of the different types of computer crimes today. Clicking on any of the links below gives further information about each crime.

Different types of crime:-
1.Pornogrphy
2.Hacking
3.DOS
4.Phising etc

Protection method:

1. Use a full-service internet security suite
2. Use strong passwords
3. Keep your software updated
4. Manage your social media settings


 b) Virtual Reality:-

Virtual Reality (VR) is a computer-generated environment with scenes and objects that appear to be real, making the user feel they are immersed in their surroundings. This environment is perceived through a device known as a Virtual Reality headset or helmet.
Virtual reality or VR is a technology that creates a virtual environment. People interact in those environments using, for example, VR goggles or other mobile devices. It is a computer-generated simulation of an environment or 3-dimensional image where people can interact in a seemingly real or physical way.



THE END

 

 

 

SET -5

HISSAN CENTRAL EXAMINATION – 2070 (2014)

COMPUTER SCEINCE [230-M2]

Time: 3 hrs                                                                                          Full  Marks : 75

                                                                                                              Pass Marks: 27

 

 

Group “A”

                                        Long Answer questions                                                 4x10=40

Attempts any Four  questions:
1.a) Define operator. Write a program to illustrate the use of arithmetic operators.1+4

Ans:-

operator:- 

It is a symbol or a character used in programming. It is used to carry out some operation.
for example: +,-,= etc

Ther are many types of operators.

1Arithmetic

2.Relational

3.Logical

4.Unary

5.Assignment

6.Sizeof()

Second part:-

/*program to understand about arithmetic operator*/

#include<stdio.h>

int main()

{

int a=4,b=9;

printf("sum of 4 and 9 is %d",a+b);

return 0;

}

In this program we have used two variables named a and b.We have used them to find the sum using arithmetic operator '+'.

b) Write a program to reverse a number.5

Ans:-

//program to reverse a number.
#include<stdio.h>
#include<conio.h>
void main()
{
   int n,rem;
   printf("enter a number for 'n'\n");
  scanf("%d",&n);
  while(n!=0)
    {
      rem=n%10;
       printf("%d",rem);
       n=n/10;    
   }
getch();
}

2.What is the difference between library function and user defined function? Write programs to add two integer numbers using function?5+5

Ans:-

 Library function: 1.This is a function existing inside the library.

                                2.It can only be used.

                                3.Further modification is not allowed.

                                4.We need header file for this.

                            e.g. sqrt() or printf()

    User defined function:-1.This is a function created by user.

                                        2.It can  be used or created.

                                        3.We can modify ourselves.

                                        4.Header file is not needed.

Second part:-

// a function to add two integer numbers
#include <stdio.h>
int sum();
int main()
{
 sum();
return 0;
}
int sum()
{
int num1,num2;
printf("enter two numbers\n");
scanf("%d%d",&num1,&num2);

printf("sum=%d",num1+num2);
}

3.WAP to add two 3*3 matrix?10

Ans:-

/* 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;

}

 

 


4.Differentiate between structure and union. Write a program to enter name, price and page of five book and display the information in ascending order on the basis of price.3+7

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:-

/*a program to enter name, price and page of five book and display the information in ascending order on the basis of price.*/


#include <stdio.h>

#include<string.h>

struct shorting

{

  char name[100];

  float price;

  int page;

}var[5],var1;

int main()

{

    int i,j;

    printf("enter name price and page\n");

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

    {

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

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

        scanf("%d",&var[i].page);

    }

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

{

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

    {

        if(var[i].price>var[j].price)

        {

            var1=var[i];

            var[i]=var[j];

            var[j]=var1;

        }

    }

}

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

    {

        printf("name=%s price=%f and page=%d\n",var[i].name,var[i].price,var[i].page);     

    }

    return 0;

}

5.Write a program to enter name, roll no and marks of 10 students and store them into file called “HISSAN.dat” and display the information from a file.

Ans:-

/* a program to enter name, roll no and marks of 10 students and store them into file called “HISSAN.dat” and display the information from a file.*/

 #include<stdio.h>

int main()

{

 FILE *p;

char name[100];

int rollno;

int eng,phy,maths,chem,csc;

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

printf("enter name,roll no.and marks in eng,phy,maths,chem and csc\n");

printf("To exit ,press ctrl+z\n");

while((scanf("%s%d%d%d%d%d%d",name,&rollno,&eng,&phy,&maths,&chem,&csc))!=EOF)

{

 fprintf(p,"%s\t%d\t%d\t%d\t%d\t%d\t%d",name,rollno,eng,phy,maths,chem,csc);

}

fclose(p);

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

printf("data are\n");

while((fscanf(p,"%s%d%d%d%d%d%d",name,&rollno,&eng,&phy,&maths,&chem,&csc))!=EOF)

{

 printf("name=%s,rollno=%d, english=%d,physics=%d,maths=%d,chemistry=%d ,csc=%d \n",name,stdno,eng,phy,maths,chem,csc);

}

fclose(p);

return 0;

}


Group “B”

                                          Short Answer questions                                               7x5=35




Attempts any Seven questions:

6.Who is system analyst? Explain the major role of system analyst.1+4
Ans:-
System analyst:-
The persons who perform above task/system analysis,design and implementation activity is know as system analyst. Somewhere we say or call by names like business engineer, business analyst etc. The work of system analyst who designs an information system is just same as an architect of a house. They work as facilitators of the development of information systems and computer applications.
Roles:-

Defining Requirement: It's very difficult duty of analyst to understand user's problems as well as requirements. some techniques like interview, questioning, surveying, data collection etc have to be used. The basic step for any system analyst is to understand the requirements of the users.
Prioritizing Requirements: Number of users use the system in the organization. Each one has a different requirement and retrieves different information and in different time. For this the analyst must have good interpersonal skill, convincing power and knowledge about the requirements and setting them in proper order of all users.
Gathering Facts, data and opinions of Users: After determining the necessary needs and collecting useful information the analyst starts the development of the system with active cooperation from the users of the system. Time to time, the users update the analyst with the necessary information for developing the system. The analyst while developing the system continuously consults the users and acquires their views and opinions.
Evaluation and Analysis: Analyst analyses the working of the current information system in the organization and finds out extent to which they meet user's needs. on the basis of facts,opinions, analyst finds best characteristic of new system which will meet user's stated needs.
Solving Problems: Analyst is actually problem solver. An analyst must study the problem in depth and suggest alternate solutions to management. Problem solving approach usually has steps: identify the problem, analyse and understand the problem, identify alternate solutions and select best solution.


7.What is normalization? Explain.5
Ans:-
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.

1 NF:

        

A TABLE IS SAID TO BE IN 1n IF there is not repeating groups or information in a table..Here, repeating group means a set of columns that stores similar information that repeats in the same table.

Let’s consider following SQL commands.

Create table contacts

(

Contact Id               Integer                    not null,

L_name                  varchar(20)            not null,

F_name                  varchar(20)           

Contact_date1      date,

Contact_desc1      varchar(50),

Contact_date2      date,

Contact_desc2      varchar(50),

);

We can see here in this table that there is a repeating group of date and description.

Now to convert into 1 N, we have to make a new table and shift that repeating group into new table.

Like,

Create table contacts

(

Contact_ID integer        not null,

L_name      varchar(20) not null,

F_name      varchar(20)

);

 

Create table conversation

(

Contact_id integer        not null,

Contact_date date,

Contact_desc        varchar(50)

);


2N:

A table is said to be in 2 N if it is in 1N and there is no redundant data in table i.e. if a value of column is dependent on one column(primary key only) but not another.

For example:

Create table employee

(

Emp_no     integer        not null,

L-name       varchar(20) not null,

F_name      varchar(20),

Dept_code integer,

Description varchar(50),

);

This table contains redundant data i.e. the value of column(field) “description” depends on dept_code but does not depend on primary key “emp_no”.So let’s make a new table and shift them into that.

Create table employee

(

Emp_no     integer        not null,

L_name      varchar(20) not null,

F_name      varchar(20),

Dept_code integer,

);

 

Create table department

(

Dept_code integer        not null,

Description varchar(50) not null,

);

We got two tables named employee and department with fields. Both the tables are related by primary key called dept_code. Now there is no redundancy and table is in 2N.


3N:-

An entity is said to be in the third normal form when,

1) It satisfies the criteria to be in the second normal form.

2) There exists no transitive functional dependency. (Transitive functional dependency can be best explained with the relationship link between three tables. If table A is functionally dependent on B, and B is functionally dependent on C then C is transitively dependent on A and B).

Example:

Consider a table that shows the database of a bookstore. The table consists of details on Book id, Genre id, Book Genre and Price. The database is maintained to keep a record of all the books that are available or will be available in the bookstore. The table of data is given below.

Book id

Genre id

Book genre

price

121

2

fiction

150

233

3

travel

100

432

4

sports

120

123

2

fiction

185

424

3

travel

140

The data in the table provides us with an idea of the books offered in the store. Also, we can deduce that BOOK id determines the GENRE id and the GENRE id determines the BOOK GENRE. Hence we can see that a transitive functional dependency has developed which makes certain that the table does not satisfy the third normal form.

Book id

Genre id

price

121

2

150

233

3

100

432

4

120

123

2

185

424

3

140


                                                                           table book

Genre id

Book genre

2

fiction

3

travel

4

sports


                                                                           table genre

After splitting the tables and regrouping the redundant content, we obtain two tables where all non-key attributes are fully functional dependent only on the primary key.

When all the column in a table describe and depend upon the primary key,the table is 3N.


8.What is networking? Differentiate between LAN and MAN.5
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)

  • Scalable (computers and devices can be added with time without changing original

LAN and WAN:-

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.


9.What is database? Write the advantages of database.1+4
Ans:-

One way of classifying databases involves the type of content, for example: bibliographic, full-text, numeric, and image. Databases consist of software-based "containers" that are structured to collect and store information so users can retrieve, add, update or remove such information in an automatic fashion. Database programs are designed for users so that they can add or delete any information needed. The structure of a database is tabular, consisting of rows and columns of information.


Advantages

  • Reduced data redundancy

  • Improved data security

  • Reduced data entry, storage, and retrieval costs

  • Facilitated development of new applications program


10.Explain the terms class and Inheritance.2.5+2.5
ans:-

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;

}

Inheritance:-
Inheritance is mainly used for code reusability.In the real world there are many objects that can be specialized. In OOP, a parent class can inherit its behavior and state to children classes. Inheritance means using the Predefined Code. This is very main feature of OOP, with the advantage of Inheritance we can use any code that is previously created. This concept was developed to manage generalization and specialization in OOP.  Lets say we have a class called Car and Racing Car . Then the attributes like engine no. , color of the Class car can be inherited by the class Racing Car . The class Car will be Parent class , and the class Racing Car will be the derived class or child class
The following OO terms are commonly used names given to parent and child classes in OOP:
Superclass: Parent class.
Subclass: Child class.
Base class: Parent class.
Derived class: Child class
11.Describe computer crime.5
Ans:-
Alternatively referred to as cyber crime, e-crime, electronic crime, or hi-tech crime. Computer crime is an act performed by a knowledgeable computer user, sometimes referred to as a hacker that illegally browses or steals a company's or individual's private information. In some cases, this person or group of individuals may be malicious and destroy or otherwise corrupt the computer or data files.


Below is a listing of the different types of computer crimes today. Clicking on any of the links below gives further information about each crime.

Different types of crime:-
1.Pornogrphy
2.Hacking
3.DOS
4.Phising etc

Protection method:

1. Use a full-service internet security suite
2. Use strong passwords
3. Keep your software updated
4. Manage your social media settings

12.What is multimedia? Explain how multimedia is used in education and offices.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.

Multimedia in education:-
                            Multimedia is becoming popular in the field of education. It is commonly used to prepare study material for the students and also provide them proper understanding of different subjects.Nowadays Edutainment, a combination of Education and Entertainment has become very popular. This system provides learning as well as provides entertainment to the user.


Multimedia in offices:-
                                Multimedia, such as mobile marketing, livecasting and podcasting, photo, video and file sharing, can spread the word about your company and help build brand awareness in a very unique and powerful way. This particular type of social media also has the ability to go viral quickly.

13.What is AI? Describe different components of AI.1+4
Ans:-
Artificial Intelligence (AI) is usually defined as the science of making computers do things that require intelligence when done by humans. AI has had some success in limited, or simplified, domains. However, the five decades since the inception of AI have brought only very slow progress, and early optimism concerning the attainment of human-level intelligence has given way to an appreciation of the profound difficulty of the problem.

AI components are:

Learning

Learning is distinguished into a number of different forms. The simplest is learning by trial-and-error. For example, a simple program for solving mate-in-one chess problems might try out moves at random until one is found that achieves mate. The program remembers the successful move and next time the computer is given the same problem it is able to produce the answer immediately. The simple memorising of individual items--solutions to problems, words of vocabulary, etc.--is known as rote learning.

Reasoning

To reason is to draw inferences appropriate to the situation in hand. Inferences are classified as either deductive or inductive. An example of the former is "Fred is either in the museum or the cafŽ; he isn't in the cafŽ; so he's in the museum", and of the latter "Previous accidents just like this one have been caused by instrument failure; so probably this one was caused by instrument failure". The difference between the two is that in the deductive case, the truth of the premisses guarantees the truth of the conclusion, whereas in the inductive case, the truth of the premiss lends support to the conclusion that the accident was caused by instrument failure, but nevertheless further investigation might reveal that, despite the truth of the premiss, the conclusion is in fact false.

Problem-solving

Problems have the general form: given such-and-such data, find x. A huge variety of types of problem is addressed in AI. Some examples are: finding winning moves in board games; identifying people from their photographs; and planning series of movements that enable a robot to carry out a given task.

Perception

In perception the environment is scanned by means of various sense-organs, real or artificial, and processes internal to the perceiver analyse the scene into objects and their features and relationships. Analysis is complicated by the fact that one and the same object may present many different appearances on different occasions, depending on the angle from which it is viewed, whether or not parts of it are projecting shadows, and so forth.

Language-understanding

A language is a system of signs having meaning by convention. Traffic signs, for example, form a mini-language, it being a matter of convention that, for example, the hazard-ahead sign means hazard ahead. This meaning-by-convention that is distinctive of language is very different from what is called natural meaning, exemplified in statements like 'Those clouds mean rain' and 'The fall in pressure means the valve is malfunctioning'.
etc.
14.What are the objectives of e-governance? Explain.
Ans:-
Electronic governance or e-governance is the application of information and communication technology (ICT) for delivering government services, exchange of information, communication transactions, integration of various stand-alone systems and services between government-to-customer (G2C), government-to-business (G2B), government-to-government (G2G) as well as back office processes and interactions within the entire government framework.
The objectives of e governance are as follows-
1.One of the basic objectives of e-governance is to make every information of the government available to all in the public interest.
2.One of its goals is to create a cooperative structure between the government and the people and to seek help and advice from the people, to make the government aware of the problems of the people.
3.To increase and encourage people’s participation in the governance process.
4.e-Governance improves the country’s information and communication technology and electronic media, with the aim of strengthening the country’s economy by keeping governments, people and businesses in tune with the modern world.
5.One of its main objectives is to establish transparency and accountability in the governance process.


15.Write short notes on :2.5+2.5

a) Polymorphism b) Communication Satellite
Ans:-
a) 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.


b) Communication Satellite:-
In the context of spaceflight, a satellite is an object which has been placed into orbit by human endeavor. Such objects are sometimes called artificial satellites to distinguish them from natural satellites such as the Moon.
Satellites are usually semi-independent computer-controlled systems. Satellite subsystems attend many tasks, such as power generation, thermal control, telemetry, altitude control and orbit control
satellite has on board computer to control and monitor system.
Additionally, it has radio antennae (receiver and transmitter) with which it can communicate with ground crew.
Most of the satellites have attitude control system(ACS).It keeps the satellite in right direction.
Common types include military and civilian Earth observation satellites, communications satellites, navigation satellites, weather satellites, and research satellites. Space stations and human spacecraft in orbit are also satellites. Satellite orbits vary greatly, depending on the purpose of the satellite, and are classified in a number of ways. Well-known (overlapping) classes include low Earth orbit, polar orbit, and geostationary orbit. 





THE END

 

No comments:

Post a Comment