-->

HISSAN 2069 computer science questions and solutions

 

HISSAN-GRADE XII- 2069(2013)

Computer Science [230-M1]

 

Time: 3 hrs                                                                                          Full  Marks : 75

                                                                                                            Pass Marks: 27

 

Group “A”

                                        Long Answer questions                                                  4x10=40



Attempts any Four questions:

1.

a) Define the terms variable and constant.5
Ans:-
Variable:-

A variable is a value that can change any time. It is a memory location used to store a data value. A variable name should be carefully chosen by the programmer so that its use is reflected in a useful way in the entire program. Any variable declared in a program should confirm to the following:

They must always begin with a letter, although some systems permit underscore as the first character.
->White space is not allowed.
->A variable name should not be a keyword.
->It should not contain any special characters.
Examples of invalid variable names are

123 (area) 6th % abc

Examples of valid variable names are

Sun number Salary Emp_name averagel

Constant:-

A constant value is the one which does not change during the execution of a program. C supports several types of constants. These constants are given below:

  • Integer Constants
  • Floating Constants
  • Character constants
  • String Constants
  • Symbolic Constants
  • Escape Sequence Constants
Example:
Integer Constant:-
An integer constant is a sequence of digits. There are 3 types of integers namely decimal integers, octal integers and hexadecimal integers. These constants are given below.
Decimal Integers: 123 -31 0 +78
Octal Integers: O26 O O347 O676
b) What is algorithm? Explain with example.5
Ans:-
Algorithm:-


 This is the first step or a tool which we apply while designing the system. It says about sequence of finite steps written in certain order manually by programmers to carry out job. While writing algorithm, we follow or use general English words which we use in our daily life. There is no particular rule for that. Mostly, it uses 4 units namely inputs, processes, storing and output. Let’s see an example to be clear.

General features of Algorithm:

·         Clear specification of input

·         Uses variables

·         Provides clear steps, processes, controls and specifications.

·         Uses subroutines.

Rules for algorithms:

1.  Finiteness

2.  Input if needed with processes should be shown

3.  Very simple language should be used

4.  The writer while writing algorithm should be keep in mind about program to be written after this.

 

An algorithm to get sum of two numbers:

Step 1: start

Step 2: get two numbers say a,b

Step 3: let sum=a+b

Step: 4 print sum

Step 5 stop


2.a) What is function? Differentiate between library and user defined function.1+4
Ans:-
Function:-
Definition: A self –contained block of code that performs a particular task is called Function.
Features 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

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.

Second part:-

 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.

                    e.g.

                                void sum()


b) WAP to enter any number N and find the sum of the numbers upto N using loop.5
Ans:-
//program to get sum of 'n' integers using function.
#include<stdio.h>
#include<conio.h>
void sum();
void main()
{

sum();
getch();
}
void sum()
{int k=1,N,sum=0;
printf("enter value of 'n'\n");
scanf("%d",&N);
while(k<=N)
   {
      sum=sum+k;
      k++;
   }
printf("sum=%d",sum);
}

3.What is an array? Write a C program to enter age of 50 person and display the age greater than 40.2+8
Ans:-
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:

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

/*Write a C program to enter age of 50 person and display the age greater than 40.

*/

#include <stdio.h>

int main()

{

    float age[50];

    int i;

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

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

    {

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

    }

    printf("Persons having age above 40 are:");

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

    {

        if(age[i]>40)

          printf("%f,",age[i]);

    }  

    return 0;

}

 

4.Write a recursive function to calculate factorial of a given integer number.10
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);
}

}


5.Write a C program that takes input(s_id,s_name,s_add and s_salary) of 20 staffs from user and stores record of 20 staffs in a data file named staffs.txt. The program should also display the records in appropriate format reading from the file.
Ans:-
/* program that takes input(s_id,s_name,s_add and s_salary) of 20 staffs from user and stores record of 20 staffs in a data file named staffs.txt. The program should also display the records in appropriate format reading from the file. .*/

#include<stdio.h>

int main()

{

FILE *fp;
int s_id;

char s_name[30],s_add[100];

float s_salary;

fp=fopen("staffs.txt","w");

printf("Enter s_id,s_name, s_add and s_salary");
printf("press ctrl+z to exit\n");

while(scanf("%d%s%s%f",&s_id,s_name,s_add,&s_salary)!=EOF)
{
    fprintf(fp,"%d%s%s%f",s_id,s_name,s_add,s_salary);
}
fclose(fp);
fp=fopen("staffs.txt","r");
while(fscanf(fp," "%d%s%s%f",&s_id,s_name,s_add,&s_salary)!=EOF)
{
printf("id=%d,name=%s ,address=%s and salary=%f\n",s_id,s_name,s_add,s_salary);
}
fclose(fp);



return 0;

}

10

Group “B”

                                          Short Answer questions                                                7x5=35

Attempts any Seven  questions:
6.Who is system analyst? Explain the functions of system analyst.5

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

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 multimedia? Explain the application areas of multimedia.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.

Applications:-

1)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.

2)Multimedia in Entertainment
: Computer graphics techniques are now commonly use in making movies and games. this increase the growth of multimedia.

3)Movies: Multimedia used in movies gives a special audio and video effect. Today multimedia has totally changed the art of making movies in the world. Difficult effect, action are only possible through multimedia.

4)Games: Multimedia used in games by using computer graphics, animation, videos have changed the gaming experience. Presently, games provides fast action, 3-D effects and high quality sound effects which is only possible through multimedia.

5)Multimedia in Business: Today multimedia is used in every aspect of business. These are some of the applications:


8.What is normalization? Write the advantages of using normalization.1+4

Ans:-

Normlization:-

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 :

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.


9.Explain the responsibilities of DBA in an organization.5

Ans:-

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


10.Define Computer Network? Explain about LAN and WAN.1+4

Ans:-

Computer network:-

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)

Second part:-

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 effective.

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.

11.What is internet? Write the advantages of internet.1+4

Ans:-

Internet:-

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.

Advantages:-

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 (OOP)? Define the terms Inheritance and Polymorphism.1+4
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.
It differs from procedure Oriented Programming in following aspects. 


  • Abstraction: 
  • Objects: 
  • Class: 
  • Encapsulation: 
  • Information hiding
  • Second part:-

    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
    It can have many types.
    single inheritance:-one derived class inherits property from one base class
    multiple              “  :- one derived class inherits property from many base classes.
    multi level          “ :-in this many derived classes are inherited from many base classes
    hierarchical       “ :-under this many derived classes can be inherited from single base class
    hybrid                 “:-it’s a combination of hierarchical and multilevel.

    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.

    13.What do you understand by Artificial Intelligence (AI)? What are the application areas of AI?2+3
    Ans:-

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

    14.Write short notes on any two:

    a) E-commerce b) E-governance c) Fiber Optics cable
    Ans:-

    a) E-commerce :-

    E-commerce is a transaction of buying or selling online. Electronic commerce draws on technologies such as mobile commerceelectronic funds transfersupply chain managementInternet marketingonline transaction processingelectronic data interchange (EDI), inventory management systems, and automated data collection systems. Modern electronic commerce typically uses the World Wide Web for at least one part of the transaction's life cycle although it may also use other technologies such as e-mail.
    e-commerce in business:-

    E-commerce businesses may employ some or all of the following:
    • Online shopping web sites for retail sales direct to consumers
    • Providing or participating in online marketplaces, which process third-party business-to-consumer or consumer-to-consumer sales
    • Business-to-business buying and selling

    b) E-governance :-

    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.
    Importance of e-governance:- Because of following points we have to use e-governance.
    • Information delivery is greatly simplified for citizens and businesses.
    • It gives varied departments’ information to the public and helps in decision making.
    • It ensures citizen participation at all levels of governance.

    c) Fiber Optics cable:-

    An optical fiber or optical fiber

    • is a glass thread with  a bundle of many thin fibers. 

    • transmits the packets with the speed of light.

    • It is less susceptible.

    • It has high/est bandwidth.

    • Fibers are also used for illumination, and are wrapped in bundles so they can be used to carry images, thus allowing viewing in tight spaces. Specially designed fibers are used for a variety of other applications, including sensors and fiber lasers.

    • Optical fiber typically consists of a transparent core surrounded by a transparent cladding material with a lower index of refraction. Light is kept in the core by total internal reflection. This causes the fiber to act as a waveguide.

    • No interference because of no wiring technology

    • Data can be transmitted digitally or in as it is form.


    THE END

    2.5+2.5

    SET -3

    HSEB-GRADE XII - 2069(2012)

    Computer Science [230]

     

    Time: 3 hrs                                                                                          Full  Marks : 75

                                                                                                                Pass Marks: 27

     

    Group “A”

                                            Long Answer questions                                                  4x10=40



    Attempts any Four questions:

    1.What is looping? Describe “for” , “while” and “do-while” loops with appropriate examples.1+9
    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:-

    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:-
    for(initialization;condition;increment/decrement )
    {
    statements;
    }

    Flowchart:-


    For example:

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

    Output:
    If we execute this we will get 1,2,3....20

    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

    do..while loop:-

    It also executes program statements repeatedly until the given condition is true. It executes the program statements once at first then only condition is checked. If a condition is found true then it executes the program statements again, otherwise it gets out from the loop structure. As it checks the condition at last it is also known as the post-test loop or exit control loop.
    syntax:-
    initialization;
    do
    {

    statements;

    increment/decrement;
    }while(condition);
    Flowchart:-


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

    Output:
    If we execute this we will get 1,2,3....20


    2.What is control statement? Write a program which selects and prints largest among 3 numbers using “if-else” statement with flowcharts.2+8
    Ans:-
    control statement:-
    When we write program and run on system, the execution occurs immediately. The execution of instruction sometimes has to be controlled by using many parts or blocks of statements to get desired output. This is called control structure. These are in built and very important part of programming field and programmers too. By using this we can glue the different parts like, “what a program is”, “what a program is going to do”, “what will happen if a particular condition satisfies and if does not satisfy” etc. this part is also called logic, Which is the heart of program, which makes the program sensible and meaningful. Mainly, we have three parts as a control structures or simply logics.

    Second part:-
    Flowchart to pick the greatest number among three numbers.

    code:
    // program to get greatest number among three numbers
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    float a,b,c;
    printf(“enter three numbers\n”);
    scanf(“%f%f%f”,&a,&b,&c);
    if(a>b &&a>c)
    {
    printf(“the greatest number=%f\n”,a);
    }
    elseif(b>a &&b>c)
    {
    printf(“the greatest number=%f\n”,b);
    }
    else
    {
    printf(“the greatest number=%f\n”,c);
    }
    getch();
    }

    3.What is string? Explain any four string handling functions with example.2+8
    Ans:-
    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"};

    Second part:-
    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.

    3)strlwr(): This function is used to convert given string into lower case.
    syntax:-
    strlwr(string);
    Example;
    #include<stdio.h>
    #include<string.h>
    void main()
    {
    char string[100]="APPLE";
    printf("string in lowercase=%s",strlwr(string));
    }

    It gives us "apple" as an  output.

    4)strupr():This string function is used to convert all characters of  string into upper case.

    syntax:
    strupr(string);

    example:-
    #include<stdio.h>
    #include<string.h>
    void main()
    {
    char string[100]="apple";
    printf("string in uppercase=%s",strupr(string));
    }

    We get APPLE as an output after execution.

    4.Write a program to add two matrices by supplying elements of matrices by user.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;

    }

    5.Write a program which reads name, department and age from a file named “employee.dat” and display them in monitor.
    Ans:-

    #include<stdio.h>

    int main()

    {

     FILE *p;

    char name[100];

    char dept[100];

    float age;

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

    while((fscanf(p,"%s %s %f",name,dept,&age))!=EOF)

    {

     printf("name=%s,department=%s,age=%f\n",name,dept,age);

    }

    fclose(p);

    return 0;

    }

     

     


    Group “B”

                                              Short Answer questions                                                 7x5=35



    Attempts any Seven questions:

    6.Explain different stages of system development life cycle with clear figure.5
    Ans:-
    SDLC:-

    SDLC is a structure or a process to develop a software followed by a development team within the software organization. It consists of a detailed plan describing how to develop, maintain and replace specific software. SDLC is also known as information systems development or application development. It is life cycle defining a methodology for improving the quality of software and the overall development process. 




    SDLC's different phases are shown around the circle.
    1.Planning/requirements study
    2.System ananlysis
    3.System design
    4.System Development 
    5.System testing
    6.System implementation
    7.System evaluation
    8System maintenance



    Here we are going to understand about two phases of SDLC.

    Planning:-

    The first step is problem definition(study). The intent is to identify the problem, determine its cause, and outline a strategy for solving it. It defines what ,when who and how project will be carried out. 

                        As we know everything starts with a concept. It could be a concept of someone, or everyone. However, there are those that do not start out with a concept but with a question, “What do you want?” and "really, is there a problem?" They ask thousands of people in a certain community or age group to know what they want and decide to create an answer. But it all goes back to planning and conceptualization. 

                                                    In this phase the user identifies the need for a new or changes in old or an improved system in large organizations. This identification may be a part of system planning process. Information requirements of the organization as a whole are examined, and projects to meet these requirements are proactively identified. 

                                                 We can apply techniques like:

    1) Collecting data by about system by measuring things, counting things, survey or interview with workers, management, customers, and corporate partners to discover what these people know.

    2) observing the processes in action to see where problems lie and improvements can be made in workflow.

    3)Research similar systems elsewhere to see how similar problems have been addressed, test the existing system, study the workers in the organization and list the types of information the system needs to produce.

    2) Getting the idea about context of problem

    3) The processes - you need to know how data is transformed into information.

                       

    Analysis:-

    Once the problems identified, it is time to analyze the type of software that could answer the problems encountered. System analysis (may be by system analyst) will take a look at possible software. The goal of a system analysis is to know the properties and functions of software that would answer the concerns solicited from intended users.

    System Analysis would lead in determining the requirements needed in software. These requirements in software should be implemented otherwise the software may not answer the concerns or may lack in its usage. This stage will somehow determine how the software should function.

    It is the study of complete business system or parts of business system and application of information gained from that study to design,documentation and implementation of new or improved system. This field is closely related to operations research. An analyst work with users to determine the expectation of users from the proposed system.


    7.What are the types of LAN topologies? Explain with diagrams.5
    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.

      As we know there are many types topologies. 

    1.Bus topology
    2.Star topology
    3.Mesh topology
    4.Ring topology
    5.Star-ring topology
    6.Tree topology
    etc
    Here we are going to understand about two.
    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 database? List the major uses of database application software.
    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

    Major uses of DBMS.dataabse softwares are:

    Its roles can be listed as given below.

    1. provides an interface to the user as well as to application

    2. lets user to create,maintain databases.

    3. provides high integrity and security to its data.

    4. provides sharing facility to many users.

    5. provides relationships between tables.


    Or

    Differentiate between array and structure.1+4
    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;

    9.What is E-R diagram? Explain the advantages of E-R diagram in system design.1+4
    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:


    Advantages:-

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

    10.Explain the database model with suitable examples.5
    Ans:-
    We have different database models as given below.
    1.Hierarchical database model
    2.Network database model
    3.Relational Database model
    4.E-R model
    etc.
    Let's understand about fisrt two.

    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.

    Network model:-The 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


    11.What are the key challenges of implementing e-governance in developing countries?
    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.

    Challenges to implement e-governance:-

    challenges of implementing e-governance:-

    They are many challanges to implement e-governance in Nepal like countries beacuse of following reasons:

    1.Lack of strategic plans

    2 change management

    3.budget constraint

    4.weak infrastructure

    5. literacy

    6. lack of construction knowledge

    7. lacks of leadership supports

    8.security and privacy 

    etc

                                                                Or

    What is AI? Describe the application of AI.5
    Ans:
    Artificial Intelligence:-
    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

    12.What is multimedia? What are the components of multimedia? List out.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.Define computer crime and its various forms.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.
    Child pornography - Making or distributing child pornography.
    Cyber terrorism - Hacking, threats, and blackmailing towards a business or person.
    Cyberbully or Cyberstalking - Harassing others online.
    Creating Malware - Writing, creating, or distributing malware (e.g. viruses and spyware.)
    Denial of Service attack - Overloading a system with so many requests it cannot serve normal requests.
    Espionage - Spying on a person or business

    14.Write the advantages and disadvantages of OOP.5
    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.
    4) Functions that operate on the data are tied together in the data structure.

    Advantages of OOP:-
    • Modularity for easier troubleshooting. Something has gone wrong, and you have no idea where to look. ...
    • Reuse of code through inheritance. ...
    • Flexibility through polymorphism. ...
    • Effective problem solving.
    Dsiadvantages:
    • steep learning
    • more complex to create programs using some features polymorphism, inheritance etc
    • Large program size
    • slow execution etc

    15.Write short notes on :2.5+2.5

    a) Coaxial cable b) Satellite


    Ans:-
    coaxial cable:-
    • 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


    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