-->

HISSAN 2073 computer science questions and solutions

 

HISSAN CENTRAL EXAMINARION -2073 (2017)

Grade: XII

Full  Marks : 75

Time: 3 hrs

Pass Marks: 27

COMPUTER SCIENCE (230 M1)

Candidates are required to give their answers in their own words as far as practicable. The figures in the margin indicate full marks.

Group A

Long Answer Questions



Attempt any FOUR questions: [4x10=40]

1.a) Which characters comprise the C character set? Explain identifiers and keywords with

examples. [2+3]

Ans:-
Following are the set of character used in c language.
1.alphabetical letters(small and capital)
2.Digits (From 0 to 9)
3.Other characters such as ?,;, etc
Identifier:-
Identifiers are the names given to program units such as variable, structure, function etc. They are not defined in the programming language but are used to define by the programmer. Some basic rules to define identifiers are given below.

First character must be an alphabet or (underscore)
It must consist of only letters, digits and underscore.
Any standard C language keyword cannot be used as an identifier name.
It should not contain a white space.
It allows both upper case and lower case characters.
Valid Identifiers
A1 B34 FIRST _NAME x_1
Invalid Identifiers
1A 34AB int void FIRST-NAME x.1Keyword:-

Keywords:-
There are certain words which are reserved by the C compiler. These words are known as keywords. They cannot be used as identifiers in the program. Mainly there are 32 keywords used in standard C language.

auto

double

int

struct

break

else

long

switch

case

enum

register

typedef

char

extern

return

union


etc
b) What is function prototype? Write a program to check whether entered number is even or

odd using function. [1+4]
Ans:-
Function:-
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
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

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:-
/* program to know a number is even or odd using function*/
#include<stdio.h>
void even_odd();
int main()
{
    even_odd();
    return 0;
}
void even_odd()
{
  int n;
  printf("enter a number\n");
  scanf("%d",&n);
  if(n%2==0)
  {
         printf("%d is an even number",n);
  }
 else
 {
                 printf("%d is an odd number",n);
}
}


2.Explain the term network topology. Explain different types of network topologies with neat diagram along with its advantages and disadvantages. [2+8]
Ans:-
Network topology:
Network topology is the arrangement of the elements of a communication network. Network topology can be used to define or describe the arrangement of various types of telecommunication networks, including command and control radio networks, industrial fieldbusses and computer networks.
Basically, ring topology is divided into the two types which are Bidirectional and Unidirectional. Most Ring Topologies allow packets to only move in one direction, known as a one-way unidirectional ring network. Others allow data to go, either way, called bidirectional.

Thourgh we have many types of topologies, here we are going to understand about four.

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.


Ring topology:
A ring network is a network topology in which each node connects to exactly two other nodes, forming a single continuous pathway for signals through each node – a ring. Data travels from node to node, with each node along the way handling every packet.


Advantages of Ring topology:

  • Reduced chances of data collision as each node release a data packet after receiving the token.
  • Token passing makes ring topology perform better than bus topology under heavy traffic.
  • No need of server to control connectivity among the nodes.10. Describe the wireless network system. List out deices and equipment necessary for Wi-Fi network. 3+2
disadvantages:-
1.It is difficult to find the problem.
2.To add extra noe or computer, we have to di-assemble entire networks.
3.It is expensive
4.Shutting down of one node leads entire networking to be down.

Mesh topology:-

  • The mesh topology incorporates a unique network design in which each computer on the network connects to every other, creating a point-to-point connection between every device on the network. The purpose of the mesh design is to provide a high level of redundancy.

  • It needs/uses n(n-1)/2 channels(paths) and n-1 input/ output ports.

  •  If one network cable fails, the data always has an alternative path to get to its destination. Figure 6 shows the mesh topology.

  • As you can see from Figure 6, the wiring for a mesh network can be very complicated. 

  • It is used mostly in telephone network.This allows computer to balance the load by providing alternative paths. It creates a redundant point-to-point network connection between only specific network devices. 


Figure 6. Mesh topology.


Advantages

Disadvantages

Provides redundant paths between devices

Requires more cable than the other LAN topologies.

The network can be expanded without disruption to current users.

more devices needed.


3.a) Write a C program that reads marks of 10 students and print out the top five. [2+3]
Ans:-
 

/* Write a C program that reads marks of 10 students and print out the top five.    [2+3]*/

#include <stdio.h>

int main()

{

    float total_marks[10];

    int i,j,k;

    printf("Enter marks\n");

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

    {

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

    }

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

    {

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

        {

            if(total_marks[i]>total_marks[j])

            {

                k=total_marks[i];

                total_marks[i]=total_marks[j];

                total_marks[j]=k;

            }

        }

    }

    printf("top 5 marks are\n");

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

    {

        printf("%f\n",total_marks[i]);

    }

    return 0;

}

 



b) Write a C program that takes a string from the user and convert all the characters into lowercase if they are in upper case and vice versa. [1+4]

Ans:-

/*Write a C program that takes a string from the user and convert all the characters into

lowercase if they are in upper case and vice versa.

*/

#include <stdio.h>

#include<ctype.h>

int main()

{

    char string[100];

    int i;

    printf("enter a string in upper case or lower case\n");

    gets(string);

    for(i=0;string[i]!='\0';i++)

    {

        if(string[i]>='A' && string[i]<='Z')

        {

            printf("%c",tolower(string[i]));

        }

        else if(string[i]>='a' && string[i]<='z')

        {

            printf("%c",toupper(string[i]));

        }

        else

        {

            printf("%c",string[i]);

        }

    }

    return 0;

}


4.Draw a flowchart and write C program to generate Fibonacci series up to nth term. [5+5]
Ans:-
Flowchart for Fibonacci series:









c program:-

/*To generate fibonacci series upto nth term*/

#include <stdio.h>

int main()

{

    int nth,first_term,second_term,next,i;

    printf("enter first term\n");

    scanf("%d",&first_term);

    printf("enter second term\n");

    scanf("%d",&second_term);

    printf("enter nth term as total  term\n");

    scanf("%d",&nth);

    printf("%d,%d,",first_term,second_term);

    for(i=1;i<=nth;i++)

    {

        next=first_term+second_term;

        printf("%d,",next);

        first_term=second_term;

        second_term=next;

    }

 

    return 0;

}


5.Write a C program to enter name, address, phone number and salary of 10 persons and store them n a file named “employee.dat” and display the information from the file. [10]
Ans:-
/* Write a program to store name, address,phone number and salary  of 10 persons
to file name employee.dat and read and display .*/

#include<stdio.h>

int main()

{

FILE *fp;

char name[30],address[30];

int phone,i;
float salary;

fp=fopen("employee.dat","w");

printf("Enter name, address,phone and salary of an employee");
for(i=1;i<=10;i++)
{
scanf("%s%s%d%f",name,address,&phone,&salary);
fprintf(fp,"\n %s\t %s\t %d\t%f",name,address,phone,salary);
}
fclose(fp);
printf("we are going to read records\n records are\n");
fp=fopen("employee.dat","r");
while(fscanf(fp," %s %s %d %f",name,address,&phone,&salary)!=EOF)
{
printf("\n name=%s\t address=%s\t phone number=%d and salary=%f",name,address,phone,salary);
}
fclose(fp);
return 0;
}

Group B

Short Answer Questions



Attempt any SEVEN questions: [7x5=35]
6.What is normalization? Explain normalization process with examples.
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.


7.What is data security? How it can be implemented.
Ans:-

Data security:-

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

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

8.Explain the term encapsulation and inheritance.
Ans:-

Encapsulation

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


Inheritance:

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


9.Describe computer ethics and computer crime.
Ans:-
Computer ethics:-
Computer ethics are a set of moral standards that govern the use, development and management of information and communication technology. Such is the society's views about the use of computers. Privacy concerns, intellectual property rights and effects on the society are some of the common issues of computer ethics. 
Some commandments:

·                     Do not use a computer to harm other people.

·                     Do not use a computer to interfere with other people's work.

·                     Do not spy on another person's computer data.

·                     Do not use a computer to steal information.

·                     Do not spread misinformation by using computer technology.

·                     Do not use or copy software for which you have not paid.


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

10.What is multimedia? List and explain components of multimedia.
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.

11.Differentiate between for, while and do-while loop.
Ans:-

For loop:-

Definition:-

It is the most common type of loop which is used to execute a program statement or block of program statements repeatedly for a specified number of times. It is a definite loop. Mainly it consists of three expressions: initialization, condition and increment / decrement. The initialization defines the loop starting point, condition defines the loop stopping points and counter helps to increment and decrement the value of counter variable.


Syntax of for Loop:

for(initialization;condition;increment/decrement )

{
statements;
}
Flowchart:-

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

while loop:-
In the while loop, condition is checked in the beginning..It is also known as a pre-test or entry control loop.It is not terminated with a semicolon.In the while loop, statements are not executed if the condition is false.It uses the keyword ‘while’.

The syntax of while loop is as follows:

initialization;

while(condition)

{

  statements;

  increment/decrement;

}

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



Do..while loop:-
In the do while loop, condition is checked at the end.It is also known as post-test or exit control loop.It is terminated with a semicolon.In the do while loop, statements are executed once even the condition is false.

The syntax of do-while loop is as follows:

initialization;

do

 {

  statements;

  increment/decrement;

 }while(condition);


12.What is e-commerce? Explain B2B and B2C.
Ans:-
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 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
  • Gathering and using demographic data through web contacts and social media

B2B:-
Business-to-business is a situation where one business makes a commercial transaction with another. This typically occurs when: A business is sourcing materials for their production process for output, i.e. providing raw material to the other company that will produce output. 

B2C:-

short for business-to-consumer -- is a retail model where products move directly from a business to the end user who has purchased the goods or service for personal use. It is often contrasted with the B2B (business-to-business) model, which involves exchanging goods and services between businesses instead of between businesses and consumers.

The term B2C is applicable to any business transaction where the consumer directly receives goods or services -- such as retail stores, restaurants and doctor's offices. Most often it refers to e-commerce businesses, which use online platforms to connect their products with consumers.

13.Write C program to generate following pattern:

*****

****

***

**

*

Ans:-

#include <stdio.h>

int main()

{

    int i,j;

    for(i=5;i>=1;i--)

    {

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

        {

            printf("*");

        }

        printf("\n");

    }

    return 0;

}

14.Write short notes on any TWO:

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

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

 b) Context Diagram:-

A diagram which shows internal as well external entities,their interaction,flow,processes in and outside the system is called context diagram. It is a top level diagram. It shows the relationship between different components. It also can be said ‘0’ level data flow diagram.This ‘0’ level says us an outline or surficial view/overview of system.The context diagram answers the first and most essential question about our requirements: Who needs to use this system? How many are (entities) engaged in the system? We simply use one process with several surrounded entities. It uses symbols like,

Rectangle---->says about entity

Circle : Represent the system in terms of a single process,

Arrows : Show data flow



Here, we can see interconnection of different units (entities) with a process. It’s a context diagram of a college where we can get many parts and processes. I have shown only three units (entities). If we break this then we can have many other processes which come under DFD (data flow diagram level 1 and 2).
Some other examples can be l
c) Robotics:-
Robotics is an interdisciplinary field that integrates computer science and engineering. Robotics involves design, construction, operation, and use of robots. The goal of robotics is to design machines that can help and assist humans.
5 Primary Areas of Robotics are:
  • Operator interface.
  • Mobility or locomotion.
  • Manipulators & Effectors.
  • Programming.
  • Sensing & Perception.

 

 

THE END


 

No comments:

Post a Comment