Friday, January 5, 2024

2.1 Database Management System - SEE COMPUTER SCIENCE 2080






Database Management System - SEE COMPUTER SCIENCE 2080

Data

Data are raw form of any facts, figures or entities which does not give any meaning.

For example, Aaradhya, 1000, account, balance etc. are raw data individually does not give any meaning.

 

Information

Information is the organized collection of inter-related data which has significant meaning.

For example, Aaradhya has 1000 balance in his bank account gives significant meaning.

 

Database

A collection of systematically organized inter-related data is called a database. The purpose of data base is to store, organize and retrieve data. E.g. Dictionary, Marks Ledger, Telephone Directory, Attendance Register etc.

 

Database can be computerized and non-computerized (manual).

The database which is managed in file or ledger without using computer system is called manual database (non-computerized).

The database which is managed by using computer system is called computerized database.

 

Difference between computerized and non-computerized database

Computerized Database

Non-Computerized Database

It can store large volume of data.

It is limited by physical storage available.

We can search data very easily.

It can take a while to manually search through all of the records.


DBMS (Database management system)

DBMS is a computerized system that stores data, processes them and provides information in an organized form. E.g. MS-Access, Oracle,  MySQL, Fox Pro etc.

 

Advantages of DBMS

a)     It reduces data redundancy which means duplication of data.

b)     It allows multiple users to access the same data simultaneously.

c)     Large volume of data can be stored and updated easily.

d)     It provides high security of data as well as maintains accurate database.

 

RDBMS (Relational Database Management System)
RDBMS is a type of DBMS that uses a relational model to organize and manage data, allowing users to easily retrieve and manipulate it. E.g.: MySQL, Oracle, MS Access etc.

 

MS-Access

MS-Access is a relational database management system developed by Microsoft Corporation which is used to store and manipulates large volume of data in multiple tables.

 

Features of MS-Access:

a)     It provides the flexible ways to add, edit, delete and display the related data.

b)     Queries help to view, change and analyse the data indifferent ways.

c)     Forms are used for viewing and editing the information.

d)     Reports are used for summarizing and printing the data.

 

 

 

 

Record (Tuple)

A record is a row in a table which contains information about single items in a database. Record is complete set of information.

 

Field (Attributes)

A field is a column in a table which contains information about a certain type for all records. Field is a smallest unit of information.

Value

A value is the each specific piece of information in a table.

 

Symbol_No

Name

Address

Class

25612

Ram Thapa

Kathmandu

10

25617

Shyam Shrestha

Dhading

8

25635

Rita Dhungel

Pokhara

10

 

Fields are : Symbol_No, Name, Address and Class

Records are : 25612,  Ram Thapa,  Kathmandu, 10 ; 25617, Shyam Shrestha, Dhading, 8 ; 25635, Rita Dhungel, Pokhara, 10

Values are: 25612, 25617, 25635, Ram Thapa, Shyam Shrestha, Rita Dhungel, Kathmandu, Dhading, Pokhara, 10, 8, 10.

 

Data type  

Data type is an attribute for a field that determines the type of data that can be stored in that field.

 

Data types of MS-Access:

Data Type

Description

Maximum Data / Space

Default Field Size

Text

Used for text or combinations of text and numbers, as well as numbers those don't require calculations, such as phone numbers

Up to 255 Characters

255

Memo

Lengthy text or combinations of text and numbers.

Up to 64,000 / 65535 Characters

 

Number

Used for data to be included in mathematical calculations.

1,2,4 or 8 Bytes

Long Integer

Date/Time

Used for dates and time data

8 Bytes

 

Currency

Used for currency values.

8 Bytes

 

Auto Number

Used for unique sequential (incrementing by 1).

4 Bytes

 

Yes/No

Used for data that can be only one of two possible values, such as Yes/No (Boolean values)

1 Bit

 

 

 

 

 

OLE Object

Used for OLE objects (such as MS[1]Word documents, MS-Excel spread sheets, pictures, sounds)

Up to about 1 GB

 

Hyperlink

Used for hyperlinks

Up to 2048 Characters

 

Attachments

To attach any supported type of file

Up to about 2 GB

 

Lookup Wizard

Used to create a field that allows you to choose a value from another table

Dependent on the data type of the lookup field

 

 

Field Properties

Field properties are settings or attributes that allow users to control various aspects of data entry, validation, formatting, and behavior within the database.

 

Field Properties

Description

Field Size

Field size is a field property which is used to set the maximum size for data stored in the field that is set to the Text or Number data type.

Caption

Caption is a field property which gives alternative name given for any field.

The maximum size for this is 2048 characters.

Default Value

Default Value is a field property that is displayed automatically for the field when we add a new record to the table.

Format

Format is a field property that allows to display data in a format different from the way it is actually stored in a table.

Input Mask

Input mask is a field property that controls the value of a record and sets in a specific format.

Validation Rule

Validation Rule is a field property which is used to limit the values that can be entered into a field.

Validation Text

Validation Text is a field property which displays an error message that appears if the data entered is invalid according to the specified validation rule.

Required

Required is a field property which is used to specify whether a value is required in a field or not.

Indexed

Indexed is a field property which speeds up searching and sorting of records based on a field.

 

Objects of Ms Access

Table, Form, Query, Report, Pages, Macros, and Modules

 

Table

Tables are the primary building block of database which stores and manages large volume of data into rows and column.

 

Importance of table

·       Tables store and organize data efficiently, reducing data redundancy and inconsistencies.

·       Tables enable the use of data validation rules to ensure data accuracy and completeness.

·       Tables are essential for creating forms, queries, and reports that extract useful insights and information from data.

·       Tables provide security features to restrict access to sensitive data and ensure data privacy.

 

Methods to create table

Design view

Datasheet view

Using wizard

 

Design View – Related with table structure. We can add, edit or delete field and its properties.

Datasheet View – Related with records. We can add, modify, search or delete records.

 

 

 

 

Form

Form is one of the MS-Access database objects which provides graphical interface to view, modify and add data in a table or multiple linked tables.

 

Importance of form

·       Forms provide an easy-to-use interface for data entry and manipulation, improving data accuracy and completeness.

·       Forms can include validation rules to ensure data quality and prevent errors.

·       Forms enable users to customize the look and feel of data input screens.

·       Forms can be linked to other objects, such as tables or queries, to simplify data management.

 

Methods to create form

Design view

Using wizard

 

Report

Report is one of the MS-Access database objects used to present information in an effective and organized format that is ready for printing.

 

Importance of report

·       Reports provide a formatted presentation of data that is easy to read and understand.

·       Reports enable users to summarize, analyze, and visualize data in meaningful ways.

·       Reports can be exported or printed for sharing with others.

·       Reports can be based on tables, queries, or other reports, providing flexibility and ease of use.

 

Why is Report created?

Reports are created in MS Access to present data from one or more tables in a formatted and organized manner, allowing users to easily view and analyze the information.

 

The data sources for report are table and query

 

Methods to create report

Design view

Using wizard

 

Query

Query is an object of database that is used to view, retrieve, change and analyze records from a table or multiple linked tables based on specified condition.

Queries can be used to filter data, to perform calculations with data, and to summarize data.

 

Its types are select query and action query.

Select query is a type of query which is used to select and display the relevant data from the database.

Action query is a query that makes changes to or removes many records in just one operation.

Examples of action query are update query and delete query.

An update query is a type of query that makes entire changes to a record or group of records in one or more tables

A delete query is a type of query that deletes a record or group of records from one or more tables.

An append query is a type of action query used to add records from one or more tables or queries to another table, based on specified criteria or selection rules.

A make-table query is a type of query used to create a new table based on the results of a select query.

 

Advantages of query

·       Queries enable users to retrieve specific data from tables or other data sources, based on specified criteria.

·       Queries allow users to filter, sort, and group data in meaningful ways.

·       Queries enable users to perform calculations and aggregate functions on data to extract useful insights.

·       Queries can be used to create reports and forms that extract meaningful information from data.

 

Methods to create query

Design view

Using wizard

 

Sorting

The process of arranging all the records in a table either ascending or descending order based on field or fields is known as sorting. Sorted data is easier to handle than unsorted data.

 

The advantages of sorting are:

·       Sorting helps to organize data and make it easier to find and retrieve specific information.

·       Sorting can save time and improve efficiency by allowing users to quickly access the data they need.

 

Filtering

Filtering is the process of viewing required record of a table that matches the specifies criteria.

 

Primary key

A primary key is a field or combination of fields in a table that uniquely identifies each record, and is used to establish relationships between tables and enforce data integrity.

The primary key does not accept duplicate value for a field and it does not allow a user to leave the field blank or null.

 

Importance of primary key

It sets the relationship between tables.

It reduces and controls duplication of record in a table

 

Foreign key

A foreign key in MS Access is a field that establishes a relationship between two tables by referencing the primary key of another table.

 

Composite Key

Composite Key is the group of primary key that consists of two or more attributes.

 

Data Redundancy

·       Data redundancy is the duplication of data within a database.

·       Data redundancy can be controlled by normalizing the database, eliminating duplicate data and storing it in separate tables, and using foreign keys to establish relationships between the tables.

 

Relationship

A relationship refers to the association or connection between two tables based on a common field or fields. Its types are:
i) One to one relationship
ii) One to many relationship
iii) Many to many relationship

 

Wednesday, January 3, 2024

SOLVED KAVRE PABSON - SEE PRE QUALIFYING EXAMINATION 2080 - COMPUTER SCIENCE

 





SOLVED KAVRE PABSON - SEE PRE QUALIFYING EXAMINATION 2080 - COMPUTER SCIENCE

Subject :Computer Science

Time: 1 hr. 30 min

Full Marks:50

Class: X

Group-A

1. Very short answer questions:

 

a) What is communication?

Ans: Communication is sending and receiving information between two or more persons.

 

b) Which data type is used to store picture in Ms-Access?

Ans: The data type which is used to store picture in Ms-Access is OLE.

 

c) Define computer security.

Ans: Computer security means protecting computer and its content from damage, theft or misuse and action to prevent such incidents

 

d) What is E-commerce?

Ans: E-commerce refers to the buying and selling of goods or services using the internet.

 

e) What is formal parameter?

Ans: Parameters are variables that will receive data (arguments value) sent to the procedures (SUB program and FUNCTION).

 

f) Define C-programming.

Ans: C language is a structured programming language that divides program into many functions.

 

2. Write appropriate technical terms for the following:                          [2×1=2]

 

a) The mode of data communication in which data can be transferred in both directions at a time.

Full Duplex Mode

 

b) A unique numerical identifier for every device or network that connects to the internet. IP Address

 

3. Write down the full form of the following:                                                        [2×1=2]

 

a) SMTP - Simple Mail Transfer Protocol.

b) MODEM - Modulator-Demodulator.

 

Group-B

 

4. Short Answer Questions: 9×2=18

 

a) Distinguish between STP and UTP.

Ans: The difference between shielded and unshielded twisted pair cables are:

STP

UTP

UTP cable is a twisted pair cable with wires that are twisted together

It is enclosed within a foil or mesh shield.

the UTP cable is used to establish the connection within a short distance, like a home or small industry.

Generally, it is used to establish the connection for enterprises over a long distance.

b) Explain about star topology with the help of diagram.

Ans:

The network topology which connects all nodes to central device called hub/switch through a cable is called star topology. It provides fast performance and low network traffic. The failure of one node does not affect the rest of the nodes.

Diagram

Image result for star topology

 

c) Write about opportunities and threats in social media.

Ans:

Opportunities of using social media

a)     It creates awareness and innovate the way people live

b)     Social media let us share anything with others around the world.

c)     It keeps us informed about the world.

d)     It creates brand exposure for business to the largest audience.

Threats of using social media

a)     Personal data and privacy can be easily hacked and shared on the internet.

b)     More chances of creating fake accounts.

c)     Negative impact on the health.

d)     Decrease the working efficiency of people.

e)     Spreading false or unreliable information.

 

d) Define table in a database? Explain why it is important.

Ans: Table is a database object that stores a collection of related data organized in rows and columns, where each row represents a record and each column represents a field or attribute of that record.

It is important because entire data is managed and kept in a table for the future retrieval process. It makes sure that the information stays accurate and consistent.

 

e) Distinguish between validation rule and validation text.

Ans: The difference between validation rule and validation text is

Validation Rule

Validation Text

A rule that specifies the valid values or ranges of values that can be entered in the field.

A message that appears if a user enters invalid data in the field.

 

 

f) What is an online payment (electronic payment)? Make a list most common payment platforms used in Nepal.

Ans; Online payment refers to the payment for buying goods or services through the Internet using different online payment gateway. E.g. e-Sewa Nepal, i-Pay, Khalti, e-banking, etc.

 

g) "Artificial Intelligence is threat to humans". Give your opinion.

Ans: AI can be a threats to human. AI could become uncontrollable and pose a threat to humanity. This could happen if AI systems become more intelligent than humans and begin to act on their own, without human guidance or control. AI could be used for bad things like cyber attacks or making weapons that can decide on their own who to attack, causing a lot of harm. It's like giving a sharp knife to a toddler - bad idea

 

h) What is global variable? How it is declared?

Ans: Variables which are declared outside the procedure and whose values can be accessed from any procedure or module are called global variables.  It is declared by using SHARED, DIM SHARED or COMMON SHARED statement.

 

i) Define built in function? Explain about the use of LEN() function in QBASIC.

Ans: Built-in functions are  readymade functions provided by QBASIC. LEN ( ) function returns the number of characters in a string or the number of bytes required to store a variable.


5. Write down the output of the following program with dry run table.

DECLARE SUB REG(M,N$,T)

CLS

A=1

X$=”PABSON”

CALL REG(A,X$,T)

END

SUB REG(M,N$,T)

FOR I=LEN(N$) TO 1 STEP-1

PRINT MID$(N$,I,M)

M=M+1

NEXT I

END SUB

 

Dry Run

A

X$

M

T

I=LEN(N$) TO 1 STEP-1

 PRINT MID$(N$,I,M)

1

PABSON

1

0

6 TO 1 STEP-1 Yes

MID$(PABSON,6,1)

N

 

 

2

 

5 TO 1 STEP -1 Yes

MID$(PABSON,5,1)

ON

 

 

3

 

4 TO 1 STEP -1 Yes

MID$(PABSON,4,1)

SON

 

 

4

 

3 TO 1 STEP -1 Yes

MID$(PABSON,3,1)

BSON

 

 

5

 

2 TO 1 STEP -1 Yes

MID$(PABSON,2,1)

ABSON

 

 

6

 

1 TO 1 STEP -1 Yes

MID$(PABSON,1,1)

PABSON

 

 

7

 

0 TO 1 STEP -1 No

 Loop Exits

 

The output of the program is :

N

ON

SON

BSON

ABSON

PABSON

 

 

 

 

 

6. Re-Write the given program after correcting the bugs:

 

DECLARE FUNCTION RESULT$(X,Y)

CLS

INPUT “Enter marks in math:”, M

R$=RESULT$(X,N)

PRINT M$

END FUNCTION

 

FUNCTION RESULT$(X,Y)

IF X>=40 AND Y>=40 THEN

RESULT$ = "Pass"

ELSE

RESULT$ = "Fail"

END IF

END SUB

 

Debugged Program

DECLARE FUNCTION RESULT$(X,Y)

CLS

INPUT “Enter marks in math and science:”, M, N

R$=RESULT$(M,N)

PRINT R$

END

 

FUNCTION RESULT$(X,Y)

IF X>=40 AND Y>=40 THEN

RESULT$ = "Pass"

ELSE

RESULT$ = "Fail"

END IF

END FUNCTION

 

7. Study the following program and answer the given questions:

 

DECLARE FUNCTION MATH$(R)

CLS

DIM SHARED P

INPUT "Enter first number:"; P

INPUT "Enter second number:"; C

Y$ = MATH$(C)

PRINT Y$

END

 

FUNCTION MATH$(R)

F=100 MOD R

IF 20 MOD P > 3 AND F < P THEN

MATH$=”True”

ELSE

MATH$=”False”

END IF

END FUNCTION

a) Variable P remained uncalled in the main module. Why?

Ans: Variable P remained uncalled in the main module because P is declared as global variable and its value can be accessed by MATHS$ ( ) function without passing the value.

 

b) Find the output if the user supplies P=9 and c=4 running the program.

Ans: The output of the program if the user supplies P=9 and c=4 running the program is:

False

 

Dry Run

P

C

R

F=100 MOD R

20 MOD P > 3 AND

F < P

PRINT Y$

9

4

4

100 MOD 4

=0

20 MOD 9 >3

2>3 AND 0<9

Yes AND No

No

False

 

Group-C

 

8. Convert as instructed:

 

a) (B7D)16=(?)8

b) (645)10=(?)16

c) (10101)2 ×(110)2

d) (1110101)2 × (110)2

 

9. a) Write a program in QBASIC to input length and breadth of a rectangle and calculate area using function-procedure and perimeter using sub-procedure.[4]

 

DECLARE FUNCTION AREA (L, B)

DECLARE SUB PER (L, B)

 

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

PRINT “AREA OF RECTANGLE=”; AREA(L,B)

CALL PER(L,B)

END

 

FUNCTION AREA (L, B)

AREA = L * B

END FUNCTION

 

 

SUB PER (L, B)

P = 2 * (L + B)

PRINT “PERIMETER OF RECTANGLE=”;P

END SUB

 

 

 

 

 

b) A sequential data file named “user.dat” has data under the fields [ Name, Age, Sex, Contact No and Address ]. Write a program that displays the record of those users whose age is more than 35.   [4]

 

OPEN “user.dat” FOR INPUT AS #1

CLS

PRINT “Name”, “Age”, “Sex”, “Contact No.”, “Address”

WHILE NOT EOF(1)

INPUT #1, N$, A, S$, C, D$

IF A>35 THEN PRINT N$, A, S$, C, D$

WEND

CLOSE #1

END

 

 

 

10. Write a C program to find sum of the numbers from 22 to 32 using FOR loop.

 

#include <stdio.h>

int main ( )

{

   int i, sum = 0;

   for (i = 22; i <= 32; i++) {

       sum += i; 

   }

   printf("The sum of the numbers from 22 to 32 is: %d\n", sum);

   return 0;

}

 

 

Write a program in C that asks a number and check whether it is positive, negative or zero.

 

#include <stdio.h>

int main()

{

    int number;

    printf("Enter a number: ");

    scanf("%d", &number);

    if (number > 0)

{

        printf("%d is positive\n", number);

    }

else if (number < 0)

{

        printf("%d is negative\n", number);

    }

else

{

        printf("%d is zero\n", number);

    }

 

    return 0;

}