Tuesday, January 28, 2014

HSEB – Grade XII (2013) (Computer Science) Solved Questions

Leave a Comment
Group ‘A’
Long Answer
Q1) What is control statement? Describe ‘Sequence’, ‘Selection’ and ‘Loop’ with flow chart and example.

Answer:
Control Statement: Control statements enable us to specify the flow of program control; i.e., the order in which the instructions in a program must be executed. They make it possible to make decisions, to perform tasks repeatedly or to jump from one section of code to another.  The if else Statement, switch Statement, Loops, while Loop, do while Loop, for Loop, break Statement, continue Statement and goto Statement are the examples of control statements.
There are four types of control statements in C:
         Decision making statements

         Selection statements

         Iteration statements

         Jump statements
Sequence: A sequence point defines any point in a computer program's execution at which it is guaranteed that all effects of previous evaluations will have been performed. They are often mentioned in reference to C, because the result of some expressions can depend on the order of evaluation of their sub-expressions. Adding one or more sequence points is one method of ensuring a consistent result, because this restricts the possible orders of evaluation.



Selection: selection also called a decision, one of the three basic logic structures in c programming. The other two logic structures are sequence and loop. In a selection structure, a question is asked, and depending on the answer, the program takes one of two courses of action, after which the program moves on to the next event. 


Loop: 'A loop' is a part of code of a program which is executed repeatedly. A loop is used using condition. The repetition is done until condition becomes condition true. A loop declaration and execution can be done in following ways:
⦁             Check condition to start a loop
⦁             Initialize loop with declaring a variable.
⦁             Executing statements inside loop.
⦁             Increment or decrement of value of a variable.

 



Q2) Write a program which reads name of 20 employees and sort them in alphabetic order.

Answer:
#include "stdio.h"
#include "string.h"
#include "conio.h"
void main()
{
      int i,j;
      char name[20][20],temp[20];
      for(i=0;i<20;i++)
      {
       printf("Enter the name of %dth person:\n",i+1);
       scanf("%s",&name[i]);
      }
      printf("\n The names in original order are:\n");
      for(i=0;i<20;i++)
      {
       printf("%d.%s\n",i+1,name[i]);
      }
      for(i=0;i<20-1;i++)
      {
            for(j=i+1;j<20;j++)
            {
                  if(strcmp(name[i],name[j])>0 )
                  {
                     strcpy(temp,name[i]);
                     strcpy(name[i],name[j]);
                     strcpy(name[j],temp);
                   }
              }
        }

      printf("\n\nThe names in alphabetical order are:\n");
      for(i=0;i<20;i++)
      {
        printf("%d.%s\n",i+1,name[i]);
      }
 getch();
 }


Q3) Differentiate between structure and union with suitable examples.

Answer:
Structure: Structure is a method of packing the data of different types. When we require using a collection of different data items of different data types in that situation we can use a structure. A structure is used as a method of handling a group of related data items of different data types.
Example:
#include "stdio.h"

#include "conio.h"

struct comp_info

{

char nm[100];

char addr[100];

}info;

void main()

{

clrscr();

printf("\n Enter Company Name : ");

gets(info.nm);

printf("\n Enter Address : ");

gets(info.addr);

printf("\n\n Company Name : %s",info.nm);

printf("\n\n Address : %s",info.addr);

getch();

}
Union: Union is user defined data type used to stored data under unique variable name at single memory location. Union is similar to that of structure. Syntax of union is similar to structure. But the major difference between structure and union is 'storage.' In structures, each member has its own storage location, whereas all the members of union use the same location. Union contains many members of different types, it can handle only one member at a time. To declare union data type, 'union' keyword is used. Union holds value for one data type which requires larger storage among their members.
Example:
#include "stdio.h"

#include "conio.h"
union techno

{

int id;

char nm[50];

}tch;

void main()

{

clrscr();

printf("\n\t Enter developer id : ");

scanf("%d", &amp;tch.id);

printf("\n\n\t Enter developer name : ");

scanf("%s", tch.nm);

printf("\n\n Developer ID : %d", tch.id);//Garbage

printf("\n\n Developed By : %s", tch.nm);

getch();

}

Q4) What is recursion? Write a program to calculate factorial value of given number using recursive function.

Answer:
Recursion is a programming technique that allows the programmer to express operations in terms of themselves. In C, this takes the form of a function that calls itself. A useful way to think of recursive functions is to imagine them as a process being performed where one of the instructions is to "repeat the process". This makes it sound very similar to a loop because it repeats the same code, and in some ways it is similar to looping. On the other hand, recursion makes it easier to express ideas in which the result of the recursive call is necessary to complete the task.
Example:
#include "stdio.h"

#include "conio.h"

int fact(int);

void main()

{

  int num,f;

  printf("\nEnter a number: ");

  scanf("%d",&num);

  f=fact(num);

  printf("\nFactorial of %d is: %d",num,f);

  }

int fact(int n)

{

   if(n==1)

       return 1;

   else

       return(n*fact(n-1));

 }

Q5) Write a program which reads name, department and age from a file named "Employee.dat" and display them.

Answer:
#include "stdio.h"

#include "conio.h"
void main()
{
  FILE *f;
  char ch;
  f=fopen("employee.txt","r");
  while( ( ch = fgetc(f) ) != EOF )
  printf("%c",ch);
  fclose(f);
  getch();
}



Group ‘B’
Short Answer Questions

Q6) What is system? Explain the basic elements of system.
Answer:
A System may be defined as orderly grouping of interdependent components linked together according to a plan to achieve a specific goal. Each component is a part of total system and it has to do its own share of work for the system to achieve the desired goal.
Purpose, Boundary, Environment, Inputs, and Outputs are some important terms related to Systems.
• A System’s purpose is the reason for its existence and the reference point for measuring its success.
• A System’s boundary defines what is inside the system and what is outside.
• A System Environment is everything pertinent to the System that is outside of its boundaries.
• A System’s Inputs are the physical objects and information that cross the boundary to enter it from its environment.
• A system’s Outputs are the physical objects and information that go from the system into its environment.

Q7) Who is system analyst? List out the roles of system analyst.
Answer:
Systems analyst who designs an information system is the same as an architect of a house. Three groups of people are involved in developing information systems for organizations. They are managers, users of the systems and computer programmers who implement systems. The systems analyst coordinates the efforts of all these groups to effectively develop and operate computer based information systems. Systems analysts develop information systems. For this task, they must know about concepts of systems. They must be involved in all the phases of system development life cycle. It mainly consists of four phases: System Analysis, System Design, System Construction &amp; Implementation and System Support. Every phase consist of inputs, tasks and outputs.
Roles of system analyst:
Change Agent: The analyst may be viewed as an agent of change.
Investigator and Monitor: A systems analyst may investigate the existing system to find the reasons for its failure.
Architect: The analyst’s role as an architect is liaison between the user’s logical design requirements and the detailed physical system design.
Psychologist: In system development, systems are built around people.
Motivator: System acceptance is achieved through user participation in its development, effective user training and proper motivation to use the system.
Intermediary: In implementing a candidate system, the analyst tries to appease all parties involved.

Q8) Differentiate between DBMS and RDBMS with examples.
Answer:
DBMS
A Database Management System (DBMS) is a set of computer programs that controls the creation, maintenance, and the use of the database in a computer platform or of an organization and its end users. A DBMS is a system software package that helps the use of integrated collection of data records and files known as databases. It allows different user application programs to easily access the same database. Example: Perl, Python, IMS etc..
RDBMS
A Relational Database Management System (RDBMS) is a Database Management System (DBMS) that is based on the relational model. RDBMS is a DBMS in which data is stored in the form of tables and the relationship among the data is also stored in the form of tables. Example: Microsoft SQL Server, Oracle, Access, DB2 etc..

Q9) Describe the data types which are used in C programming.
Answer:
Followings are the most commonly used data types in C.

Q10) Describe the types of network topologies with clear diagram.
Answer:
Network topologies are:
Bus Topology:
In local area networks where bus topology is used, each node is connected to a single cable. Each computer or server is connected to the single bus cable. A signal from the source travels in both directions to all machines connected on the bus cable until it finds the intended recipient. If the machine address does not match the intended address for the data, the machine ignores the data. Alternatively, if the data does match the machine address, the data is accepted.

Star Topology:
Star networks are one of the most common computer network topologies. In its simplest form, a star network consists of one central switch, hub or computer, which acts as a conduit to transmit messages.
This consists of a central node, to which all other nodes are connected; this central node provides a common connection point for all nodes through a hub.

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. Because a ring topology provides only one pathway between any two nodes, ring networks may be disrupted by the failure of a single link. A node failure or cable break might isolate every node attached to the ring

Tree Topology:
The type of network topology in which a central 'root' node (the top level of the hierarchy) is connected to one or more other nodes that are one level lower in the hierarchy (i.e., the second level) with a point-to-point link between each of the second level nodes and the top level central 'root' node, while each of the second level nodes that are connected to the top level central 'root' node will also have one or more other nodes that are one level lower in the hierarchy (i.e., the third level) connected to it, also with a point-to-point link, the top level central 'root' node being the only node that has no other node above it in the hierarchy (The hierarchy of the tree is symmetrical.) Each node in the network having a specific fixed number, of nodes connected to it at the next lower level in the hierarchy, the number, being referred to as the 'branching factor' of the hierarchical tree. This tree has individual peripheral nodes.

Mesh topology:
Mesh networking (topology) is a type of networking where each node must not only capture and disseminate its own data, but also serve as a relay for other nodes, that is, it must collaborate to propagate the data in the network. A mesh network can be designed using a flooding technique or a routing technique. When using a routing technique, the message is propagated along a path, by hopping from node to node until the destination is reached. To ensure all its paths' availability, a routing network must allow for continuous connections and reconfiguration around broken or blocked paths, using self-healing algorithms. A mesh network whose nodes are all connected to each other is a fully connected network. Mesh networks can be seen as one type of ad hoc network.


Q11) Explain polymorphism and inheritance with example.
Answer:
Polymorphism:
Polymorphism – means the ability of a single variable of a given type to be used to reference objects of different types, and automatically call the method that is specific to the type of object the variable references. In a nutshell, polymorphism is a bottom-up method call. The benefit of polymorphism is that it is very easy to add new classes of derived objects without breaking the calling code that uses the polymorphic classes or interfaces.

Inheritance:
Inheritance – is the inclusion of behavior (i.e. methods) and state (i.e. variables) of a base class in a derived class so that they are accessible in that derived class. The key benefit of Inheritance is that it provides the formal mechanism for code reuse. Any shared piece of business logic can be moved from the derived class into the base class as part of refactoring process to improve maintainability of your code by avoiding code duplication. The existing class is called the super class and the derived class is called the subclass. Inheritance can also be defined as the process whereby one object acquires characteristics from one or more other objects the same way children acquire characteristics from their parents.
Example:
#include "iostream.h"
class   vehicle
{
int    wheels;
float  weight;
public:
void  message(void)
{
cout<<"Vehicle message, from vehicle, the base class\n";
}
};
class  car : public  vehicle
{
int   passenger_load;
public:
void   message(void)    // second message()
{
cout<<"Car message, from car, the vehicle derived class\n";
}
};
class  truck : public  vehicle
{
int  passenger_load;
float   payload;
public:
int  passengers(void)
{
return  passenger_load;
}
};
class  boat : public  vehicle
{
int  passenger_load;
public:
int  passengers(void) {return  passenger_load;}
void  message(void)     // third message()
{
cout<<"Boat message, from boat, the vehicle derived class\n";
}
};
int  main()
{
vehicle  unicycle;
car      sedan_car;
truck    trailer;
 boat     sailboat;
unicycle.message();
sedan_car.message();
trailer.message();
sailboat.message();
// base and derived object assignment
unicycle = sedan_car;    
unicycle.message();
return 0;
}

Q12) Describe computer crime and its various forms.
Answer:
Computer crimes:
Computer crime, or Cyber crime, refers to any crime that involves a computer and a network. The computer may have been used in the commission of a crime, or it may be the target. Net crime refers, more precisely, to criminal exploitation of the Internet. Physical presence is not essential for the cyber-crime to take a place. The requirements to commit Cyber Crimes are few, compared to the possible repercussions caused and easy to get as programs and software are available on the Internet. Such crimes generate threats to the nation’s security and the personal financial health Issues surrounding this type of crime have become high‐profile, particularly those surrounding cracking, copyright infringement, child pornography, and child grooming. There are also problems of privacy when confidential information is lost or intercepted, lawfully or otherwise.
Forms of Cyber Crime
⦁             Cyber Crime has various forms which may include
⦁             hacking (illegal intrusion into a computer system without the permission of owner),
⦁             phishing (pulling out the confidential information from the bank or financial institutional account holders by deceptive means),
⦁             spoofing (getting one computer on a network to pretend to have the identity of another computer in order to gain access to the network),
⦁             cyber stalking (following the victim by sending e-mails or entering the chat rooms frequently),
⦁             cyber defamation (sending e-mails to all concerned or posting on websites, the text containing defamatory matters about the victim),
⦁             threatening (sending threatening e-mails to victim),
⦁             salami attacks (making insignificant changes which go unnoticed by the victim),
⦁             net extortion,
⦁             pornography (transmitting lascivious material),
⦁             software piracy (illegal copying of the genuine software), email bombing,
⦁             virus dissemination (sending malicious software which attaches itself to other software),
⦁             IPR theft, identity theft, data theft, etc.

Q13) List out the advantages and disadvantages of multimedia.
Answer:
Advantages of multimedia:
⦁      Increases learning effectiveness.
⦁      Is more appealing over traditional, lecture-based learning methods.
⦁      Offers significant potential in improving personal communications, education and training efforts.
⦁      Reduces training costs.
⦁      Is easy to use.
⦁      Tailors information to the individual.
⦁      Provides high-quality video images &amp; audio.
⦁      Offers system portability.
⦁      Frees the teacher from routine tasks.
⦁      Gathers information about the study results of the student.

Disadvantages of multimedia:
⦁      Expensive
⦁      Not always easy to configure
⦁      Requires special hardware
⦁      Not always compatible

Q14) What are the objectives of e-governance? Explain.
Answer:
E-Governance implies technology driven governance. 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-Citizens, Government-to-Business, Government-to-Government as well as back office processes and interactions within the entire government frame work. Through the e-Governance, the government services will be made available to the citizens in a convenient, efficient and transparent manner. The three main target groups that can be distinguished in governance concepts are Government, citizens and businesses/interest groups. In e-Governance there are no distinct boundaries. Generally four basic models are available: Government to Customer (Citizen), Government to Employees, Government to Government and Government to Business.

Q15) Write short notes on:
a)      Normalization
Answer:
Database normalization is the process of organizing the fields and tables of a relational database to minimize redundancy and dependency. Normalization usually involves dividing large tables into smaller (and less redundant) tables and defining relationships between them. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database using the defined relationships.
b)      Expert system
Answer:
In artificial intelligence, an expert system is a computer system that emulates the decision-making ability of a human expert. Expert systems are designed to solve complex problems by reasoning about knowledge, like an expert, and not by following the procedure of a developer as is the case in conventional programming. An expert system has a unique structure, different from traditional computer programming. It is divided into two parts, one fixed, independent of the expert system: the inference engine, and one variable: the knowledge base. To run an expert system, the engine reasons about the knowledge base like a human.


***Thank you*** 

0 comments:

Post a Comment