Class12 Database Concepts Notes
Class12 Database Concepts Notes
Database approach –
1. Data Redundancy – Data redundancy is the storing of the same data across many files. Space would be
wasted as a result of this.
2. Data Inconsistency – If a file is modified, all the files that contain comparable information must also be
updated, or the data will become inconsistent.
3. Lack of Data Integration – Because data files are unique, it is very challenging to obtain information from
various files.
Relational Database
A collection of data elements with per-established relationships between them make up a relational database.
These things are arranged in a series of tables with rows and columns. To store data about the things that will be
represented in the database, tables are utilized.
Employee
Name Emp_ID Gender Salary DOB
Neha 1121 F 20000 4/3/1990
Paras 2134 M 25000 19/10/1993
Himani 3145 F 20000 23/11/1992
3
In relational model,
A row is called a Tuple.
A column is called an Attribute.
A table is called as a Relation.
The data type of values in each column is called the Domain.
The number of attributes in a relation is called the Degree of a relation.
The number of rows in a relation is called the Carnality of a relation.
Create a Database –
Create Table Command –
4
Question 2.> Create Table using NOT NULL – An attribute value may not be permitted to be NULL.
CREATE TABLE TEACHER
(
Teacher_ID INTEGER,
First_NameVARCHAR(20) NOT NULL,
Last_NameVARCHAR(20),
Gender CHAR(1),
Salary DECIMAL(10,2),
Date_of_Birth DATE,
Dept_No INTEGER
);
Question 3.> Create Table using DEFAULT – If a user has not entered a value for an attribute, then
default value specified while creating the table.
CREATE TABLE TEACHER
(
Teacher_ID INTEGER,
First_Name VARCHAR(20) NOT NULL,
Last_Name VARCHAR(20),
Gender CHAR(1),
Salary DECIMAL(10,2) DEFAULT 40000,
Date_of_Birth DATE,
Dept_No INTEGER
);
Question 4.>Create a Table using CHECK – In order to restrict the values of an attribute within a range,
CHECK constraint may be used.
CREATE TABLE TEACHER
(
Teacher_ID INTEGER,
First_Name VARCHAR(20) NOT NULL,
Last_Name VARCHAR(20),
Gender CHAR(1),
Salary DECIMAL(10,2) DEFAULT 40000,
Date_of_Birth DATE,
Dept_No INTEGER CHECK (Dept_No<=110)
);
5
Question 5.>Create a Table using KEY CONSTRAINT – Primary Key of a table can be specified in two
ways. If the primary key of the table consist of a single attribute, then the corresponding attribute can be
declared primary key along with its description.
CREATE TABLE TEACHER
(
Teacher_ID INTEGER PRIMARY KEY,
First_Name VARCHAR(20) NOT NULL,
Last_Name VARCHAR(20),
Gender CHAR(1),
Salary DECIMAL(10,2) DEFAULT 40000,
Date_of_Birth DATE,
Dept_No INTEGER
);
Question 6.>Create a Table using REFERENTIAL INTEGRITY CONSTRAINT – This constraint is
specified by using the foreign key clause.
CREATE TABLE Teacher
(
Teacher_ID INTEGER PRIMARY KEY,
First_Name VARCHAR(20) NOT NULL,
Last_Name VARCHAR(20),
Gender CHAR(1),
Salary DECIMAL(10,2) DEFAULT 40000,
Date_of_Birth DATE,
Dept_No INTEGER,
FOREIGN KEY (Dept_No) REFERENCES Department(Dept_ID)
);
1. Naming of Constraint
In the Create Table command, constraints can be named. The benefit is that using the Alter Table command,
specified restrictions can be quickly altered or deleted. When naming a constraint, use the keyword
CONSTRAINT followed by the constraint’s name and its specification.
Dropping a column – A column can be dropped using this command but one must specify the options
(RESTRICT or CASCADE) for the drop behavior. RESTRICT would not let the column be dropped if it is
being referenced in other tables and CASCADE would drop the constraint associated with this column in this
relation as well as all the constraints that refer this column.
ALTER TABLE Teacher DROP Dept_No CASCADE;
Dropping keys – A foreign key/primary key/key can be dropped by using ALTER TABLE command.
ALTER TABLE Teacher DROP FOREIGN KEY TEACHER_FK;
Adding a Constraint – If you want to add the foreign key constraint TEACHER_FK back, then the command
would be –
ALTER TABLE Teacher ADD CONSTRAINT TEACHER_FK FOREIGN KEY (Dept_No) REFERENCES
Department(Dept_ID) ON DELETE SET NULL ON UPDATE SET NULL;
4. Insert Command
This command is used to insert a tuple in a relation. We must specify the name of the relation in which tuple is
to be inserted and the values. The values must be in the same order as specified during the Create Table
command. For example, consider the following table Teacher:
CREATE TABLE Teacher
(
Teacher_ID INTEGER,
First_Name VARCHAR(20) NOT NULL,
Last_Name VARCHAR(20),
Gender CHAR(1),
Salary DECIMAL(10,2) DEFAULT 40000,
Date_of_Birth DATE,
Dept_No INTEGER,
CONSTRAINT TEACHER_PK PRIMARY KEY (Teacher_ID),
);
To insert a tuple in the Teacher table INSERT command can be used as shown below:
INSERT INTO Teacher VALUES (101,”Shanaya”, “Batra”, ‘F’, 50000, ‘1984-08-11’, 1);
[Link] Command
This command is used to update the attribute values of one or more tuples in a table.
UPDATE Teacher
SET Salary=55000
WHERE Teacher_ID=101;
[Link] Command
In order to delete one or more tuples, DELETE command is used.
DELETE FROM Teacher
WHERE Teacher_ID=101;
[Link] Command
The SELECT Command is used to retrieve information from a database.
SELECT <attribute list>
FROM <table list>
WHERE <condition>
Teacher table
7
Teacher_ID First_Name Last_Name Gender Salary Date_of_Birth Dept_No
101 Shanaya Batra F 50000 1984-08-11 1
102 Alice Walton F 48000 1983-02-12 3
103 Surbhi Bansal F 34000 1985-06-11 4
104 Megha Khanna F 38000 1979-04-06 4
105 Tarannum Malik F 54000 1978-04-22 5
106 Tarun Mehta M 50000 1980-08-21 2
107 Puneet NULL M 52500 1976-09-25 3
108 Namit Gupta M 49750 1981-10-19 1
109 Neha Singh F 49000 1984-07-30 7
110 Divya Chaudhary F 39000 1983-12-11 6
111 Saurbh Pant M 40000 1982-01-05 8
112 Sumita Arora F 40000 1981-09-09 9
113 Vinita Ghosh F 51500 1980-09-09 9
114 Vansh NULL M 53500 1982-05-04 2
1. Query – To retrieve all the information about Teacher with ID=101. In this query we have to specify all the
attributes in the SELECT clause. An easier way to do this is to use asterisk (*), which means all the attributes.
SELECT *
FROM Teacher
WHERE Teacher_ID=101;
Output –
Teacher_ID First_Name Last_Name Gender Salary Date_of_Birth Dept_No
101 Shanaya Batra F 50000 1984-08-11 1
2. Query – To find the names of all teachers earning more than 50000.
SELECT First_Name,Last_Name
FROM Teacher
WHERE salary > 50000;
Output –
First_Name Last_Name
Tarannum Malik
Puneet NULL
Vinita Ghosh
Vansh NULL
3. Query – To display Teacher_ID,First_Name,Last_Name and Dept_No of teachers who belongs to
department number 4 or 7.
SELECT Teacher_ID,First_Name,Last_Name, Dept_No
FROM Teacher
WHERE Dept_No = 4 OR Dept_No = 7;
Output –
Teacher_ID First_Name Last_Name Dept_No
103 Surbhi Bansal 4
104 Megha Khanna 4
109 Neha Singh 7
4. Query – To retrieve names of all the teachers and the names and numbers of their respective departments.
Note that the above query requires two tables – Teacher and Department. Consider the following query:
8
SELECT First_Name, Last_Name, Dept_ID, Dept_Name
FROM Teacher, Department;
5. Query – To retrieve names of all the teachers who belong to Hindi department.
SELECT First_Name, Last_Name
FROM Teacher, Department
WHERE Department. Dept_ID=Teacher. Dept_ID AND
Dept_Name=”Hindi”;
First_Name Last_Name
Surbhi Bansal
Megha Khanna
6. Query – To retrieve names of all the teachers starting from letter ‘S’.
SELECT First_Name
FROM Teacher
WHERE First_Name LIKE “S%”;
Output –
First_Name
Shanaya
Surbhi
Saurbh
Sumita
7. Query – To retrieve names of all the teachers having 6 characters in the first name and starting with ‘S’
SELECT First_Name
FROM Teacher
WHERE First_Name LIKE “S_ _ _ _ _”;
Output –
First_Name
Surbhi
Snmita
8. Query – To retrieve names of all the teachers having at least 6 characters in the first name.
SELECT First_Name
FROM Teacher
WHERE First_Name LIKE “_ _ _ _ _ _%”;
Output –
First_Name
Shanaya
Surbhi
Tarannum
9. Query – To list the names of teachers in alphabetical order.
SELECT First_Name, Last_Name
FROM Teacher
ORDER BY First_Name, Last_Name;
Output –
First_Name Last_Name
Shanaya Batra
Alice Walton
Surbhi Bansal
Megha Khanna
Tarannum Malik
9
Tarun Mehta
Puneet NULL
Namit Gupta
Neha Singh
Divya Chaudhary
Saurbh Pant
Sumita Arora
Vinita Ghosh
Vansh NULL
10. Query – To list the names of all the Departments in the descending order of their names.
SELECT Dept_Name
FROM Department
ORDER BY Dept_Name DESC;
Output –
Dept_Name
Physics
Mathematics
Hindi
English
Economics
Computer Science
Commerce
Chemistry
Biology
11. Query – To retrieve the names and department numbers of all the teachers ordered by the Department
number and within each department ordered by the names of the teachers in descending order.
SELECT First_Name, Last_Name, Dept_No
FROM Teacher
ORDER BY Dept_No ASC, First_Name DESC, Last_Name DESC;
Output –
First_Name Last_Name Dept_No
Shanaya Batra 1
Namit Gupta 1
Tarun Mehta 2
Vansh NULL 2
Alice Walton 3
Puneet NULL 3
Surbhi Bansal 4
Megha Khanna 4
Tarannum Malik 5
Divya Chaudhary 6
Neha Singh 7
Saurbh Pant 8
10
Sumita Arora 9
Vinita Ghosh 9
12. Query – To retrieve all the details of those employees whose last name is not specified.
SELECT *
FROM Teacher
WHERE Last_Name IS NULL;
Output –
Teacher_ID First_Name Last_Name Gender Salary Date_of_Birth Dept_No
107 Puneet NULL M 52500. 1976-09-25 3
00
104 Vansh NULL M53500. 1982-05-04 2
00
13. Query – To find the maximum and minimum salary.
SELECT MAX(Salary) AS Max_Salary, MIN(Salary) AS
Min_Salary
FROM Teacher;
Output –
Max_Salary Min_Salary
54000.00 34000.00
14. Query – To count the number of teachers earning more than Rs 40000.
SELECT COUNT(Salary)
FROM Teacher
WHERE Salary > 40000;
Output –
Count(Salary)
9
15. Query – To retrieve the number of teachers in “Computer Science” Department.
SELECT COUNT(*) AS No_of_Computer_Science_Teachers
FROM Department, Teacher
WHERE Dept_Name = “Computer Science”AND Dept_No=Dept_ID;
Output –
No_of_Computer_Science_Teachers
2
MCQ
1. Data is a collection of ________ facts which have not been processed to reveal useful information.
a. Raw t
b. Facts
c. Process
d. None of the above
Answer - a. Raw
2. Which of the following properties belong to the database _______________.
a. A database is a representation of some aspect of the real world also called miniworld.
b. It is designed, built and populated with data for specific purposes.
c. It can be of any size and complexity.
d. All of the above
Answer - d. All of the above
3. What are the benefits of databases ___________.
a. Data Redundancy
b. Data Inconsistency
c. Lack of Data Integration
d. All of the above
Answer -d. All of the above
11
4. A ____________is a collection of programs that enables users to rate, maintain and use a database.
a. Database management system
b. Database manageable system
c. Database updation system
d. None of the above
Answer - a. Database management system
5. Which of the following is not a valid SQL type?
a. FLOAT
b. NUMERIC
c. DECIMAL
d. CHARACTER
Answer - d. CHARACTER
6. Which of the following is not a DDL command?
a. TRUNCATE
b. ALTER
c. CREATE
d. UPDATE
Answer - d. UPDATE
7. What are the various operations that need to be performed on a database _____________.
a. Defining the database
b. Sharing the database
c. Manipulating the database
d. All of the above
Answer - d. All of the above
9. What are the different characteristics of Database management systems?
a. Self – describing Nature of a database system
b. Insulation between programs and data
c. Sharing of data
d. All of the above
Answer - d. All of the above
10. A multiuser environment allows multiple users to access the database simultaneously; it means
___________.
a. Sharing of data
b. Insulation between Program and data
c. Self-describing Nature of database system
d. None of the above
Answer - a. Sharing of data
11. any change in the structure of data would be done in the catalog and hence programs which access this data
need not be modified. This property is called_____________.
a. Program-Data Independence
b. Self describing
c. Sharing of data
d. None of the above
Answer - a. Program-Data Independence
12. What are the different types of DBMS users ____________.
a. End users
b. Database Administrator
c. Application programmers
d. All of the above
Answer - d. All of the above
13. Users who use the database for querying, modifying and generating reports as per their needs. They are not
concerned about the working and designing of the database known as _________.
a. End users
b. Database Administrator
c. Application programmers
d. All of the above
Answer - a. End users
12
12. How many Primary keys can there be in a table?
a. Only 1
b. Only 2
c. Depends on no of Columns
d. Depends on DBA
Answer - a. Only 1
13. Which of the following is not Constraint in SQL?
a. Primary Key
b. Not Null
c. Check
d. Union
Answer - d. Union
14. What operator tests column for absence of data
a. NOT Operator
b. Exists Operator
c. IS NULL Operator
d. None of the above
Answer - c. IS NULL Operator
15. __________ is responsible for authoring access, monitoring its use, providing technical support, acquiring
software and hardware resources.
a. End users
b. Database Administrator
c. Application programmers
d. All of the above
Answer - b. Database Administrator
16. ___________ write application program to interact with the database.
a. End users
b. Database Administrator
c. Application programmers
d. All of the above
Answer - c. Application programmers
17. _________ determines the requirements of the end users and then develops specifications to meet these
requirements
a. End users
b. Database Administrator
c. System Analyst
d. All of the above
Answer - c. System Analyst
18. __________plays a major role in the database design and all the technical, economic and feasibility aspects.
a. End users
b. Database Administrator
c. System Analyst
d. All of the above
Answer - c. System Analyst
19. Advantages of using DBMS approach.
a. Reduction in Redundancy
b. Improved consistency
c. Improved availability
d. All of the above
Answer - d. All of the above
20. Data in a DBMS is more concise because of the __________ of data.
a. Non availability of data
b. Central repository
c. Data is not Security
d. None of the above
Answer - b. Central repository
13
21. By making use of ___________, the DBA can provide security to the database.
a. Database access rights
b. Password
c. Controlling users
d. All of the above
Answer - d. All of the above
22. Limitation of using DBMS approach _________.
a. High cost
b. Security and recovery overheads
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
23. __________organize collection of data as a collection of relations where each relation corresponds to a
table of values.
a. Data method
b. Database
c. Data system
d. None of the above
Answer - b. Database
24. A row is also called a ________.
a. Field
b. Tuple
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
25. A column is also called ________.
a. Attribute
b. Relation
c. Domain
d. Degree
Answer - a. Attribute
26. The data types of values in each column are called __________.
a. Attribute
b. Relation
c. Domain
d. Degree
Answer - c. Domain
27. The number of attributes in a relation is called the _________ of a relation.
a. Attribute
b. Relation
c. Domain
d. Degree
Answer - d. Degree
28. The number of rows in a relation is called the _________ of a relation.
a. Cardinality
b. Relation
c. Domain
d. Degree
Answer - a. Cardinality
29. Some of the examples of databases are ___________.
a. IBM DB2
b. Oracle
c. MySQL
d. All of the above
Answer - d. All of the above
30. __________ are restrictions on the values, stored in a database based on the requirements.
a. Method
14
b. Constraints
c. Properties
d. None of the above
Answer - b. Constraints
31. What are examples of constraints in relational models?
a. Domain constraint
b. Key constraint
c. Entity Integrity constraint
d. All of the above
Answer - d. All of the above
32. What are the examples of key constraints?
a. Super key
b. Candidate key
c. Primary key
d. All of the above
Answer - d. All of the above
33. __________ is a set of attributes in a relation, for which no two tuples in a relation state have the same
combination of values.
a. Super key
b. Candidate key
c. Primary key
d. All of the above
Answer - a. Super key
34. _________ key helps to protect duplication in the table.
a. Super key
b. Candidate key
c. Primary key
d. All of the above
Answer - c. Primary key
35. ____________ is a language that is used to manage data stored in a RDBMS.
a. DDL
b. DML
c. SQL
d. None of the above
Answer - c. SQL
36. SQL Stands for __________.
a. System Query Language
b. Structured Query Language
c. Social Query Language
d. None of the above
Answer - b. Structured Query Language
37. DDL Stands for ___________.
a. Data Database Language
b. Domain Definition Language
c. Data Definition Language
d. None of the above
Answer - c. Data Definition Language
38. DML Stands for ___________.
a. Data Manageable Language
b. Domain Manipulation Language
c. Data Manipulation Language
d. None of the above
Answer - c. Data Manipulation Language
39. Database system needs to be installed on the Computer and this computer is known as ___________.
a. Database Server
b. Database storage
15
c. Database memory
d. None of the above
Answer - a. Database Server
40. _________ command is used to create a new table in the database.
a. Select command
b. Create command
c. Modify command
d. Alter command
Answer - b. Create command
41. Which datatype belongs to numerical type.
a. Integer
b. . Number
c. Decimal
d. All of the above
Answer - d. All of the above
41. What data type has a fixed length in the database.
a. Varchar(n)
b. Char(n)
c. Longvarchar(n)
d. None of the above
Answer - b. Char(n)
42. Which syntax is correct for creating a table _________.
a. Create table <table name> ( <column name> <data type>);
b. Create table <column name> ( <table name> <data type>);
c. Create table ( <column1 name> <data type>);
d. None of the above
Answer - a. Create table ( );
43. Which command is used to creating a Database;
a. Create <database name>;
b. Create Database <database name>;
c. Database Create <database name>;
d. None of the above
Answer - b. Create Database ;
44. Which command is used to display a Database;
a. Display DATABASE;
b. Show DATABASE;
c. Check DATABASE;
d. None of the above
Answer - b. Show DATABASE;
45. A command that lets you change one or more field in a table is:
a. INSERT
b. MODIFY
c. LOOK-UP
d. All of the above
Answer - b. MODIFY
46. How can you change “Mehta” into “Sinha” in the “LastName” column in the Users table?
a. UPDATE User SET LastName = ‘Mehta’ INTO LastName = ‘Singh’
b. MODIFY Users SET LastName = ‘Sinha’ LAST LastName = ‘Sinha’
c. MODIFY Users SET LastName = ‘Mehta’ INTO LastName = ‘Sinha’’
d. UPDATE Users SET LastName = ‘Mehta’ WHERE LastName = ‘Sinha’’
Answer - d. UPDATE Users SET LastName = ‘Mehta’ WHERE LastName = ‘Sinha’’
47. What are the several constraints for smooth operations in the database.
a. NOT NULL
b. DEFAULT
c. CHECK
d. All of the above
16
Answer - d. All of the above
48. If a user has not entered a value for an attribute, then the default value specified while creating the table is
used; this constraint is done by using _________.
a. NOT NULL
b. DEFAULT
c. CHECK
d. All of the above
Answer - b. DEFAULT
49. ___________ ensures that there must always exist a valid relationship between two relational database
tables.
a. Referential Integrity Constraint
b. Key Constraint
c. Default Constraint
d. None of the above
Answer - a. Referential Integrity Constraint
50. A foreign key constraints can reference columns within the same table. These tables are called
___________.
a. Self-referencing tables
b. Key Constraint
c. Default Constraint
d. None of the above
Answer - a. Self-referencing tables
51. The advantage is that named constraints can be easily _________ using the alter Table command.
a. Updated
b. Deleted
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
52. The command is used to delete tables from a database _________.
a. Delete Table
b. Remove Table
c. Drop Table
d. None of the above
Answer - c. Drop Table
53. ____________command is used to modify the base table definition. The modifications that can be done
using this command.
a. Update Table
b. Alter Table
c. Modify Table
d. None of the above
Answer - b. Alter Table
54. A column can be dropped using this command but one must specify the options __________ for the drop
behavior.
a. Restrict
b. Cascade
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)55. If the reference is given in another table then ________ command is not allowed
to drop the table.
a. Restrict
b. Cascade
c. Both a) and b)
d. None of the above
Answer - a. Restrict
56. If the reference is given in another table then ________ command is allowed to drop the table.
a. Restrict
b. Cascade
17
c. Both a) and b)
d. None of the above
Answer - b. Cascade
57. A f___________key can be dropped by using the ALTER TABLE command.
a. Primary key
b. Foreign key
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
58. Insert command helps to insert _________ in the table.
a. Column
b. Row
c. Tuple
d. All of the above
Answer - d. All of the above
59. ___________command is used to update the attribute values of one or more tuples in a table.
a. Insert table
b. Update table
c. Alter table
d. None of the above
Answer - b. Update table
60. In order to delete one or more tuples, _________ command is used.
a. Drop command
b. Delete command
c. Remove command
d. Erase command
Answer - b. Delete command
61. The ____________ Command is used to retrieve information from a database.
a. Select command
b. Display command
c. Show command
d. None of the above
Answer - a. Select command
62. Where clause you can use in which of the following commands.
a. Delete command
b. Select command
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
63. ________ helps to count the number of tuples in the database.
a. Count
b. Sum
c. Max
d. Min
Answer - a. Count
64. _______ finds the sum of all the values for a selected attribute which has a numeric data type.
a. Count
b. Sum
c. Max
d. Min
Answer - b. Sum
65. ________ finds the maximum value out of all the values for a selected attribute which has numeric data
type.
a. Greatest
b. Maximum
c. Max
d. Minimum
18
Answer - c. Max
66. _________ helps to find the minimum value out of all values for a selected attribute which has numeric data
type.
a. Minimum
b. Min
c. Lowest
d. None of the above
Answer - b. Min
67. _________ helps to find the average value of all the values for a selected attribute which has numeric data
type.
a. Middle
b. Average
c. AVG
d. None of the above
Answer - c. AVG
68. Which SQL keyword is used to display the data based on certain pattern?
a. LIKE
b. IN
c. BETWEEN
d. RANGE
Answer - a. LIKE
69. Sagun is creating a table SALESMAN with fields Salesman number, Name, Total Sales. She doesn’t want
the Total Sales column to be remain unfilled i.e. she wants to make entry in this field mandatory. Which
constraint she should use at the time of creating SALESMAN table:
a. Check
b. Default
c. Not null
d. Primary key
Answer - c. Not null
70. Ranjana wants to delete the records where name starts with A from the table CUSTOMER having fields
Name, Amount, Discount. Identify the correct command:
a. Delete CUSTOMER where name like “A%”;
b. Delete from CUSTOMER where name like “A%”;
c. Delete CUSTOMER where name = “A%”;
d. Delete from CUSTOMER where name = “A%”;
Answer - b. Delete from CUSTOMER where name like “A%”;
71. The ______________command is used to modify the structure of the table STUDENT in MySQL.
a. Modify table STUDENT
b. Alter table STUDENT
c. Alter STUDENT
d. Modify STUDENT
Answer - b. Alter table STUDENT
72. Garvit wants to change the default value of DISCOUNT in the CUSTOMER table from 10 to 15. Select the
most appropriate command to do the same from the following options:
a. ALTER TABLE CUSTOMER ALTER DISCOUNT SET DEFAULT 15;
b. ALTER TABLE CUSTOMER DELETE DISCOUNT SET DEFAULT 15;
c. ALTER TABLE CUSTOMER MODIFY DISCOUNT SET DEFAULT 15;
d. ALTER TABLE CUSTOMER CHANGE DISCOUNT SET DEFAULT 15;
Answer - a. ALTER TABLE CUSTOMER ALTER DISCOUNT SET DEFAULT 15;
73. Consider a table: COACHING having fields CITY_NAME, ENROLMENTS. Shikhar wants to display the
data of the above table in ascending order of enrolments. Choose the correct query/queries from the following:
i. Select * from coaching order by enrolments asc;
ii. Select * from coaching order by enrolments desc;
iii. Select * from coaching order by enrolments;
iv. Select * from coaching order by enrolments ascending; Select the correct option:
a. Only (i) is correct
b. Both (i) and (ii) are correct
19
c. Both (i) and (iii) are correct
d. Only (iv) is correct
Answer - c. Both (i) and (iii) are correct
74. Geeta wants to know the usage of NULL in MySQL. Help her choose in which of the following case NULL
value cannot be assigned to the column Admission_Number:
a. When the Admission_Number is zero
b. When the Admission_Number is not known
c. When the Admission_Number is not available
d. When the Admission_Number is not applicable
Answer - a. When the Admission_Number is zero
75. Which of the following is NOT an advantage of DBMS approach:
a. All the data is stored at one place. There is no repetition of the same data.
b. There is a single copy of data that is accessed or updated by all the users.
c. The DBA can provide security to the database by controlling users’ database access rights.
d. Designing the database specifications and writing application programs is a time-consuming process.
Answer - d. Designing the database specifications and writing application programs is a time-consuming
process.
76. An attribute A of datatype varchar(20) has the value “Keshav”. The attribute B of datatype char(20) has
value ”Meenakshi”. How many characters are occupied in attribute A and attribute B?
a. 20,6
b. 6,20
c. 9,6
d. 6,9
Answer - b. 6,20
77. Cardinality of a table is four and degree is three. If two columns and four rows are added to the table what
will be the new degree and cardinality of the given table:
a. 5,8
b. 3,4
c. 8,5
d. 4,3
Answer - a. 5,8
Important Questions
1. What is data?
Answer – Data is a collection of raw facts which have not been processed to reveal useful information.
2. What is Database?
Answer – A database is an organized collection of structured information, or data, typically stored
electronically in a computer system. A database is usually controlled by a database management system.
3. What are the different properties of Database?
Answer – The different properties of Database are –
1) A database is a representation of some aspect of the real world also called miniworld. Whenever there are
changes in this miniworld they are also reflected in the database.
2) It is designed, built and populated with data for specific purposes.
3) It can be of any size and complexity.
4) It can be maintained manually or it may be computerized.
4. Why is a database required?
Answer – Large amounts of data may be kept in one location, which makes databases a suitable choice for data
access. The data can be accessed and changed simultaneously by several individuals. You can quickly and
easily find the information you need in databases since they can be searched and sorted.
5. What are the different advantages of Database?
Answer – Advantages of database are –
1. Reduction in Redundancy: All the data is stored at one place. There is no repetition of the same data. This
also reduces the cost of storing data on hard disks or other memory devices.
2. Improved Consistency: The chances of data inconsistencies in a database are also reduced as there is a single
copy of data that is accessed or updated by all the users.
3. Improved Availability: Same information is made available to different users. This helps sharing of
information by various users of the database.
20
4. Improved Security: By making use of passwords and controlling users’ database access rights, the DBA can
provide security to the database.
5. User Friendly: Using a DBMS, it becomes very easy to access, modify and delete data.
6. What is a Database Management System?
Answer – A database management system is a group of applications that let users build, administer, and use
databases. It permits the development of a data repository that may be created once and then accessible by
various users in accordance with their needs. As a result, all application programmes have access to a single
data source.
7. What are the various operations performed by Database?
Answer – The various operation of database are –
1. Defining the Database: It involves specifying the data type of data that will be stored in the database and also
any constraints on that data.
2. Populating the Database: It involves storing the data on some storage medium that is controlled by DBMS.
3. Manipulating the Database: It involves modifying the database, retrieving data or querying the database,
generating reports from the database etc.
4. Sharing the Database: Allow multiple users to access the database at the same time.
5. Protecting the Database: It enables protection of the database from software/ hardware failures and
unauthorized access.
6. Maintaining the Database: It is easy to adapt to the changing requirements
8 What are the different characteristics of Database?
Answer – The different characteristics of database are –
a. Self-describing Nature of a Database System – The database management system (DBMS) also includes a
description of the data that it stores. Metadata refers to this description of the data. A database catalog or data
dictionary is where meta-data is kept. It includes the data’s structure as well as the limitations placed on the
data.
b. Insulation Between Programs and Data – Programs that access this data don’t need to be changed because
the description of the data is stored separately in the database management system (DBMS) and any changes to
the data’s structure are made in the catalog. The term “Program-Data Independence” refers to this quality.
c. Sharing of Data – Multiple users can access the database at once in a multi user scenario. Therefore, a
DBMS must have concurrency control software to provide concurrent access to the database’s data without
encountering any consistency issues.
9. What are the different types of users of DBMS?
Answer – The different types of DBMS users are –
1. End Users – Users who use the database for querying, modifying and generating reports as per their needs.
2. Database Administrator (DBA) – The DBA is responsible for authoring access, monitoring its use,
providing technical support, acquiring software and hardware resources.
3. Application Programmers – Application programmes write application programs to interact with the
database.
4. System Analyst – A system analyst plays a major role in the database design and all the technical, economic
and feasibility aspects.
10. What are the limitations of using DBMS?
Answer – Limitations of DBMS are –
a. High Cost – The cost of implementing a DBMS system is very high and a very time consuming process.
b. Security and Recovery Overheads – Databases protect the data from unauthorized access from the users.
11. What is a relational Database?
Answer – A collection of data elements with pre-established relationships between them make up a relational
database. These things are arranged in a series of tables with rows and columns. To store data about the things
that will be represented in the database, tables are utilized.
12. What do you mean by domain constraint?
Answer – Columns with user-defined domain constraints make it easier for users to enter values that relate to
the data type. Additionally, it notifies the user that the column is not properly filled in if it receives a faulty
input.
13. What is entity integrity constraint?
Answer – This constraint specifies that the primary key of a relation cannot have null value. The reason behind
this constraint is that we know the primary key contains no duplicates.
14. What is the referential integrity constraint?
21
Answer – Foreign key constraints or referential integrity constraints. A logical rule about the values in one or
more columns in one or more tables is known as a foreign key constraint, also known as a referential constraint
or a referential integrity constraint.
15. How many SQL statements are used? Define them.
Answer – SQL statements are basically divided into two categories, DDL & DML.
a. Data Definition Language – Commands from the Data Definition Language (DDL) are used to specify the
structure holding the data. These commands are automatically committed, which means that any database
changes made by DDL commands are permanently recorded.
b. Data Manipulation Language – The database’s data can be changed using Data Manipulation Language
(DML) commands. These instructions can be rolled back and are not automatically committed.
16. Give an example of DDL & DML commands?
Answer –
Data Definition Language (DDL) commands:
CREATE table
ALTER table
DROP table
Data Manipulation Language (DML) commands:
INSERT table
UPDATE table
DELETE
NCERT Solutions
The primary key of this table is Employee_ID and Manager_ID is a foreign key that references
Employee_ID.
Write SQL commands for the following:
(a) Create the above table
CREATE TABLE EMPLOYEE
(
Employee_ID INTEGER PRIMARY KEY,
Employee_Name VARCHAR(20) NOT NULL,
Job_Title VARCHAR(20),
Salary DECIMAL(10,2) DEFAULT 40000,
Bonus VARCHAR(10),
Age INTEGER,
FOREIGN KEY (Manager_ID) REFERENCES Employee(Employee_ID)
);
(b) Insert values as shown above
INSERT INTO Employee (
Employee_Id, Employee_Name, Job_Title, Salary, Bonus, Age, Manager_Id)
Values (1201, “Divya”, “President”, 50000, NULL, 29, NULL);
or
INSERT INTO Employee (
Employee_Id, Employee_Name, Job_Title, Salary, Bonus, Age, Manager_Id)
Values (1201, “Divya”, “President”, 50000, NULL, 29, NULL),
22
(1205, “Amyra”, “Manager”, 30000, 2500, 26, 1201),
(1211, “Rahul”, “Analyst”, 20000, 1500, 23, 1205),
(1213, “Manish”, “Salesman”, 15000, NULL, 22, 1205),
(1216, “Megha”, “Analyst”, 22000, 1300, 25, 1201),
(1217, “Mohit”, “Salesman”, 16000, NULL, 22, 1205);
(c) Delete the Employee having Employee_ID 1217.
DELETE FROM Employee WHERE Employee_Id = 1217;
(d) Update the salary of “Amyra” to 40000.
UPDATE Employee SET Salary = 40000 WHERE Employee_Name = “Amyra”;
(e) Alter the table Employee so that NULL values are not allowed for Age column.
ALTER TABLE Employee MODIFY Age INTEGER NOT NULL;
(f) Write a query to display names and salaries of those employees whose salary are greater than 20000.
SELECT Employee_Name, Salary FROM Employee WHERE Salary>20000;
(g) Write a query to display details of employees who are not getting any bonus.
SELECT * FROM Employee WHERE Bonus IS NULL;
(h) Write a query to display the names of employees whose name contains “a” as the last alphabet.
SELECT Employee_Name FROM Employee WHERE Employee_Name LIKE “%a”;
(i) Write a query to display the name and Job title of those employees whose Manager_ID is 1201.
SELECT Employee_Name, Job_Title FROM Employee WHERE Manager_ID = 1201;
(j) Write a query to display the name and Job title of those employees whose Manager is “Amyra”
SELECT Employee_Name, Job_Title FROM Employee WHERE Manager = “Amyra”;
(k) Write a query to display the name and Job title of those employees aged between 26 years and 30 years.
SELECT Employee_Name, Job_Title FROM Employee WHERE Age BETWEEN 26 AND 30;
18. A Railway company uses machines to sell tickets. The machine details and daily sales information are
recorded in two tables:
Table Name - Machine
Field Data Type
Machine_ID CHAR(3)
Station Char(30)
Table Name - Sales
Field Data Type
Machine_ID Char(3)
Date DATE
Tickets Sold INTEGER
Income DECIMAL(8,2)
The primary key of the table Machine is Machine_ID. Records in the table Sales are uniquely identified by
the fields Machine_ID and Date.
(a) Create the tables Machine and Sales.
CREATE TABLE MACHINE
(
MACHINE_ID CHAR(3) PRIMARY KEY,
Station CHAR(30)
);
CREATE TABLE SALES
(
MACHINE_ID CHAR(3) NOT NULL UNIQUE,
Date DATE NOT NULL UNIQUE;
Tickets_Sold INTEGER;
Income DECIMAL(8,2)
);
(b) Write a query to find the number of ticket machines in each station.
SELECT Station FROM Machine GROUP BY Tickets_Sold;
(c) Write a query to find the total ticket income of the station “New Delhi” of each day.
23
SELECT Station FROM Machine where Station=”New Delhi” GROUP BY Sales HAVING SUM(Income);
(d) Write a query to find the total number of tickets sold by the machine (Machine_ID = 122) till date.
SELECT SUM(Tickets_Sold) FROM Sales WHERE Machine_ID = 122;
E-Governance
The government’s ability to give citizens access to information is made easier by the usage of ICT. The
government has established ICT-enabled services, such as the registration of birth and death certificates, the
purchase of train tickets, the submission of RTI requests, etc.
Initiative
The national satellite-based computer network, NICNET, was launched in India in 1987, providing the primary
impetus for e-Governance. The District Information System of the National Informatics Center (DISNIC)
programme, which aims to computerise all district offices across the nation, was then introduced in 1990.
The Department of Electronics and Information Technology (DEITY) and Department of Administrative
Reforms and Public Grievances (DAR&PG) created the National e-Governance Plan (NeGP) in 2006, which
has helped the e-Governance process.
E-Governance Sites
Some of the Central initiatives for e-governance include:
• National e-Governance Plan (NeGP)
• National e-Governance Division (NeGD)
• e-Governance Infrastructure
• Mission Mode Projects
• Citizens Services
• Business Services
• Government Services
• Projects and Initiatives
• R&D in e-Governance
[Link].
[Link] went live on November 10th, 2005. It falls under the National E-Government Plan, or NeGP, as a
Mission Mode Project. The National Informatics Centre, which is a division of the Ministry of Communications
and Information Technology, manages the portal.
[Link]
All websites from the Indian Government, from all levels and throughout all sectors, can be accessed through
this portal. Sites for several Indian states and union territories are also included, as are those for legislative and
judicial branches of government. It also offers details about various industries, including agriculture and
education.
Unit 3
Fundamental of Java
Java Programming
Java is a high-level, class-based, object-oriented programming language. Java Interpreter java program to Java
Bytecode. This method has the advantage that once a Java programme has been converted to bytecode, it can be
executed on any platform (such as Windows, Linux, or Mac), provided the platform is running the JVM.
Because of this, Java programmes are extremely portable and cross-platform.
Variables and Datatypes in Java
Int age=20;
here(int is data type ,age is variable,=is assignment operator , 20 is value)
What is Variable?
Variables will be used to store the program’s data. A variable is a placeholder for information whose value may
change as a result of a program’s execution. In a computer, a variable is the name of a memory region that
stores data. All data variables in Java have to be declared and initialized before they are used.
What is Data type?
When declaring variables, we have to specify the data type of information that the member will hold – integer,
fractional, alphanumeric, and so on. The type of a variable tells the compiler, how much memory to reserve
when storing a variable of that type.
Java Datatype is divided into two types –
[Link] data types – includes byte, short, int, long, float, double, boolean and char.
[Link]-primitive data types – such as String, Arrays and Classes.
Primitive data types
A reserved term is used to identify a primitive type, which is predefined by the language. The Java
programming language’s support eight primitive data types.
Data type in Java
Data Type Type of values Size
byte Integer 8-bit
short Integer 16-bit
int Integer 32-bit
long Integer 64-bit
float Floating Point 32-bit
double Floating Point 64-bit
char Character 16-bit
boolean True or False 1-bit
Java Variables Naming rules
[Link] names can begin with either an alphabetic character, an underscore (_), or a dollar sign ($).
[Link] names must be one word. Spaces are not allowed in variable names. Underscores are allowed.
“total_marks” is fine but “total marks” is not.
[Link] are some reserved words in Java that cannot be used as variable names, for example – int.
[Link] is a case-sensitive language. Variable names written in capital letters differ from variable names with the
same spelling but written in small letters.
[Link] is good practice to make variable names meaningful. The name should indicate the use of that variable.
[Link] can define multiple variables of the same type in one statement by separating each with a comma.
33
String Variable
String variables, also known as alphanumeric variables or character variables, treat their values as text. As a
result, string variables may have values that are made up of letters, numbers, or symbols.
Example –
String first_name = “Mayank”;
String last_name = “Saxena”;
Operators
In a programming language, operators are special symbols that carry out certain operations.
[Link] Operators
[Link] Operators
[Link] Operators
[Link] Operators
Athematic Operator
Operator Description Explanation Example(int a=20,b=30) Result
+ Addition Returns the sum of values of a+b 50
operands
- Subtraction Returns the difference of values a-b -10
of operands
* Multiplica tion Returns the product of values of a*b 600
operands
/ Division Returns the quotient of values of b/a 1
operands
% Modulus Returns the reminder of values of a%b 10
operands
++ Increment Increments the operand 1 a++ or ++a 21
-- Decrement Decrements the operand 1 a-- or --a 29
Relational Operators
Operator Description Explanation Example Result(int a=20,b=30)
Equal to Returns true if values of a and b are equal, a==b false
false otherwise
!= Not equal to Returns true if values of a and b are not a!=b true
equal, false otherwise
> Greater than Returns true if values of a is greater than that a>b false
of b , false otherwise
< Less than Returns true if values of a is less than that of a<b true
b , false otherwise
>= Greater than Returns true if values of a is greater than or a>=b false
equal to equal to that of b , false otherwise
<= Less than or Returns true if values of a is greater than or a<=b true
equal to equal to that of b , false otherwise
Assignment Operators
Operator Description Explanation Example Result(int
a=20,b=30)
Simple Assign value of left side operand to a=b a becomes 30
Assignment right side operand
+= Add and Add value of left side operand to right a+=b a becomes 50
Assignment side operand and assigns the result to (20+30)
the right side operand Same as a=a+b
34
-= Subtract and Subtract value of left side operand to a-=b a becomes 10
Assignment right side operand and assigns the (20-30)
result to the right side operand Same
as a=a-b
*= Multiply and Multiplies value of left side operand a*=b a becomes 600
Assignment to right side operand and assigns the (20*30)
result to the right side operand Same
as a=a*b
/= Divide and Divides value of left side operand to a/=b a becomes 0
Assignment right side operand and assigns the (20/30)
result to the right side operand Same
as a=a/b
%= Modulus and Divides value of right side operand by a%=b a becomes 20
Assignment left side operand and assigns the (20%30)
reminder to the right side operand
Same as a=a%b
Logical Operator
Operator Description Explanation Example Result(int
a=20,b=30)
&& Logical AND Returns true if values of both a and b a&&b false
are true ,false otherwise
Logical OR Returns true if values of either a and a b true
b is true ,false otherwise
! Logical NOT Returns true if values of a false, true !a false
otherwise
Selection Structures
In real life, you often select your actions based on whether a condition is true or false. Similarly in a program,
you may want to execute a part of the program based on the value of an expression. Java provides two
statements –
[Link] else Statement
[Link] Statement
The if Else Statement
The if else statement in Java lets us execute a block of code depending upon whether an expression evaluates to
true or false. The structure of the Java if statement is as below –
Syntax –
if (expression) {
statements
}
else
{ }
Question > Write a Java program to check weather age is grater then 20 not?
35
The Switch Statement
The switch statement is used to execute a block of code matching one value out of many possible values. The
structure of the Java switch statement is as follows –
Syntax –
switch (expression) {
case 1:
[Link](“Case 1”);
case 2:
[Link](“Case 2”);
case 3:
[Link](“Case 3”);
default:
[Link](“Default case”);
}
Question > Java programme to display a Switch statement example.
public class Example {
public static void main(String[] args) {
int number=30;
switch(number){
case 10:
[Link](“10”);
break;
case 20:
[Link](“20”);
break;
case 30:
[Link](“30”);
break;
default:
[Link](“Not in 10, 20 or 30”);
}
}
}
Repetition Structures
In real life you often do something repeatedly, for example, consider a task such as reading a book, first you
open the book, and then repeatedly – read a page; flip the page – until you get to the end of the book, then close
the book.
Difference between Entry control loop and Exit control loop
Entry Control Loop Exit Control Loop
In entry control loop condition is checked
In exit control loop condition is checked last
first
If the condition is false, loop body will not If the condition is false, loop body will execute at
execute least once
Example of entry control loop – For & While Example of exit control loop – Do-while
Difference between Entry control loop and Exit control loop
The While Statement
The while statement evaluates the test before executing the body of a loop. The structure of the Java while
statement is as shown –
Syntax –
while (expression)
{
36
statements
}
Question > Write a Java program to print the number from 1 to 5 using while statement.
public class WhileDemo {
public static void main (String[ ] args) {
int number = 1;
while (number <= 5) {
[Link] (“number);
number++;
}}}
The Do While Statement
The do while statement evaluates the test after executing the body of a loop. The structure of the Java do while
statement is as shown –
Syntax –
do
{
statements
} while (expression);
Question > Write a Java program to print the number from 1 to 5 using do-while statement.
public class DowhileDemo {
public static void main (String[ ] args) {
int number = 1;
do {
[Link] (“number);
number++;
} while (number <= 5);
}}
The for Statement
The for loop is the most widely used Java loop construct. The structure of the Java for statement is as below:
Syntax –
for (counter=initial_value; test_condition;change counter)
{
statements
}
Question > Write a Java program to print the number from 1 to 5 using for statement.
public class WhileDemo {
public static void main (String[ ] args) {
int number;
for (number=1; number <= 5; number++) {
[Link] (“number);
}}}
Arrays in Java
Arrays are variables that can hold more than one value, they can hold a list of values of the same type.
For example,
Normal Variable Declaration
37
Output -
18 is a positive number
53
22. Write a program to check whether a character is alphabet or not.
public class Example {
public static void main(String[] args) {
char c = 'a';
if( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
[Link](c + " is an alphabet");
else
[Link](c + " is not an alphabet");
}
}
Output -
a is an alphabet
Looping statement related program –
23. Write a program to Find Factorial of a Number
n=1*2*3*4*…*n
public class Example {
public static void main(String[] args) {
int num = 10;
long f = 1;
for(int i = 1; i <= num; ++i)
{
f = f * i;
}
[Link]("Factorial of a number ", f);
}
}
Output -
Factorial of a number = 3628800
24. Write a program to print the Fibonacci series 0, 1, 1, 2, 3, 5, 8,
class Example {
public static void main(String[] args) {
int n = 10, first = 0, second = 1, sum = 0;
for (int i = 1; i <= n; i++) {
[Link](first + ", ");
sum = first + second;
first = second;
second = sum;
}
}
}
25. Write a program to check whether the string is palindrome or not.
class Example {
public static void main(String[] args) {
String str = "MADAM", r_str = "";
int strLength;
int strLength = [Link]();
for (int i = (strLength - 1); i >=0; i--) {
r_str = r_str + [Link](i);
}
if ([Link]().equals(r_str.toLowerCase())) {
[Link](str + " is a Palindrome");
}
else {
[Link](str + " is not a Palindrome");
}
54
}
}
Output -
MADAM is a Palindrome
26. Write a program to check whether a number is prime or not.
public class Example {
public static void main(String[] args) {
int num = 7;
boolean f = false;
for (int i = 2; i <= num / 2; i++) {
if (num % i == 0) {
f = true;
break;
}
}
if (!f)
[Link](num + " is a prime number");
else
[Link](num + " is not a prime number");
}
}
Output -
7 is a prime number
Switch Statement related program –
27. Write a program to design simple calculator using switch statement.
import [Link];
class Example {
public static void main(String[] args) {
char ch;
Double number1, number2, result;
Scanner input = new Scanner([Link]);
[Link]("Choose an operator: +, -, *, or /");
[Link]("1. +");
[Link]("2. -");
[Link]("3. *");
[Link]("4. /");
[Link]("Select choice");
ch = [Link]().charAt(0);
[Link]("Enter first number");
number1 = [Link]();
[Link]("Enter second number");
number2 = [Link]();
switch (ch) {
case '+':
result = number1 + number2;
[Link](number1 + " + " + number2 + " = " + result);
break;
case '-':
result = number1 - number2;
[Link](number1 + " - " + number2 + " = " + result);
break;
case '*':
result = number1 * number2;
[Link](number1 + " * " + number2 + " = " + result);
break;
case '/':
result = number1 / number2;
55
[Link](number1 + " / " + number2 + " = " + result);
break;
default:
[Link]("Invalid choice!");
break;
}
[Link]();
}
}
Output -
1. +
2. -
3. *
4. /
Select Choice +
Enter first number 4
Enter second number 6
4 * 6 = 10
Array
28. Write a program to Print an Array.
public class Example {
public static void main(String[] args) {
int[] array = {1, 2, 3, 4, 5};
for (int element: array) {
[Link](element);
}
}
}
Output -
1
2
3
4
5
29. Write a program to find the average of given array 7, 34, 55, 82, 44.
public class Example {
public static void main(String[] args) {
int[] numArray = { 7, 34, 55, 82, 44 };
double sum = 0;
for (double num: numArray) {
sum += num;
}
double average = sum / [Link];
[Link]("The average is " + average);
}
}
Output -
The average is: 44.4
String function related program –
30. Write a program to find the concatenate of two different string
public class Example {
public static void main(String[] args) {
String str1="Anurag";
String str2="Anand";
String str3=[Link](str2);
[Link](str3);
}
56
}
Output -
Anurag Anand
31. Write a program to find the length of the string
public class Example {
public static void main(String[] args) {
String str="Anurag";
int len=[Link]();
[Link](len);
}
}
Output -
6
32. Write a program to convert the string in uppercase format.
public class Example {
public static void main(String[] args) {
String str="anurag";
String upper=[Link]();
[Link](upper);
}
}
Output -
ANURAG
33. Write a program to convert the lowercase string to uppercase string.
public class Example {
public static void main(String[] args) {
String str="ANURAG";
String lower=[Link]();
[Link](lower);
}
}
Output -
anurag
Unit 4
Work Integrated Learing IT
MCQ
1. GUI stands for ____________.
a. Graphical User Interface
b. Graphic User Interaction
c. Graphic User Interface
d. None of the above
Answer - a. Graphical User Interface
2. Which codes and attributes provide an automatically feature __________.
a. IntelliSense
b. Navigate
c. Built – in support
d. All of the above
Answer - a. IntelliSense
3. _________ extends the capability of the main program.
a. IntelliSense
b. Add-ins
c. Built – in Support
d. All of the above
Answer -b. Add-ins
57
4. You can download a variety of Add-ins from ___________ websites.
a. [Link]
b. [Link]
c. [Link]
d. All of the above
Answer - d. All of the above
5. _________ are pieces of program re-used by most developers.
a. IntelliSense
b. Add-ins
c. Snippets
d. None of the above
Answer - c. Snippets
6. ________ helps to reusing the code multiple times in the webpages.
a. IntelliSense
b. Add-ins
c. Snippets
d. None of the above
Answer - c. Snippets
7. Snippets are available in which programming languages ___________.
a. CSS
b. HTML
c. JavaScript & JQuery
d. All of the above
Answer - d. All of the above
8. _________ template helps to create an attractive website.
a. PPD template
b. PSD template
c. PRD template
d. None of the above
Answer - b. PSD template
9. Extension of the photoshop file ___________.
a. .PSD
b. .DOC
c. .PDF
d. .XLS
Answer - a. .PSD
10. In the MEW software _________ is a special feature that can be used for updating an image whenever
the original photoshop image is modified.
a. Command Image
b. Compatibility Image
c. PSD Image
d. None of the above
Answer - b. Compatibility Image
11. _________ helps to apply special effects to web pages just as in presentation software.
a. Slide Transitions
b. Web Transitions
c. Page Transitions
d. All of the above
Answer - c. Page Transitions
12. Add-ins are available on the _________ menu.
a. View
b. Tools
c. Edit
d. Insert
Answer - b. Tools
13. Snippets can be accessed from ________ menu.
a. View
58
b. Tools
c. Panels
d. Insert
Answer - c. Panels
14. PSD can be imported from the _____ menu.
a. File
b. Tools
c. Edit
d. Insert
Answer - a. File
15. Page Transitions is available on the _____ menu.
a. View
b. Tools
c. Format
d. Insert
Answer - c. Format
16. DWT stands for _________.
a. Digital Web Template
b. Dynamic Web Template
c. Dynamic Web Text
d. None of the above
Answer - b. Dynamic Web Template
17. Templates help you organize the entire website to have a consistent look and feel. This is very helpful
when you work with a large number of web pages.
a. Templates
b. Image Editing
c. Embedding
d. None of the above
Answer - a. Templates
18. ________ helps to create a dynamic website with fixed positions for common elements.
a. Static Web Template
b. Dynamic Web Template
c. Auto Web Template
d. None of the above
Answer - b. Dynamic Web Template
19. SEO stands for _______________.
a. Search Ending Optimization
b. Search Engine Option
c. Search Engine Optimization
d. None of the above
Answer - c. Search Engine Optimization
20. We can get a better search ranking of our website using __________.
a. SEO
b. SOE
c. SSD
d. SSL
Answer - a. SEO
21. Search engines crawl a website using _____________.
a. Web
b. Spider
c. Reader
d. None of the above
Answer - b. Spider
22. With the help of ___________ we can Index the website in the search engine.
a. Page Title
b. Page Description
59
c. Page Keyword
d. All of the above
Answer - d. All of the above
23. Page title maximum ________ characters are displayed in search results.
a. 60
b. 70
c. 80
d. 90
Answer - b. 70
24. Page description can contain maximum ___________ characters in the search engine.
a. 128
b. 130
c. 156
d. 180
Answer - c. 156
25. Using HTML and CSS you can create __________ web page.
a. Static
b. Dynamic
c. Both a) and b)
d. None of the above
Answer - a. Static
26. If you want to create a dynamic web page you require __________ language.
a. ASP
b. PHP
c. JavaScript
d. Any one from above
Answer - d. All of the above
27. Data filled using a form can be stored in a _________.
a. Data System
b. Data Base
c. Data Container
d. None of the above
Answer - b. Data Base
28. IIS stands for _____________.
a. Internal Information System
b. Internet Information Services
c. Internet Information System
d. None of the above
Answer - b. Internet Information Services
29. The database is stored in a special folder with the name __________.
a. DB
b. Data
c. Fbdb
d. None of the above
Answer - c. Fbdb
30. ________ is the product that was replaced by Microsoft Expression Web.
a. Dreamweaver
b. Microsoft FrontPage
c. Sublime Text
d. None of the above
Answer - b. Microsoft FrontPage
31. What are the standard procedures to be followed before publishing a website.
a. Examining Structure of a website
b. Estimating Size of a website
c. Removing slow page
d. All of the above
Answer - d. All of the above
60
32. Create a visual diagram of hyperlinks of a website. This helps you understand the ____________.
a. Navigation structure
b. Broken Links
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
33. If website size is more then the standard size it will take ________?
a. More time to load
b. Website will slowdown
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
34. To clean up your web page for any unnecessary code is known as _________.
a. Code Sequence
b. Code Optimization
c. Code clean up
d. None of the above
Answer - b. Code Optimization
35. ________ helps the content to store in a web server to be viewed by the public.
a. Hosting
b. Uploading
c. Downloading
d. None of the above
Answer - a. Hosting
36. Web hosting providers allow publishing to upload the website through _________.
a. FTP
b. HTTP
c. SSL
d. None of the above
Answer - a. FTP
37. _________ feature helps to transfer contents of your entire website to a remote computer.
a. Web Helper
b. Web Package
c. Web Content
d. None of the above
Answer - b. Web Package
38. Give the example of Web Authoring Tools?
a. KompoZer
b. Dreamweaver
c. Both a) and b)
d. None of the above
Answer - c. Both a) and b)
39. What are the popular templates available for creating attractive websites?
a. CSS Templates
b. XHTML/CSS Template
c. PSD Template
d. All of the above
Answer - d. All of the above
Question/Answer
1. Explain the purpose of Add-ins.?
Answer – Any third-party software programming or script that is added to a programming to give it extra
features and abilities is known as an add-ins.
Some of the popular add-in websites are –
a. [Link]
b. [Link]
c. [Link]
61
d. [Link]
e. [Link]
2. What is a snippet?
Answer – Snippets are small pieces of code that most developers reuse. Snippets are useful because they allow
you to reuse the same code across several web pages or websites, it saves time and work.
3. What do you mean by PSD templates?
Answer – Photoshop Document (PSD) is an image format that allows multiple layers of graphics to be
combined into a single file. PSD templates help to design attractive websites.
You can download PSD template from –
a. [Link]
b. [Link]
4. What is page Transitions?
Answer – You can use special effects on web pages in the same way that you can in presentation software. This
aids in the presentation of special effects to visitors.
5. What is a Dynamic Web Template?
Answer – A Dynamic Web Template is based on an HTML Web page. It may include editable page layouts,
page elements, settings, formatting, styles, graphics, and specific effects. A dynamic web template’s goal is to
derive or build pages in a web site based on it in order to keep a uniform and consistent appearance and feel
throughout the site.
6. What is Search Engine Optimization?
Answer – In simple terms, it refers to the process of upgrading your website in order to boost its exposure
when consumers use Google, Bing, and other search engines to look for products or services linked to your
business.
7. How does search engine optimization work?
Answer – Bots are used by search engines like Google and Bing to crawl the web, moving from site to site,
collecting information about those sites, and indexing them.
8. What are the different factors important to rank the website?
Answer – The different factors which is important to rank a website are –
a. Page Title (Not more than 70 characters)
b. Page Description (Not more then 156 characters)
c. Keywords
d. Page Headers
e. Internal & External Links
f. ALT text in image file
9. What is frontpage Server Extensions?
Answer – FrontPage Server Extension is a software that allows the frontpage client to connect to the server.
Many web hosting servers use FrontPage Server Extensions.
10. What is a web server?
Answer – A web server is responsible for storing the website’s files, which include all HTML documents as
well as their associated assets, such as photos, CSS stylesheets, JavaScript files, fonts, and video.
11. What is a database?
Answer – A database is a collection of data that has been arranged so that it can be simply accessed and
controlled. To make it easier to access relevant information, you can organize data into tables, rows, and
columns.
12. What are the standard procedures to publish the website?
Answer – The standard procedures to publish the website are –
a. Examining Structure of a website – Check all the internal and external links before publishing.
b. Estimating Size of a website – Always reduce the size of the website, More size will create more loading
time.
c. Removing slow pages – In the website if any slow page is there remove the page or rectify the page
otherwise it will create problems for visitors.
13. What are code optimizations?
Answer – Code optimizations means to clean up unwanted program code from a website.
14. What is web hosting?
Answer – To be viewed by the general public, the content must be hosted on a web server. There are a number
of free web hosting services available that will give you free online space for your content.