0% found this document useful (0 votes)
2 views220 pages

Express Revision

The document discusses various concepts in C++ programming, including dynamic memory allocation, pointers, structures, and object-oriented programming principles. It explains the use of operators like 'new' and 'delete', the distinction between arrays and structures, and features like polymorphism and encapsulation. Additionally, it addresses common programming errors and provides examples of code snippets for better understanding.

Uploaded by

manushark3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views220 pages

Express Revision

The document discusses various concepts in C++ programming, including dynamic memory allocation, pointers, structures, and object-oriented programming principles. It explains the use of operators like 'new' and 'delete', the distinction between arrays and structures, and features like polymorphism and encapsulation. Additionally, it addresses common programming errors and provides examples of code snippets for better understanding.

Uploaded by

manushark3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 220

Express Revision

I
- -

1. In C++, the ‘delete’ operator performs the reverse action of ‘new’


-
-

operator.
-
2. If ‘arr’ is the name of an array, then arr++ is not a valid statement -
-
---- -
-

3. If ‘k’ is a long variable with address 1001 and it is stored by a pointer


- -

variable ‘p’, then ‘p + 1 ’ will point to the location with address 1005.
-
-
-
-

- ②
1001
k=
are arrto] It -

Dave
=
-
--

ins ints -

P+ 1 X 3
*(H+ 1) =
TBE
1005
1001 +

10
I*
a-
1005
-
1. In C++, the ‘delete’ operator performs the reverse action of ‘new’
operator. In C++, both ‘new’ and ‘delete’ operators are used for
dynamic allocation and deallocation of memory respectively, ie. For
allocation of memory at runtime new operator is used. For
deallocation of memory that have been allocated by the new
operator, ‘delete’ operator is used.
2. arr++ is not a valid statement. Because the base address of an array
can not change. Array name gives the base address of the array.
3. Pointer variable hold the address of memory location where the data
is stored. So incrementing the pointer variable is adding the size of the
data type. Long data type takes 4 bytes of memory. So incrementing
the pointer variable P makes it point to the address 1005.
Consider the following code fragment.
- -

E
char nam[ ] = “COMPUTER”
for(int i = 0; nam[i]!= ‘\0’; i++)
-

- -

cout << nam[i];


-

Rewrite the above code to get the same output using a character
-
pointer variabe. -

-
-

&
char nam [ ] = “computer”
-
-
-

char*P; -
-
-
-
for (P = nam; *P!= ‘\0’; P++)
---

cout<< *P;
-
Identify and correct the error in the following code fragment.
-
struct first -

{
int a;
float b;
-
}S1;
struct second
-
{
int a;
float b;
-
}S2;
S1 = S2; => not possible -
-
The assignment S1 = S2 is not right. Because S1 and S2 are different
structure variables. C++ does not permit different structure variable
assignment.
oute Inner- element

I
Consider the following code segment. .

struct student Outer structure

E
birthday. day =25
-
-
S .

{
-
int rollno; - birthday
Muntell
.
2
.

char name[20];
Inner structure Year = 2000
struct date > S blothday
,
-
.

{
int day; -- Se solno =
21
int month; -

. gets(home);
int year; -
Inner structur S
>
} birthday;
- S butch;
-

char batch[30];
S S core
;
-
.

int score;
-

} Write valid statements in C++ to accept the name and date of birth of a student.
truto vollable
students > - outes ,
gets(S1 .name);
S1.birthday.day=25;
S1.birthday.month=5;
S1.birthday. year=1991;
The ……. operator reverses the action of the ‘new’ operator.
- -

dekte .
Write C++ statement for the following.
-
-

1. To declare an integer variable named ‘x’ using new operator.


-
- -
2. To initialize the integer pointer variable x with value 5.
-
- - -

3. To declare a dynamic array of ten integers named x.


-
-

int
Int XX =
new ;
1 :

now int (5)


;
2 .
Int XX =

new in EtoS;
3 .
Int XX =
1. int*x = newint;
2. int*x = newint(5);
3. int *x = new int[10];
Write a C++ statement to declare an array, using character pointer
- -
variable, which can store names of 60 students in a class.
----

chor * name [GoD


;
char*name[60];
&
Thomas says that name of an array is a pointer by default. Do you agree
-

with him? Justify.


-
-
- - -

Yes. C++ takes the array name as the address of its first element. That
-- -

is, the name of an array is actually a pointer pointing to the first


element of an array.

au
&
arrto]
-
-
Consider the following statements. 6 + 9 = 15 but ‘x’ + ‘yz’ = ‘xyz’ Which
-

OOP feature can you infer from the above. Explain. --


-

operator overloading

I
W
E
-
Doxymusiphim
Polymorphism. Polymorphism is the ability for a message or data to be
processed in more than one form. The same operation is performed
differently depending upon type of data it is working with.
Consider the diagram. Can you correlate any OOP feature from this?
- -
Write a note on the feature.
--

C E -
Date
Functio

at encapsulatio
Data Encapsulation: Placing data and functions together is the central
idea of object oriented programming. This is encapsulation. It is a way
to implement abstraction by wrapping up data and associated
functions into a single unit.
-

- & ↑
&
-

E
-
- -

Tawatts
- -
STRUCTURES AND POINTERS
➔ In C++, the operator which is used for dynamic memory
allocation is ________.
➔ Which of the following is true for accessing an element of a
structure?
a. struct.element
b. structure_tag.element
c. structure_variable.element
d. structure_tag.structure_variable
➔ Address of the first location of an array is known as
_______.
➔ Identify the errors in the following structure definition and
write the reason for each:
struct -- structure tasg miss
{
-
int roll, age; -
not allowed
initializatio
-

float fee=1000; -
> -
,

};
Read the following structure definition and answer the following questions:
Outer Structure

I
struct Book
-
-

I
{
=
int book_no;
--
> S &

char bk_name[20]; -
> 20 .

3 sbute
- -
-

struct
--

{
short dd; >
-
2
-
-

short mm; - 2
-

short yy; -
> 2
}dt_of_purchase;
float price; - S
-
B
;
-
}; Book
-
a. Write a C++ statement to declare a variable to refer to the details of a
- - - -
book. What is the memory requirement of this variable? Justify your
- - - -
-

answer.
-
-

b. Write a C++ statement to initialise this variable with the details of your
- -
-

Computer Science text book.


-
c. The missing of structure tag in the inner structure does not cause any
-
error. State whether this is true or false. Give reason.
-

scien, 2003
G10!
" &

computer
3 .
Book B = S
➔ Read the following C++ statements.
Int *p, arr=5;
O
p=&arr;
-
Variabl
(i) What is the specialty of the variable p ? punter
-
&

-
(ii) What will be the content of p after the execution of second
---
-
statement ?
-
Adorns of our
it story
Read the C++ statements given below and answer the following
questions:
-
artob
int ar[] = {34,12, 25,56, 38};
- ,
int *p = ar;
-
Buse address of a
(a) What will be the content of p? -
(b) What is the output of the expression: *p + *(ar+2)?
- -


3 +=
(c) The statement ar++; is invalid. Why? How does it differ from
p++;?
➔ Compare the following two statements.
-
-

int a=5; - -

-
int *a=new -
int(5);
&
--
-

Ans: The statement int a = 5; declares and initializes a regular


-
integer variable with the value 5, -
-

while iint* a = new int[5];declares an integer pointer variable


and dynamically allocates memory for an array of 5 integers.
Read the structure definition given below and answer the
-
- --

following questions:
-

struct sample
-
-

{
int num; char *str;
} *sptr
-

Write C++ statements to dynamically allocate a location for


-
- -

sample type data and store its address in sptr.


- -

new sample :

Spar = S
➔ In C++, define a structure named ‘student’ with rollno, name
-
and mark as its members. -

Struct Student

E
Int Dolln ,

chor namezzo]
;

float marky
3
&
In C++ ________ operator is used to get the address of a
-
--
memory location.

#Address
-

of

value at

E
X= &
-

1 ,
Cont *
#
Differentiate between array and structure.
-

- -

- -
-

--

- -

-- -

- -

-
-
________ is the keyword
-
to define a structure.
-

Gust
What is Nested Structure ?

--
An element of a structure may itself be another structure. Such
a structure is known
as nested structure.

&
➔ (a) How will you free the allocated memory in C++ ?
Using delete operator - -
-

(b) Discuss any two reasons for memory leak


-
-
• Forgetting to delete the memory that has been allocated
dynamically (using new). -
-

- -

• Failing to execute the delete statement due to poor logic of


- -
the program code.
-
-

• Assigning the address returned by new operator to a pointer


- -
that was already pointing to an allocated object.
-
Which of the following operator is used for dynamic memory
allocation ?
(a) * (b) &
(c) new (d) delete
What is meant by self-referential structure ?
-

Self referential structure is a structure in which one of


-

the elements is a pointer to the same structure.

=
How does static memory allocation differ from dynamic memory
allocation ?
What is Memory Leak ?
Memory leak occurs when programmers allocate memory by
using the new operator and forgets to de-allocate the mem-
ory by using delete operator.
Structure is a _______ data type.
-

(a) Fundamental
(b) Derived
(c) User defined -
Define Structure

Ans : Structure is a user-defined data type of C++ to


represent a collection of logically related data items, which may
be of different types, under a common name.
Find and correct error in the program code given below :

-
int a = 5;
--

O
float *p;
p = &a;
cout << p;
-
Structure within structure termed as
Identify the errors in the following structure definition in C++.

struct
{
int roll=20;
char name[20];
};
Explain the working of the unary operators & and * in c++ with
the help of suitable example
What you mean by dynamic memory allocation ? Name the c++
operator for used for this. How does it works ?

➔ Memory is allocated during the execution of the program is


called Dynamic memory allocation

➔ It is facilitated by an operator, named new .


Syntax is :
pointer_variable = new data_type;
What are the advantages of character pointer ?
-
-

➔ Since there is no size specification, a string of any number


- -

of characters can be stored. There is no wastage or


-

insufficiency of memory space. But it should be done with


initialization. (e.g., char *str = "Program";)
-
➔ Assignment operator (=) can be used to copy strings.
--
- -

➔ Any character in the string can be referenced using the


-

concept of pointer arithmetic which makes access faster.


- -
➔ Array of strings can be managed with optimal use of
-
-
memory space.
-
Object Oriented Programing
Briefly explain about any three concepts of OOP

1. Object
2. Classes
3. Data abstraction
4. Data Encapsulation
5. Modularity
6. Polymorphism
7. Inheritance
The ability of a message or data to be processed in more than
- -
one form is called ________.
-w
(a) Polymorphism (b) Encapsulation
(c) Data abstraction (d) Inheritance
_______ are individual instances of class.

object
Write any two advantages of using object oriented
- -
programming over procedure-oriented programming

I
-
-

Ans : -

1. Data is given more importance -


- -

2. Provides modular programming -


-

3. Can define abstract datatypes -

--
4.Data hinding
-

5. Real life modeling L


-
List any four different forms of inheritance
-
-
-
-
-

- -
1. Single inheritance - one sub class is inherited by one base
- - -

-
class . -
2. Multiple inheritance - class have more than one base class .
- - -

3. Multilevel inheritance - a derived class created from another


-
derived class .
-
4. Hierarchical inheritance - more than one sub class is
-
-

- inherited from a single base class .


-

5. Hybrid inheritance- combining more than one type of


--
inheritance .
-
Identify the type of inheritance that has two base classes and
-
one derived class.
-
-

(a) Multi level inheritance (b) Multiple inheritance -


(c) Hierarchical inheritance (d) Hybrid inheritance

han -
an
--

& -

-
What is polymorphism in Object Oriented Programming ? Name
-

the two types of polymorphism.


- ~

Ans :
Polymorphism (from the Greek meaning ”having mul-
tiple forms”) is the ability to assign different meanings in
different contexts, to an entity such as object, function or
-

operator. Two types of polymorphism are compile time poly-


-
morphism and run time polymorphism.
-
How do the access labels of class data type implement data
-
hiding ?
-

Ans:
Data hiding is a process of combining data and func-

I
-
tions into a single unit. The access specifiers (labels) used
-

in C++ are Public,Private and Protected. In, Public all the


-
m -

members will be available to everyone. In private, the data


-
-
and function can’t be accessed by other classes. In protected,
- -
-

data and functions will only be available to the derived class.


- --
________ protect data from unauthorized access.
(a) Polymorphism
(b) Encapsulation
(c) Data abstraction
Write any two advantages of Object Oriented Programming
a. OOP provides a clear modular structure for programs.
b. It is good for defining abstract data types.
c. Implementation details are hidden from other modules and
have a clearly defined interface.
What do you mean by Inheritance in C ++ ?
Inheritance is the process by which objects of one class
acquire the properties and functionalities of another class
Write any 3 differences between Procedure oriented
programming and --object oriented programming
-

&
-

- -

- -

-
-
-
-
-
-
-
-
-

-
-

-
-
Explain Compile Time Polymorphism

Ans : Compile time polymorphism refers to the ability of the


compiler to relate or bind a function call with the function
definition during compilation itself.
1. Function Overloading : Function overloading is a feature of
object-oriented programming where two or more functions
can have the same name but different parameters.
2. Operator Overloading : Operator overloading is the concept
of giving new meaning to an existing C++ operator (like +, -,
=, * etc.).
Data Structures and Operations
Name the different end points of the data structure queue.
What are PUSH and POP operations in a Stack ?
In ________ data structure, the element added atlast will be
removed first
Briefly explain about POP operation in a STACK data structure
Describe about QUEUE data structure.
➔ In a data structure , First element is removed first is called
FIFO.
➔ A data structure that follow FIFO principle is known as
QUEUE .
➔ QUEUE has two end points - front and rear .
➔ Inserting a new data item in a queue will be at the rear
position and deleting will be at the front position .
Name the data structure that follows FIFO principle.
(a) Stack (b) Queue
(c) Array (d) Linked List
Explain the situations ‘overflow’ and ‘underflow’ in data
structure operations.

Overflow
Attempt to insert an item in a filled stacke or queue

Underflow
Attempt to remove an item from an empty stack or queue .
What is linked list ?

Ans :a linked list is a collection of nodes, where each node


consists of a data and a link - a pointer to the next node in the
list. That is, the first node in the list contains the first data item
and the address of the second node; the second node contains
the second data and the address of the third node; and so on.
struct Node
{
int data;
Node *link;
};
Explain Circular Queue ?
List operations on Data structure

1. Traversing
2. Searching
3. Insertion
4. Deletion
5. Sorting
6. Merging
WEB TECHNOLOGY
&&
WEB DESIGNING USING HTML
Name the attributes of <HTML> tag
What is a tag ? What are the different types of tags in HTML ?

Tags are the commands used in the HTML document that tell
web browsers how to format and organise our web pages to
show the contents. Every tag consists of a tag name enclosed
between the angle brackets '<' and '>' .
Differentiate between cellspacing and cellpadding
(a) Classify the following scripting languages into Client side
and Server side.
JavaScript, PHP, VBScript, ASP

(b) What is the use of <EMBED> tag in HTML ?


JavaScript -client side script
VB Script - Client side
PHP - Server side
Active Server Pages - Server side script
Java Server Pages - server side scripting
(a) Compare container and empty tags in HTML.
(b) List and explain any four text formatting tags in HTML.
(c) Mention the purpose of ‘src’ attribute in <IMG> tag.
Write the HTML code to create the following list : (3)
❏ RAM
❏ Registers
❏ Mother Board
Which attribute is used with <A> tag to specify the name of the
web page to be linked ?
The HTML tag used to specify a data item in a definition list in
a web page is ______
Distinguish between static web page and dynamic web page.
Write any two attributes used with <BODY> tag and specify
their effects in the webpage.
Write short note about the tags used to create a table in
HTML.
Write HTML code segment to create the target of the
hyperlink to the website http://www.dhsekerala.gov.in.

Ans :
<A Href= "http://www.dhsekerala.gov.in">Higher
Secondary Education</A>.
Differentiate between ordered and unordered lists in
HTML.
________ attribute of tag enables to change the
beginning value of the list.
Link to a particular section of the same document is
called ________.
Explain different tags used with <DL> tag to create
definition list.
Write an example for an email link using <A> tag ?
<A Href= mailto: "[email protected]"> SCERT</A>
Write an HTML code to create a table as shown below.
Explain the three types of lists that can be created in HTML
documents. Name the tags required for each.
Explain any three values of <input> tag
WRITE THE BASIC STRUCTURE OF HTML
<HTML>
<HEAD>
<TITLE> This is the title of web page </TITLE>
</HEAD>
<BODY>
Hello, Welcome to the world of web pages!
</BODY>
</HTML>
Create the following table
Explain software port number and service
Differentiate client side and server side scripting
Create the following form.
➢ Name the different types of communication on the web and explain
briefly. - H +P +

-
annmts
- -
Communication on the web are -
Cave
Client to web server communication
* XX
Web server to web server communication
-

In Client to web server communication, usually HTTP protocol is used. But for
security reason, in banking applications and email services HTTPS protocol is
used now. It encrypts data and send to the server.
Web server to web server communication also may be required in certain
web applications. For example, the communication between the web server
of an online shopping site and a bank web server. Here a special server called
Payment gateway acts as a bridge between merchant server and bank server
and transfers money in an encrypted format

Payment
=>
t
Payment y
=
-
What is a web server. 2 ~
-

Web server is the server computer that hosts websites. It is also used
- -

to refer to a web server software that is installed in a server computer.


-
-
A web server consists of a server computer that runs a server operating
system and a web server software installed on it.
Default port number of HTTPS is ______________
6
-

443

- -

- -

-
-

-
-
-
-

- -
Differentiate between static web page and dynamic web page.

I
- -

L
- -

-
-
- - -

- -
Explain DNS server

A DNS server runs a special purpose networking software that contains


-
a database of domain names and their IP addresses. The Domain Name
- -
System (DNS) runs on a-DNS server and returns the IP address of a
domain name requested by the client computer.

O keeps S
The number of bits in a software port number is _____.
-
a. 8 b. 16 c. 32 d. 64
-
Differentiate Client side and scripting language
- -

-
-
- -

- -
--

-
-
-

- -

-
--

- -

- -

-
Explain the different types of scripting languages.
Different types of scripting languages are
client side scripting languages.2
-

Server side scripting languages.

Client side scripting Languages – These are mainly used for validation of
data at client.
-
&
Javascript -
It is the most popular client scripting language, because it works in almost
every browser. JavaScript can be inserted inside HTML code or can be
written as an external file. Extension of a javascript file is ‘.js’
vbscript -
VBScript is a scripting language developed by Microsoft Corporation. It is
used either as a client side as well as server side scripting language.
-
Server side scripting Languages - Server side scripts are used to create
dynamic web pages.
-PHP

PHP stands for 'PHP: Hypertext Preprocessor'. The main objective of PHP is
to develop dynamic web pages at ease. Extension of a php file is ‘.php’.
-
JSP
JSP is a simple and fast way to create dynamic web page. JSP files have the
extension ‘.jsp’.
ASP
Prepare a short note on Cascading Style Sheet.
CSS is a style sheet language used to describe the formatting of a HTML
document. Using CSS, we can control the colour of the text, the style of
fonts, the spacing between paragraphs etc. CSS can be implemented in
three different ways - inline, embedded and linked.
What is the basic structure of an HTML document ? 2
-
<HTML> -
-
<HEAD>
<TITLE> This is the title of web page </TITLE> -
-
-

</HEAD> -
-
<BODY>
Hello, Welcome to the world of web pages!
-

</BODY> -

</HTML> -
What is a tag? What are the different types of tags in HTML? 2
-

Tags are the commands used in the HTML document. It tell browsers
- -
how to format and organise web pages.
The different types of tags are container tag and empty tag.
- -
Explain about container tag and empty tag. 2
Tags that require opening tag as well as closing tag are known as
container tags. -
-

Eg: <HTML>, <BODY>


-
< /HmL) <BODY
Tags that require only opening tag is known as empty tags.
-
Eg: <BR>, <IMG>, <HR>
-
Explain various attributes of <BODY> tag.
-

- -
Background – specifies an image as background of a web page.
-
Bgcolor - specifies a colour for the background of the web page.
-
Text - specifies the colour of the text in the web page. -
-
Link - specifies the colour of the hyperlinks that are not visited.
- -

Alink - specifies the colour of the active hyperlink.


- -

Vlink - specifies the colour of the hyperlink which is already visited.


-
-
List and explain any four text formatting tags in HTML. 2
-

<B> - Making text bold. -


-

<U> - Underlining the text. -


-

<SUB> - Creating subscripts.


-

<SUP> - creating superscripts.


-

L strong)
[I)
Smally
andStakes
[S]
< bis]
Loom)
Write HTML code to display the following in a web page
-

Sub) 2 /sub O
a) H <

2/sup) + b <Sup) 24 Sun)


<sup>
a
b
Write any two attributes of <FONT> tag and their effects in the web
page. - -
-
-
Color – specifies the colour of the font. -
-
-

Size - Specifies the size of the font.


- -

Face - specifies the font face.


-

&
Write HTML tag to set the colour of hyperlink to red
-
<body link =”red”>
---
Every web browsers has default colours to display text and hyperlink.
-
How can we change these default colours?
We can use the attributes text and link of body tag to change the
default colours of text and hyperlink.
<BODY text=”green” link=”yellow”> -
--
A web page is created to display the result of Engineering entrance
examination. - -

a) What type of webpage it is it?

Dynamic webpage, because the content (result) changes for each


-

candidate -

-
b) Mention any two features of it

1) Content and layout changes dynamically -

2) Uses database -
Write HTML tags used to insert comments in HTML web pages 2
Ans:
The comments in HTML are enclosed with in <!-- and --> tags
-
Write any two methods to include scripts
-
in HTML document. 2

1) Inside Head section -


We can include the scripts with in <HEAD> and </HEAD> tags.
-
2) Inside Body section -
We can include the scripts with in <BODY> and </BODY> tags
--
Explain the HTML tag <table> and its attributes.
<table> tag is used to create a table in HTML page.
-
Attributes of <table> tag are;
-
1) border – It used to show a border around the table. -
-
2) bgcolor – It Is used to set background colour of the table. -
-
3) background – It is used to set background --image of the table.
-
4) cellspacing – It is used to specify the amount of space between the
cells. -
-
5) cellpadding – It is used to specify the amount of space between the
cell border and its content -

-
Consider the following HTML 1 -

I
D. LaPtoP -
-
-
E. DesktoP
F. PRINTER -
What will be the value of START and TYPE attribute of <OL> tag
-
-
-

(a) START="D" TYPE="A">


-
(b) START="4" TYPE="A"> -
= -

(c) START="4" TYPE="I">


(d) START="D" TYPE="I">
Differentiate Cellspacing and Cellpadding. 2
Cellspacing specifies the amount space between each cells in a table.
Cellpadding specifies the amount space between cell border and cell
content
Develop a webpage to display the following login screen
<HTML>
<HEAD>
<TITLE>My Form </TITLE>
</HEAD>
<BODY>
<FORM name = “form1”>
Application No <INPUT type=”text” MIN =”10000” MAX =”99999”><BR>
Password <INPUT type=”password” MAXLENGTH=”8”><BR>
<INPUT type =”submit” value =”Login”>
</FORM>
</BODY>
</HTML>
Write the complete HTML tag that links the text “PSC” to the website
“www.keralapsc.org”.
<a href = “www.keralapsc.org”> PSC </a>
Explain nesting of frameset with an example. 3
-
A frameset used with in another frameset is called nesting of frameset.
Eg:

I
<FRAMESET rows=”50%,50%”>
-
-
-

<FRAMESET cols=”50%,50%”>
- -
-
-

<FRAME src=”a.html”>
-
C -

<FRAME src=”b.html”>
-

</FRAMESET> --

<FRAME src=”c.html”>
-

</FRAMESET>
-
What is the use of frame tag in HTML? what is its limitation?
--

<frame> is used to represent a frame in a frameset.


-

Its hard to navigate through pages in frames


-
-

< frames
& I 2

[Tabb)

CTR)
Students (H)
of
colspin = "2")
No .

CTH

< /TR)
<+ R)

I
<+ R)

<+ H)
Scienc C/TH)
CTH) Hencet C/TH)

<+D) 55 </tD <TD) 58(/D)

</TR) < ITR)

< + R) #Tabb)
comms 1/H -

LTHY
GOLHD)
< TD)
2/+ RY
__________ tag in HTML is used to create a drop-down list. 1
a) SELECT b) OPTION c) INPUT d) LIST
Pick out the odd one
(a) BODY (b) HTML (c) HEAD (d) ALIGN
-
-

tas ↓
but
Name the following tags
-

(a) To include a button in HTML -


-

Ans: <button> tag -


-

(b) To partition the browser window


-

<frameset> or <div> tags


-

-
-
Name the intellectual property represented by the symbols ®, © 1
® - Used for Registred intellectual property
-

© - Used for Copyright intellectual propert


- -

--

--

--

-
Write the use of the following in HTML 2
a) <A href=”http://www.dhsekerala.gov.in”>DHSE</A>
It creates a link shows “DHSE” to the website
”http://www.dhsekerala.gov.in”
b) <EMBED src =”song1.mp3”></EMBED>
It includes an audio file ”song1.mp3” into the webpage
Name the tag and attribute needed to create the following lists in
-

HTML -

-
-


-
-

&
-

&

"1lY
a) COLTypc =

"Save")
TYRS =
b) COL
Write the output of the following HTML code; 2
<OL type = "I" Start="10">
<LI> keyboard </LI>
<Ll> mouse</LI>
<LI> light pen </LI>
Explain any two types of lists in HTML.
Ans:
1) Ordered List
In this list, items are displayed in a numerical or alphabetical order.
The tags used for ordered list are <OL> and <LI>
Attributes of <OL> tag are type and start.
2) Un ordered List
In this list, items are displayed with a special graphical symbol such as
circle, square, etc.
The tags used for un ordered list are <UL> and <LI>
Attribute of <UL> tag is type
Write the HTML code to display the following using list tag 2
(i) Biology Science
(ii) Commerce
(iii) Humanities
Describe any four values of type attributes of the <INPUT> Tag in HTML.
1) text - Is used to create a textbox.
2) password - Is used to create a password box.
3) radio - Is used to create a radio button
4) checkbox - Is used to create a checkbox
Consider the following HTML code and answer the following;
<EM> COMPUTER </EM> <BR>
<STRONG> APPLICATION </STRONG> <BR>
<HR>
(a) Name the tag used to make the text as italics and bold in the above code. (l)
Ans: <EM> and < STRONG>
(b) What is the purpose of <HR> tag? Explain its any two attributes. (2)
Ans: <HR> tag is used to draw a horizontal line in the HTML page.
Its attributes are;
1) width – It specifies the width of horizontal line.
2) height – It specifies the thickness(height) of horizontal line.
(c) Write the HTML statement to scroll the text given in <EM> from top to bottom. (
Ans:
<MARQUEE direction = “down”> COMPUTER </MARQUEE>
Name any two attributes of the following tags. 3
a) <HTML>
Ans: 1) dir
2) lang
b) <MARQUEE>
Ans: 1) direction
2) Scrolldelay
c) <FONT>
Ans: 1) size
2) color
Name the three essential tags for creating a table in HTML. Write the
purpose of each tag. 3
1) <TABLE>
It is used for creating a table in HTML.
2) <TR>
It is used for creating table row in HTML.
3) <TD>
It is used for creating a table column or cell in HTML
Which is the tag used to create a line break in a HTML page?
Write the name of tag used to group related data in an HTML 1
<FIELDSET> tag
-
-

© Department of Education
-

a <Sup> 2 </Supt
(a+
</Sup)
a)
=
< >up)2

b <sup> 2 </sun>
zab+

Department of Education.
b) &copy;
Name any two server-side scripting language. 1
ASP – Active Server Pages -
-

JSP – Java Server Pages -


-

PHP – Php Hypertext Preprocessor -


-
A link to a particular section of the same document is called ______
Identify the errors in the following HTML code:
(a) <UL type = “A” start = 5>
(b) <h1><b>web programming </b></i></h1>
(c) <img src = ‘Profile.jpg’ size = 50 >
(d) <a href=”[email protected]”>
(e) <frameset rows=”50%,25%,25%”>
<frame src= “1.html”>
<frame src= “2.html”>
</frameset>
NORESIZE is an attribute of ____ tag.
Categorize the following tags in HTML appropriately.
<br>, <h1>, <img>, <table>
DATA
STRUCTURE
-
Part 1
Definition
Data structure is a particular way of organising
=
similar or dissimilar logically related data items
which can be processed as a single unit.
- -

Data Stuctures
- -
Simple Data Stuctures Compound Data Stuctures

- -

Array Structure Linear Non-Linear

-------
Linked List
Tree
Queue

Stack Graph
Operations on Data structure
- -
1. Traversing : Traversing is an operation in which each
element of a data structure is visited. The travel proceeds
from the first element to the last one in the data structure.

-
2. Searching : Searching, in the literal sense, is the process
of finding the location of a particular element in a data
structure. In other words, searching implies accessing the
values stored in the data structure.
-
3. Inserting :
Insertion is the operation in which a new data is added at a
particular place in a data structure. In some situation, where
the elements in the data structure are in a particular order, the
position may need to be identified first and then the insertion
is to be done.
-
4. Deleting : Deletion is the operation in which a particular
element is removed from the data structure. The deletion is
performed either by mentioning the element itself or by
specifying its position.
-
5. Sorting :
We are familiar with the sorting of an array using two
methods named bubble sort and selection sort. It is
the technique of arranging the elements in a
specified order, i.e., either in ascending or
descending order. Sorting of elements in a data
structure makes searching faster.
-
6. Merging : Merging usually refers to the process of
combining elements of two sorted data structures to
form a new one.
Stack -

In Data structure Last element is removed first . This


organising principle is known as Last-In-First-Out
(LIFO).
-

The data structure that follows LIFO principle is known


as stack.

It is an ordered list of items in which all insertions and

- - -
deletions are made at one end, usually called Top.

Since it follows the LIFO principle, the element added at


last will be the first to be removed from the stack.
Operations on stack

T
W
1. PUSH
2. POP

Overflow -
Attempt to insert an item in a Filled stack or queue.
-

Underflow -
Attempt to remove an item from an empty stack or queue .
-
·
1.Push OPERATION
Push operation is the process
of inserting a new data item
into the stack .

Start
1: If (TOS<N) Then
2: 𝑇𝑂𝑆 = 𝑇𝑂𝑆 + 1 \\ Space avallability checking (Overflow)

3: STACK[TOS] = VAL
4: Else
5: Print "Stack Underflow"
TOS = O
6: End of If
-
-
End

Stackebe25 toso
New New New New New
Item Item Item Item Item
9 9 9 9 9
25 34 18 56
8 8 8 8 8

7 7 7 7 7
New New New New New
Item 6 Item 6 Item 6 Item 6 Item 6
3 0 1 2 3
5 5 5 5 5

4 4 4 4 4

3 3 3 3 TOS 3 56

2 2 2 TOS 2 18 2 18

1 1 TOS 1 34 1 34 1 34

0 TOS 0 25 0 25 0 25 0 25
Stack Stack Stack Stack Stack
TOS

Empty Stack Added 1st Stack Added 2nd Stack Added 3rd Stack Added 4th Stack
#
1.POP OPERATION
The process of deleting an
element from the top of a
stack is called Pop operation

Start
1: If (TOS ⟩ − 1) Then
2:
3:
-
VAL = STACK [TOS]
TOS = TOS -1
\\ Empty status checking (Underflow) E

4: Else
5: Print "Stack Underflow"
6: End of If
2

tos-
End

STACk[
To = 2 - 1=
1
New New New
Item Item Item
9 9 9
56 18 34
8 8 8

7 7 7
New New New
Item 6 Item 6 Item 6
2 1 0
5 5 5

4 4 4

3 56 3 3

TOS 2 18 2 18 2

1 34 TOS 1 34 1 34

0 25 0 25 TOS 0 25
Stack Stack STK[10]
After the retrievel of After the retrievel of After the retrievel of
Item TOS becomes 2 Item TOS becomes 1 Item TOS becomes 0
C++ Functions for Stack Operations
The Variables tos and n are assumed as global variables

PUSH Operation POP Operation


void push(int stack[],int val) int pop(int stack[])
{ {
i f (t o s < n) int val;
{ i f (t o s > - 1)
tos++; {
s t a c k[t o s]= v a l ; v a l =s t a c k [t o s];
q[r e a r]= v a l ; tos--;
} }
else else
c o u t << ” O v e r f l o w ” ; c o u t << ” U n d e r f l o w ” ;
} return val;
}
DATA
STRUCTURE
Part 2
Queue
In a data structure , First element is removed first is called FIFO.
-

A data structure that follow FIFO principle is known as QUEUE .


-
QUEUE has two end points - front and rear .
- - -
Inserting a new data item in a queue will be at the rear position
and deleting will be at the front position . -
-

Front Rear
0 4

QUEQUE 16 38 9 65
0 1 2 3 4 5 6 7 8 9
Operations on queue
1. Insertion
2. Deletion
I
1. Insertion
Insertion is the process of adding a new item into a queue at the
rear end. The value of Rear is incremented first to point to the
next location and the element is inserted at that position.
Algorithm: To perform INSERTION operation in a queue

Consider an array QUEUE[N] that implements a queue, where N is the maximum size of
the array. The variables FRONT and REAR keep track of the front and rear positions of the
queue. A data item available in the variable VAL is to be inserted into the stack. The steps
required for insertion operation are given between the Start and Stop instructions.

I
Start
1: If ( REAR = −1) Then
2: FRONT = REAR = 0 //Empty status checking

3: Q [REAR] =VAL
4: Else If ( REAR < N) Then //Space availability checking

5: REAR = REAR +1
6: 𝑄Q [REAR] =VAL
7: Else
8: Print "Queue Overflow"
9: End of If
Front Rear
-1 -1
QUEQUE EMTY QUEQUE

0 1 2 3 4 5 6 7 8 9

New Item
Front 25 Rear
0 0
QUEQUE 25 1st term is
inserted
0 1 2 3 4 5 6 7 8 9

New Item
Front 16 Rear
0 1
QUEQUE 25 16 2st term is
inserted
0 1 2 3 4 5 6 7 8 9

New Item
Front 38 Rear
0 2
QUEQUE 25 16 38 3st term is
0 1 2 3 4 5 6 7 8 9 inserted
2. Deletion
Deletion operation is the removal of the item at the front end. After
the deletion the value of Front is incremented by 1.
Algorithm: To perform DELETION operation in a queue

Consider an array QUEUE[N] that implements a queue with a maximum of N elements.


The variables FRONT and REAR keep track of the front and rear positions of the queue. The
data item removed from the queue will be stored in the variable VAL. The steps required
for deletion operation are given between the Start and Stop instructions.

&
Start
1: If (FRONT >-1 AND FRONT < REAR) Then
2: 𝑉𝐴𝐿 = 𝑄[𝐹𝑅𝑂𝑁𝑇] //Empty status checking

3: FRONT = FRONT +1
4: Else // Checking the deletion of last element

5: Print "Queue Underflow"


6: End of If
7: If (FRONT > REAR) Then
8: 8: FRONT = REAR = −1
9: 9: End of If
Retrieved Item
Front 25 Rear
1 2
QUEQUE 25 16 38 2st term is
retrieved
0 1 2 3 4 5 6 7 8 9

Retrieved Item
Front 38 Rear
2 2
QUEQUE 16 38 3st term is
0 1 2 3 4 5 6 7 8 9 retrieved
C++ Functions for Queue Operations
The Variables n, front and rear are assumed as global variables

INSERTION Operation DELETION Operation


void ins_q(int queue[],int val) int del_q(int queue[])
{ {
i f (r e a r == - 1) int val
{ i f (r e a r == - 1)
front=0; {
rear=0; v a l = q[f r o n t];
q[r e a r]= v a l ; fro nt++;
{ }
e l s e (i f r e a r < n) else
{ c o u t << ” O v e r f l o w ” ;
re ar++; i f (f r o n t > r e a r)
q[r e a r]= v a l ; {
} fro nt=-1;
else re a r=-1
c o u t << ” O v e r f l o w ” ; }
} return val;
}
Circular QUEUE z
Consider a Linear Queue,

Front
0 ↓
↓ ↓
Rear
4

QUEQUE 87 42 64

0 1 2 3 4 5 6 7
101
8 9
>

which six deletion operations are done. At present, there are only
three elements. Obviously, the value of Front is 6 and that of
Rear is 8.
Even though the first six locations are free, we can insert only one
element according to the insertion algorithm. Imagine the worst
situation that there is only one element at the last position of the
queue (say at 9). If we try an insertion operation in this queue, there
will be overflow situation. This limitation of linear queue can be
overcome by circular queue.
In Circular Queue , it follows FIFO principle and last position is
connected back to the first position to make a circle .

56 29 56 29
3 4 3 4

47 35 47 35
2 5 2 5

1 6 1 6
13

-i +
0 7 0 7
25

, ,
Rear gets the lower
Rear gets its highest value
bound value
56 29 56 29
3 4 3 4

47 35 47 35
2 5 2 5

1 6 1 6
87 87

+ o
0 7 0 7
64 18 64

Rear gets the lower


Rear gets its highest value
bound value
Assume that two deletions are performed at this stage.

So the value of Front will be 2 and now we have four free


locations.

The subscripts of these position are 6, 7 and then 0, 1.

If we insert two elements one by one, the value of Rear becomes


7, but still we have two free locations with subscripts 0 and 1.

So insertion operation can be performed again. This time the


value of Rear should be set with 0 first and then insertion is to
be carried out.
Linked List
-

Linked list is a collection of nodes, where each node consists of


-
a data and a link - a pointer to the next node in the list.
-

- -
That is, the first node in the list contains the first data item and
the address of the second node

The second node contains the second data and the address of
the third node; and so on.

The last node at a particular stage contains the last data in the
list and a null pointer

First node address contains in start or head node .


25 34 17 48 64
Node 1 Node 2 Node 3 Node 4 Node 5

Implementation of linked list

-
START
1000

struct Node SONU 1200

{
1000

int data;
NIVED 1300
1200

Node *link; SNEHA 1500 3


};
1300

NIKETH

=
NULL
1500
Eg :
struct Node
{
char data[10];
Node *link;
}
Operations of Linked List
1. Creation of linked list
2. Traversing a linked list
3. Inserting in a linked list
4. Deleting from Linked list
1. Creation of linked list

Step 1: Create a node and obtain its address.

Step 2: Store data and NULL in the node.

Step 3: If it is the first node, store its address in Start.

Step 4: If it is not the first node, store its address in the link part
of the previous node.

Step 5: Repeat the steps 1 to 4 as long as the user wants.


2. Traversing a linked list

Step 1: Get the address of the first node from Start and store it in
Temp.

Step 2: Using the address in Temp, get the data of the first node
and store in Val.

Step 3: Also get the content of the link part of this node (i.e., the
address of the next node) and store it in Temp.

Step 4: If the content of Temp is not NULL, go to step 2; otherwise


stop.
3. Insertion in a linked list
Step 1: Create a node and store its address in Temp.

Step 2: Store the data and link part of this node using Temp.

Step 3: Obtain the addresses of the nodes at positions (POS-1) and


(POS+1) in the pointers PreNode and PostNode respectively, with the
help of a traversal operation.

Step 4: Copy the content of Temp (address of the new node) into the link
part of node at position (POS-1), which can be accessed using PreNode.

Step 5: Copy the content of PostNode (address of the node at


position POS+1) into the link part of the new node that is pointed to
by Temp.
4. Deleting from linked list

Step 1: Obtain the addresses of the nodes at positions (POS-1) and


(POS+1) in the pointers PreNode and PostNode respectively, with the
help of a traversal operation.

Step 2: Copy the content of PostNode (address of the node at


position POS+1) into the link part of the node at position (POS-1),
which can be accessed using PreNode.

Step 3: Free the node at position POS.

You might also like