-->

HISSAN computer science question and solutions

 

HISSAN CENTRAL EXAMINATION - 2079 (2022) (Kathmandu)

Grade XII

Time : 2 hrs

COMPUTER SCIENCE [4281 M]

Full Marks: 50 (9 marks Obj +41 Marks sub)


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

Multiple choice questions [9×1=9]

Subject:-computer science

Time: 20 Minutes


GROUP A

Tick the correct answer.

1. Which of the statements are used in the DML statement?

a) Select, drop, where

b) Select, insert, delete

c) Select, drop, update

d) Select, insert, drop


2. With SQL, how do you select all the records from a table named "employee" where the value of column "ename" is "john"?

a)Select * from employee where ename is exactly john ;

b)Select * from employee where ename is equal to 'john' ;

c)Select * from employee where ename="john';

 d)Select * from employee where ename is not in john;





3. What is the first step in the software development lifecycle?

a) System design

b) System testing

c) Coding

d) System analysis


4. What is the minimum number of functions to be present in a C program?

a. 4 b. 1 c. 2 d. 3


5. What kind of transmission medium is most appropriate for carrying data in computer network that is exposed to electrical interference?

  1. Unshielded twisted pair  b. Optical fiber c. Coaxial cable d. Microwave


6. What should be the correct syntax to write a PHP code?

 a.< php >   b. <?php ?>   c. <? ?>    d. Php


7. Which jQuery method is used to hide selected elements? 

a. hidden()   b. display(none) c.hide()   d. visible(false)

8. Which Key is used to uniquely identifies a record?

a. Primary Key   b. Foreign Key   c. Both a. and b.  d. None of the mentioned

9. Which of the following is not an unguided communication media? 

a. Twisted pair wire   b. Satellite  c. Microwave   d. Bluetooth

GROUP B

Short answer questions: [5x5=25]

1. Explain INF and 2NF with examples.

OR

Demonstrate any three DDL statements with example. [5]

2. What is OOPS? Define the terms class, polymorphism and Object. [2+3]

3. What do you mean by feasibility study? Why is it necessary before designing a system?[2+3]

4. What is virtual reality? Explain. [5]

5. Write a function to multiply two numbers in javascript. [5]

OR

Write a PHP program to multiply two numbers. [5]


Group C

 Long answer questions [2x 8=16]

6. Define IP address. Explain any three different types of IP address. [2+6] 

7. Define structure. Write a C program to store information of 10 students (eid, ename, class) and display it using structure variable. [2+6]

Or


What is a pointer? Write a C program to read a 3 numbers and find its product using pointer.[2+6]


THE END

==================================================================================

Solutions



HISSAN CENTRAL EXAMINATION - 2079 (2022)

Grade XII

Time : 2 hrs

COMPUTER SCIENCE [4281 M]

Full Marks: 50 (9 marks Obj +41 Marks sub)


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

Multiple choice questions [9×1=9]

Subject:-computer science

Time: 20 Minutes


GROUP A

Tick the correct answer.

1. Which of the statements are used in DML statement?

a) Select, drop, where

b) Select, insert, delete

c) Select, drop, update

d) Select, insert, drop

Ans:-b) Select, insert, delete


2. With SQL, how do you select all the records from a table named "employee" where the value of column "ename" is "john"?

a)Select * from employee where ename is exactly john ;

b)Select * from employee where ename is equal to 'john' ;

c)Select * from employee where ename="john';

 d)Select * from employee where ename is not in john;


Ans:-c)Select * from employee where ename="john';



3. What is the first step in the software development lifecycle?

a) System design

b) System testing

c) Coding

d) System analysis

Ans:-

d) System analysis


4. What is the minimum number of functions to be present in a C program?

a. 4 b. 1 c. 2 d. 3

Ans:-

B. 1


5. What kind of transmission medium is most appropriate for carrying data in computer network that is exposed to electrical interference?

  1. Unshielded twisted pair  b. Optical fiber c. Coaxial cable d. Microwave

Ans:-

b. Optical fiber


6. What should be the correct syntax to write a PHP code?

 a.< php >   b. <?php ?>   c. <? ?>    d. Php

Ans:-

 b. <?php ?>


7. Which jQuery method is used to hide selected elements? 

a. hidden()   b. display(none) c.hide()   d. visible(false)

Ans:-

c.hide()

8. Which Key is used to uniquely identifies a record?

a. Primary Key   b. Foreign Key   c. Both a. and b.  d. None of the mentioned

Ans:-

a. Primary Key

9. Which of the following is not an unguided communication media? 

a. Twisted pair wire   b. Satellite  c. Microwave   d. Bluetooth

Ans:-

a. Twisted pair wire

GROUP B

Short answer questions: [5x5=25]

1. Explain INF and 2NF with examples.

Ans:-

1NF:-

A table is said to be in 1N if

1.There is no repeating group/field

2.Each cell contains atomic value.

Here atomic means single value  which further cannot be divided.

Example: Here we are taking an employee table.



Employee_no

Employee_name

department












employee_no

empployee_name

department

1

Rama

IT,security

2

Shyam

HR

3

Samana

Accountant


In this table, the department is storing two different values which are not atomic.

In this table we can see that first condition is fulfilled i.e.

->it contains no repeating field.

->Whereas the second is violated i.e. it contains two values for the same record. Let’s remove this by splitting the master table into following tables.

table:employee

employee_no

employee_name

1

Rama

2

Shyam

3

Samana


table:department

employee_no

department

1

IT

1

Security

2

HR

3

accountant

Here, each column is storing atomic values and there are no duplicates. Hence it is now in 1N.

2NF:-

A table is said to be in 2N if

1.it is in 1N

2.There is no column which is not dependent on key/primary key.

Or 

all non-key attributes are fully dependent on the primary key.

Example: Here, we are taking a table ‘location’.



customer_id

store_id

store_location

1

1

Mahabouddha

2

2

New road

3

3

Bagbazar

In this table we can see that first condition is fulfilled .

 ->The Location table possesses a composite primary key customer_id, store_id. The non-key attribute is store_location. In this case, store_location only depends on store_id, which is a part of the primary key. Hence, this table does not fulfill the second normal form. Lets remove this by changing above table into following tables.


table:customer

customer_id

store_id

1

1

2

2

3

3


table:store

store_id

store_location

1

Mahabouddha

2

New road

3

Bagbazar

Here we can see that the above tables are in 2N.


OR

Demonstrate any three DDL statements with example. [5]

Ans:-

DDL statements:- Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database. DDL is a set of SQL commands used to create, modify, and delete database structures but not data.

Examples: create,drop,comment,truncate etc.

Create:- It is used to create an object(table,database,index etc.) in a database.

Example: create table student(sid int primary key,sname varchar(100);

It creates a table named student.

DROP: This command is used to delete objects from the database.

Example: drop table student;

It deletes the table student.

ALTER: This is used to alter the structure of the database.

Example: alter table student add column age int;

It adds a new column ‘age’.


2. What is OOPS? Define the terms class, polymorphism and Object. [2+3]

Ans:-

OOPS:-

This is a programming paradigm that represents concepts as “objects” that have data

fields (attributes that describe the object) and associated procedures known as methods.

Objects, which are usually instances of classes, are used to interact with one another to

design application and computer programs.In this the programs are organized as collection of data members and methods. The method only can access that all members so all data are hidden.Addiiotnally, it also carries features such as inheritance,polymorphism etc.

Class:-

Generally, class is a category/group which is used to identify some people or things in this world. A class provides the structure of an object and defines a prototype of the object. A class also defines a set of attributes called properties, state and represented by variables. A set of associated behavior which is represented by methods or functions. Every class has three important things: name, attributes/features and operations/functions. 


Polymorphism:-

The term polymorphism is formed by the combination of two Greek words: poly (means many) and morph (means form) i.e. ability to take more than one form. An operator or function may display different behaviors (operation) in different instances. the behavior (operation) depends upon the types of data used in the operation. For ex: -* +' symbol for two numbers, the operator will generate a sum and if the operands are string (text) then the operator would produce a third string by concatenating two string. For example, 20+30 would return 50 and 'well' + 'come' would return welcome


Object:-

Everything around our self is object in OOP. Object is the basic run time entities in OOP which consists of data and functions. It may represent a person, place, bank account, table of data, or any item that the program has to handle. It stores data in variables.

Every object has two things: properties and behavior

Properties are also called as member/data/state

Behavior are also called as methods/member functions

Examples of object

Suppose dog is object and we are modeling it in software to solve problem: Dog's state

: name, color, breed, age

Dog's behavior: barking, sleeping, running, eating




3. What do you mean by feasibility study? Why is it necessary before designing a system?[2+3]

Ans:-

Feasibility study:-

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

Necessity of  feasibility study:-

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

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

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

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

  • Customer profile: Estimation of customers/revenues.

  • Determination of competitive advantage.

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

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

  • Vision/mission statement.


4. What is virtual reality? Explain. [5]

Ans:-

Virtual reality:-

Virtual Reality, or VR, is the use of computer technology to create a simulated environment which can be explored in 360 degrees.Virtual reality is a new computational paradigm that redefines the interface between human and computer, becomes a significant and universal technology and subsequently penetrates applications for education and learning.

 

Application fields of Virtual reality

Virtual Reality in the Military: 

A virtual reality simulation enables them to do so but without the risk of death or a serious injury. They can re-enact a particular scenario, for example engagement with an enemy in an environment in which they experience this but without the real world risks.

Virtual Reality in Education: 

Education is another area which has adopted virtual reality for teaching and learning situations. The advantage of this is that it enables large groups of students to interact with each other as well as within a three dimensional environment.

Virtual Reality in Healthcare: 

Healthcare is one of the biggest adopters of virtual reality which encompasses surgery simulation, phobia treatment, robotic surgery and skills training.

Virtual Reality in Business: 

Many businesses have embraced virtual reality as a cost effective way of developing a product or service. For example it enables them to test a prototype without having to develop several versions of this which can be time consuming and expensive.

Virtual Reality in Engineering: 

Virtual reality engineering includes the use of 3D modelling tools and visualization techniques as part of the design process. This technology enables engineers to view their project in 3D and gain a greater understanding of how it works. Plus they can spot any flaws or potential risks before implementation.


5. Write a function to multiply two numbers in javascript. [5]

Ans:-

<html>

<head>

<title>

Product of two numbers

</title>

<script type="text/javascript">

var number1,number2,product;

number1=prompt("enter first number");

number2=prompt("enter second number");

product=number1*number2;

document.write("product is="+product);

</script>

</head>

<body>

</body>

</html>


OR

Write a PHP program to multiply two numbers. [5]

Ans:-

<?php

if(isset($_POST['submit']))

{

$number1=$_REQUEST['number1'];

$number2=$_REQUEST['number2'];

$sum=$number1+$number2;

echo $sum;

}

?>

<form method="post">

first number:<input type="text" name="number1"><br>

second number:<input type="text" name="number2"><br>

<input type="submit" name="submit" value="click me"> 

</form>




Group C

 Long answer questions [2x 8=16]

6. Define IP address. Explain any three different types of IP address. [2+6] 

Ans:-

IP address:-

An IP address is a unique address that identifies a device on the internet or a local network. IP stands for "Internet Protocol," which is the set of rules governing the format of data sent via the internet or local network.

In essence, IP addresses are the identifier that allows information to be sent between devices on a network: they contain location information and make devices accessible for communication. The internet needs a way to differentiate between different computers, routers, and websites. IP addresses provide a way of doing so and form an essential part of how the internet works.

Types: Following are the types of IP

Private IP addresses

Every device that connects to our internet network has a private IP address. This includes computers, smartphones, and tablets but also any Bluetooth-enabled devices like speakers, printers, or smart TVs. With the growing internet of things, the number of private IP addresses we have at home is probably growing. our router needs a way to identify these items separately, and many items need a way to recognize each other. Therefore, our router generates private IP addresses that are unique identifiers for each device that differentiate them on the network.

Public IP addresses

A public IP address is the primary address associated with our whole network. While each connected device has its own IP address, they are also included within the main IP address for our network. As described above, our public IP address is provided to our router by our ISP. Typically, ISPs have a large pool of IP addresses that they distribute to their customers. our public IP address is the address that all the devices outside your internet network will use to recognize your network.

Public IP addresses come in two forms – dynamic and static.

Dynamic IP addresses

Dynamic IP addresses change automatically and regularly. ISPs buy a large pool of IP addresses and assign them automatically to their customers. Periodically, they re-assign them and put the older IP addresses back into the pool to be used for other customers. The rationale for this approach is to generate cost savings for the ISP. Automating the regular movement of IP addresses means they don’t have to carry out specific actions to re-establish a customer's IP address if they move home, for example. There are security benefits, too, because a changing IP address makes it harder for criminals to hack into our network interface.





7. Define structure. Write a C program to store information of 10 students (eid, ename, class) and display it using a structure variable. [2+6]

Or

Ans:-

Structure:-

Structure is a user defined data type available in C that allows to combine data items of different kinds.

Structures are used to represent a record. Suppose we want to keep track of your books in a library. we might want to track the following attributes about each book −

  • Title

  • Author

  • Subject

  • Book ID

For this, structure is helpful.

Features:-

  1. We can copy items of one structure to another using = operator.

  2. We can use structure in nested form.

  3. We can pass the entire structure to a function.

  4. We can create an array for a given structure.

Syntax:

structure tag name

{

Data type member 1;

Data type member2;

} variable;


Example: 

struct book

{

Char b_name[100];

Char b_authro[100];

float b_price;

}v;


Second part:-

/*  program to store information of 10 students (eid, ename, class) and display it using a structure variable.

*/

#include <stdio.h>

struct emp

{

    int eid;

    char ename[100];

    int grade;

}var[10];

int main()

{

    int i;

    printf("enter id,name and grade of students\n");

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

    {

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

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

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

    }

    printf(" id,name and grade of students are:\n");


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

    {

        printf("idl=%d,name=%s,grade=%d\n",var[i].eid,var[i].ename,var[i].egrade);    

    }

    return 0;

}


or


What is a pointer? Write a C program to read a 3 numbers and find its product using pointer.[2+6]

Ans:-

Pointer:-

A pointer is a variable which points to the address and not its value. with the help of pointer, we can

                       ->we can allocate memory dynamically

                       ->better memory management

                        ->passing of array and string to the functions more efficiently

                        ->it helps us to return more values etc.

example:

   int *k;

here , k is a pointer and will store the address of a variable.



Second part:-

//product of three numbers using pointer  

#include <stdio.h>                     

int main()

{

    int *p,*p1,*p2;                     

    int x,y,z;;                           

    printf("enter three numbers\n");

    scanf("%d%d%d",&x,&y,&z);                    

    p=&x,p1=&y,p2=&z;;                        

      printf("the product=%d\n",(*p)*(*p1)*(*p2)); 

    return 0;

}


THE END

==================================================================================





HISSAN CENTRAL EXAMINATION-2079 (2022)(Pokhara)

Class Xil

Time: 2:00 hrs

COMPUTER SCIENCE (4281)

F.M: 50

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: Multiple Choice Questions

Attempt ALL questions:

Tick (✔) the best alternative.


1. In hierarchical Model records are organized as

a. Table  b. Tree c. List  d.links

Ans:- b. tree

2. Wireless medium is also called…medium.

a. Guided  b. Unguided c. Unbounded d.Both b and c

Ans:- d. Both b and c

3. The… loop is also called an entry-controlled loop. 

A.while   b. do... while c. switch  d.for

Ans:-

  1. while

4. Which feature of C++ illustrated data wrapping facility? 

a. Class b. Abstraction c. Encapsulation d. Object 

Ans:- c. Encapsulation


5.Inside which HTML element do we put the JavaScript?

a. <head> b. <script> c. <meta>   d.<style>

Ans:-

b.<script>


6. C Programming was developed in....... . lab.

a. AT&T b. Bell   c. both a and b   d.Bill

Ans:- c.  both a and b

7. Radio broadcast system is an example of.......... Transmission.

a. Simplex  b.half  Duplex   c. full duplex  d. None of them


.Ans:-C. Full duplex


8. PHP's numerically indexes array begin with position.

a. 1   b. -1    c. 0      d. 2

Ans:- c. 0

9. Robot is derived from Czech word

a. Robata  b. Robota   c. Rebota   d. Ribota

Ans:- b. Robota



Group B: (5×5=25)

Short Questions Answer

Attempt all the questions.


10. What is a database? Explain the advantages of DBMS. [1+4]

Ans:-

Database:-

A database is information that is set up for easy access, management and updating. Computer databases typically store aggregations of data records or files that contain information, such as sales transactions, customer data, financials and product information.

Databases are used for storing, maintaining and accessing any sort of data. They collect information on people, places or things. That information is gathered in one place so that it can be observed and analyzed. Databases can be thought of as an organized collection of information.



DBMS:-

A Database Management System (DBMS) is characterized as the software framework that permits users to indicate, create, maintain and control access to the data set. The DBMS allows an end-user to create, read, update and erase required data in the dataset. DBMS works like a layer between the programs and data.

Following are some advantages of DBMS.

1. Data Integrity

Data integrity means data is consistent and accurate in the database. It is essential as there are multiple databases in DBMS. All these databases contain data which is visible to multiple users. Therefore, it is essential to ensure that data is consistent and correct in all databases for all users.

2. Data Security

Data security is a vital concept in a database. Only users authorized must be allowed to access the database and their identity must be authenticated using username and password. Unauthorized users shouldn’t be allowed to access the database under any circumstances as it violets the integrity constraints.

3.Faster Data Access

The database management system helps the users to produce quick answers to queries making data accessing accurate and faster.

For any given dataset, dbms can help in solving insightful financial queries like:

1. What is the bonus given to every salesperson in the last two months?

2. How many customers have a credit score or more than 800?

3. What is last year’s profit?

4. Better decision making


4.Recovery and Backup

DBMS automatically takes care of recovery and backup. The users are not required to take periodical backup as this is taken care of by DBMS. Besides, it also restores a database after a system failure or crash to prevent its previous condition.




OR

What is data security? How it can be implemented? [1+4]

Ans:-

Data security:-

Data security is the practice of protecting digital information from unauthorized access, corruption, or theft throughout its entire lifecycle. It’s a concept that encompasses every aspect of information security from the physical security of hardware and storage devices to administrative and access controls, as well as the logical security of software applications. It also includes organizational policies and procedures.

To implement security to our database, we have to use following techniques.

1.Encryption

Using an algorithm to transform normal text characters into an unreadable format, encryption keys scramble data so that only authorized users can read it.  File and database encryption solutions serve as a final line of defense for sensitive volumes by obscuring their contents through encryption or tokenization. Most solutions also include security key management capabilities.

2.Backups

Maintaining usable, thoroughly tested backup copies of all critical data is a core component of any robust data security strategy. In addition, all backups should be subject to the same physical and logical security controls that govern access to the primary databases and core systems.


3.Physical security of servers and user devices

Regardless of whether your data is stored on-premises, in a corporate data center, or in the public cloud, you need to ensure that facilities are secured against intruders and have adequate fire suppression measures and climate controls in place. A cloud provider will assume responsibility for these protective measures on your behalf.


4.Network Firewalls

Network firewalls are digital blockades that protect private data by filtering traffic and stopping unauthorized access.

            It can also prevent malicious software from infecting a computer. This is a common line of defense that              hardens an organization’s data security.



11. Describe the Bus and Star topology with suitable diagram advantages and disadvantages.[5]

Ans:-

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



12. What is JavaScript? Explain three different ways using which user can add JavaScript into web pages. Explain any two. [1+2+2] 

Ans:-

Javascript:-

JavaScript is a lightweight programming language that web developers commonly use to create more dynamic interactions when developing web pages, applications, servers, and or even games.

Developers generally use JavaScript alongside HTML and CSS The scripting language works well with CSS in formatting HTML elements. However, JavaScript still maintains user interaction, something that CSS cannot do by itself.

Second part:-

There are three ways to use JS code in our web pages. They are:

  1. Internal JS codes

  2. Inline JS codes

  3. External codes

Let’s understand internal and external types:-

Internal JS codes:-

JavaScript can be added directly to the HTML file by writing the code inside the <script> tag . We can place the <script> tag either inside <head> or the <body> tag according to the need. Here is an example.

<html>

<head>

<title>

Internal JS

</title>

<script>

function j()

{

var a=8,b=90;

console.log(a+b);

}

</script>

</head>

<body>

<button onclick=”j()”>click me</button>

</body>

</html>

Here the JS code inside the script tag is called internal JS.

External JS:-

External JavaScript is simply writing the JavaScript part of the HTML webpage in a separate file and then linking that file using the “src” attribute of the <script> tag. Thus, the word “external” as the JavaScript is placed inside a file that is not part of the original HTML document.


Example: Let’s take the same example as given above.

Step 1: We will write the JS code in a separate file and save with an extension js. Suppose the following code is saved in script.js file.

function j()

{

var a=8,b=90;

console.log(a+b);

}

Step 2:

 Suppose the following HTML file.

<html>

<head>

<title>

Internal JS

</title>

<script src=”script.js”>

</head>

<body>

<button onclick=”j()”>click me</button>

</body>

</html>

As we open this page in the browser, it communicates the JS file for JS code.




13. What is a user defined function? WAP to input length, breadth of a pond and find its area by using user-defined function. [1+4]

Ans:-

User defined function:-

It is a function or a separate block of code with its own variables and processes defined by the user themselves. To use this we do not need to look for particular header file in the program. A program can have many such user defined functions depending upon the need. We may use this function with or without return statements.

Example:-

int sum(int,int)

{

    ……;

In this function we have used two parameters with return value of integer type.


Second part:-

/* input length, breadth of a pond and find its area by using user-defined function.

*/

#include <stdio.h>

float area();

int main()

{

    

    printf("the area of pond is=%f",area());

    return 0;

}

float area()

{

    float l,b;

    printf("enter l and b of pond\n");

    scanf("%f%f",&l,&b);

    return l*b;

}




OR

What is OOP? Explain the elements of OOP. [1+4]

Ans:-

OOPS:-

This is a programming paradigm that represents concepts as “objects” that have data

fields (attributes that describe the object) and associated procedures known as methods.

Objects, which are usually instances of classes, are used to interact with one another to

design application and computer programs.In this the programs are organized as collection of data members and methods. The method only can access that all members so all data are hidden.Addiiotnally, it also carries features such as inheritance,polymorphism etc.

Object:-

Everything around our self is object in OOP. Object is the basic run time entities in OOP which consists of data and functions. It may represent a person, place, bank account, table of data, or any item that the program has to handle. It stores data in variables.

Every object has two things: properties and behavior

Properties are also called as member/data/state

Behavior are also called as methods/member functions

Examples of object

Suppose dog is object and we are modeling it in software to solve problem: Dog's state

: name, color, breed, age

Dog's behavior: barking, sleeping, running, eating


Class:-

Generally, class is a category/group which is used to identify some people or things in this world. A class provides the structure of an object and defines a prototype of the object. A class also defines a set of attributes called properties, state and represented by variables. A set of associated behavior which is represented by methods or functions. Every class has three important things: name, attributes/features and operations/functions. 


Polymorphism:-

The term polymorphism is formed by the combination of two Greek words: poly (means many) and morph (means form) i.e. ability to take more than one form. An operator or function may display different behaviors (operation) in different instances. the behavior (operation) depends upon the types of data used in the operation. For ex: -* +' symbol for two numbers, the operator will generate a sum and if the operands are string (text) then the operator would produce a third string by concatenating two string. For example, 20+30 would return 50 and 'well' + 'come' would return welcome

Inheritance:-

Inheritance  is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is an important part of OOPs (Object Oriented programming system).

The idea behind inheritance  is that we can create new classes that are built upon existing classes. When we inherit from an existing class, we can reuse methods and fields of the parent class. Moreover, we can add new methods and fields in our current class also. There are different types of inheritance as given here.

  1. Single inheritance 2. Multiple inheritance  3. Multilevel inheritance  4.hierarchical inheritance 5 hybrid inheritance



14. What is agile development? Explain the principles of agile development. [1+4]

Ans:-

Agile development:-

Agile is an iterative approach to project management and software development that helps teams deliver value to their customers faster and with fewer headaches. Instead of betting everything on a "big bang" launch, an agile team delivers work in small, but consumable, increments. Requirements, plans, and results are evaluated continuously so teams have a natural mechanism for responding to change quickly. 


principles of agile development:- 

Though there are many principles we apply in Agile projects development, here we are going to discuss some.


  1. Customer satisfaction:

The original formulation of the first of the Agile principles says, "our highest priority is to satisfy the customer through early and continuous delivery of valuable software". However, it is perfectly applicable in areas outside of software development. 

As you can see, customer satisfaction sits on top of the 12 principles. Early and continuous delivery increases the likelihood of meeting customer's demands and contributes to the generation of faster ROI(return on investment).

  1. Welcome the changing requirement:

Still, if need be, change requests should be most welcome even at the late stages of project execution. The original text of the second of the Agile principles states that your team needs to "welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage". In traditional project management, any late-stage changes are taken with a grain of salt as this usually means scope creep and thus higher costs. However, Agile teams aim to embrace uncertainty and acknowledge that even a late change can still bear a lot of value to the end customer. Due to the nature of Agile's iterative process, teams shouldn't have a problem responding to those changes in a timely fashion.


  1. Trusting Individual Team Members:

As a project manager or leader, it’s vital to have team members that you can trust. Not only are they trusted to keep any company secrets, but they need to be reliable and dependable enough to meet their obligations – regardless of any tight deadlines or changing requirements. The Agile methodology takes this trust even further by encouraging project managers to structure their projects around the strengths of individual team members. By providing the tools, direction, and support needed, the best project managers can empower their teams and ensure success before a project has even begun.

4. Learning on a Continuous Basis:

The final Agile principle requires your team to embrace new ideas and learn new concepts whenever they have the chance. Moreover, it calls for your team members to adjust their professional strategies in an effort to become more effective and productive over the course of time. Project managers should also be open to continuous learning. Even the most experienced leaders can pick up new habits and trends from the younger generation of professionals, so it’s important that they’re receptive to these ideas and willing to adapt when needed.






Group-C (8x2-16)

Attempt any TWO questions

Long Answer Questions

15. What is cloud computing? Explain the types of cloud computing and cloud services.[2+6]

Ans:-

Cloud computing:-

Cloud computing is the delivery of different services through the Internet. These resources include tools and applications like data storage, servers, databases, networking, and software.

Rather than keeping files on a proprietary hard drive or local storage device, cloud-based storage makes it possible to save them to a remote database. As long as an electronic device has access to the web, it has access to the data and the software programs to run it.

Cloud computing is a popular option for people and businesses for a number of reasons including cost savings, increased productivity, speed and efficiency, performance, and security.


Types of cloud computing and services:-

There are four main types of cloud computing: private clouds, public clouds, hybrid clouds, and multi clouds. Similarly, there are also three main types of cloud computing services: Infrastructure-as-a-Service (IaaS), Platforms-as-a-Service (PaaS), and Software-as-a-Service (SaaS).

Let’s know in detail about any two  of them.


Private cloud:-

As the name suggests, private clouds are cloud environments exclusively dedicated to a single group, entity, or user set behind the customer's firewall. Any cloud located in an IT infrastructure isolated from the public and dedicated to one client (one person or a group) is automatically considered a private cloud. Private cloud offerings include HPE, VMWare, IBM/Red Hat, and OVHcloud.

Private clouds aren’t limited to on-site IT infrastructures these days. Clients can build private clouds on off-site, rented, vendor-owned data centers. As a result, private clouds now have two sub-categories:dedicated clouds and managed private clouds.

Public clouds:-

Public clouds are cloud environments typically created from IT infrastructure not owned by the end user. Some of the largest public cloud providers include Alibaba Cloud, Amazon Web Services (AWS), Google Cloud, IBM Cloud, and Microsoft Azure.

Traditional public clouds always ran off-premises, but today's public cloud providers have started offering cloud services on clients’ on-premise data centers. This has made location and ownership distinctions obsolete.


A public cloud is a cloud service offered to multiple customers by a cloud provider. Like all cloud services, a public cloud service runs on remote servers that a provider manages. Customers of that provider access those services over the Internet.

Infrastructure-as-a-Service (IaaS):-

This acronym is short for Infrastructure as a Service. The cloud service provider manages the entire infrastructure (e.g., data storage, the actual servers, network, virtualization). The customer gains access with a dashboard or API. So, the user handles the OS, applications, and middleware, and the provider deals with the hardware (e.g., hardware, networking, hard drives, data storage, and servers), and takes care of hardware issues, outages, and repairs, much like a landlord takes care of an apartment’s maintenance. Example:Rackspace, Amazon Web Services (AWS) Elastic Compute Cloud (EC2), Microsoft Azure, Google Compute Engine (GCE)


Platforms-as-a-Service (PaaS):-


PaaS means the hardware and an application-software platform are provided and managed by an outside cloud service provider, but the user handles the apps running on top of the platform and the data the app relies on. Primarily for developers and programmers, PaaS gives users a shared cloud platform for application development and management (an important DevOps component) without having to build and maintain the infrastructure usually associated with the process. Example:AWS Elastic Beanstalk. Windows Azure. Heroku,Facebook



Or

What is SQL? Explain any three types of SQL with example. [2+6]

Ans:-

SQL:-

Structured query language (SQL) is a programming language for storing and processing information in a relational database. A relational database stores information in tabular form, with rows and columns representing different data attributes and the various relationships between the data values. We can use SQL statements to store, update, remove, search, and retrieve information from the database. We can also use SQL to maintain and optimize database performance.

Three types of SQL commands with examples are given below.


Create:- It is used to create an object(table,database,index etc.) in a database.

Example: create table student(sid int primary key,sname varchar(100);

It creates a table named student.

DROP: This command is used to delete objects from the database.

Example: drop table student;

It deletes the table student.

ALTER: This is used to alter the structure of the database.

Example: alter table student add column age int;

It adds a new column ‘age’.




16. What is a loop? Explain one type of loop with an example.  WAP which finds the sum, difference and product of 2 numbers using switch case statement. [2+2+4]

Ans:-

Loop:-

It means execution of different statements/blocks again and again repeatedly under certain conditions. When the condition becomes false, the execution stops. This is called iteration or looping.

Example:

for(int i=1;i<=5;i++)

{

printf(“hello loop\n”);

}

Output:

hello loop

hello loop

hello loop

hello loop

hello loop


As we can see that we get output ‘hello loop’ five times. When the value of i exceeds 5, it stops.


Second part:-

Basically there are three types of loop. They are for,while and do…while. Let’s understand about while loop in detail.

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.

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:

Example:-

 int i=1;

    while(i>=10)

    {

        printf("I love my country");

        i++;

    }

third part:-

//program to find the sum or difference or product of two numbers using switch.

#include <stdio.h>

#include<stdlib.h>

int main()

{

    int a,b,choice,output;

    printf("enter two numbers\n");

    scanf("%d%d",&a,&b);

    printf("we have following choices\n");

    printf("1 for addition\n");

    printf("2 for subtraction\n");

    printf("3 for multiplication\n");

    printf("any other number for exit\n");

    printf("now,enter your choice\n");

    scanf("%d",&choice);

    switch(choice)

    {

        case 1:

            output=a+b;

            break;

        case 2:

            output=a-b;

            break;

        case 3:

            output=a*b;

            break;

        default:

            printf("not a valid choice");

            exit(0);       

    }

    printf("the result is %d",output);

    return 0;

}





17. What do you mean by random access to a file? WAP to enter name, post and age, address and salary of an employee and add it in a file "Emp.txt". [2+6]


Ans:-

Random access file:-

These files enable us to read or write any data in our disk file without reading or writing every piece of data before it. In a random-access file, we may quickly search for data, edit it or even remove it. We can open and close random access files in C, same as sequential files with the same opening mode, but we need a few new functions to access files randomly. This extra effort pays off flexibility, power, and disk access speed. 

Random access files permit nonsequential, or random, access to a file's contents. To access a file randomly, we open the file, seek a particular location, and read from or write to that file.

There are three functions which help in using the random access file in C:

  1. fseek()

  2. ftell()

  3. rewind()

Second part:-

/*C program to enter name, post and age, address and salary of an employee and add it in a file "Emp.txt".

*/

#include <stdio.h>

#include<conio.h>

struct employee                          

{

      char employee_name[50];

      char employee_address[50];

      char employee_post[100];

      int employee_age;

      float employee_salary;

    

}var;                                    

int main()

{

FILE *k;                                  

char choice;                        

k=fopen("emp.txt","w");             

do

{

printf("enter  employee name\n");  

scanf("%s",var.employee_name);

printf("enter  employee address\n");  

scanf("%s",var.employee_address);

printf("enter employee post\n");

scanf("%s",var.employee_post);

printf("enter employee age\n");

scanf("%d",&var.employee_age);

printf("enter employee salary\n");

scanf("%f",&var.employee_salary);

fprintf(k,"%s %s

%s%d%f\n",var.employee_name,var.employee_address,var.employee_post,employee_age,employee_salary);

printf("want to continue (y/n):=\n");

choice=getche();                     

}while(choice!='n');        

printf("\n writing process completed successfully\n");

fclose(k);                                              

printf("-----------------------\n");

return 0;

}




***BEST OF LUCK***








No comments:

Post a Comment