Describe the <img> and <a> tag with example.(2079 BICTE 5Marks)
The <img> tag is used in HTML to insert and display images on a web page. It is an empty tag and does not have a closing tag. The image source is specified using the src attribute, while the alt attribute provides alternate text if the image cannot be displayed. Attributes like width and height are used to control the size of the image on the web page.
Example: <img src="image.jpg" alt="Sample Image" width="200" height="150">
The <a> tag, also called the anchor tag, is used in HTML to create hyperlinks. It allows users to navigate from one web page to another or to different resources. The destination address of the link is defined using the href attribute, and the clickable text is written between the opening and closing <a> tag.
Example: <a href="https://www.google.com">Visit Google</a>
How is HTML differs form CSS? Explain the ways for inserting CSS code into HTML file.(2079 BICTE 5Marks)
HTML and CSS are used together to create web pages but they have different purposes. HTML (HyperText Markup Language) is used to create the structure and content of a web page such as headings, paragraphs, images, links, tables, etc. CSS (Cascading Style Sheets) is used to control the presentation and appearance of the web page such as colors, fonts, layout, spacing, and alignment. HTML defines what content appears on the page, while CSS defines how that content looks. HTML uses tags, whereas CSS uses selectors and style rules.
There are three ways to insert CSS code into an HTML file.
Inline CSS is written directly inside an HTML element using the style attribute. It affects only that single element.
Example: <p style="color:red;">Hello</p>
Internal CSS is written inside the <style> tag within the <head> section of the HTML file. It affects the entire page.
Example: <style> p { color: blue; } </style>
External CSS is written in a separate .css file and linked to the HTML file using the <link> tag. It is best for large websites.
Example: <link rel="stylesheet" href="style.css">
What is media query? Explain how to create a responsive web page with example.(2079)
A media query is a CSS technique used to apply different styles to a web page based on the device screen size, resolution, or orientation. It helps in making web pages responsive so that they adjust properly on mobile phones, tablets, and desktops. Media queries are written using the @media rule in CSS.
A responsive web page is created by using flexible layouts, relative units, and media queries so that the content adapts to different screen sizes.
Example:
HTML:
<div class="box">Responsive Page</div>
CSS:
.box { width: 100%; background-color: lightblue; padding: 20px; font-size: 20px; }
@media screen and (max-width: 600px) { .box { background-color: lightgreen; font-size: 14px; } }
In this example, the media query changes the style of the web page when the screen width is 600px or less, making the page suitable for mobile devices.
Create a HTML form for student information to enter marks in five subjects and write a javascript code to find total, average, result and grade.(2079)
or Shortest
✅ 1) Using name (document.f.field)
✅ 2) Using id (getElementById)
What are the advantages and disadvantages of sung CSV file format? Explain how to Display data from a CSV file using PHP.(2079)
Advantages of CSV file format:
-
Simple and easy to read.
-
Supported by most applications like Excel, Notepad, databases.
-
Lightweight and takes less storage.
-
Easy to import/export data between programs.
Disadvantages of CSV file format:
-
Cannot store complex data like images or formulas.
-
No support for data types; all data is treated as text.
-
No built-in validation or structure.
-
Large files can be slow to process.
Displaying data from a CSV file using PHP:
PHP provides functions like fopen(), fgetcsv(), and fclose() to read CSV files. Example:
Define array. Explain about the types of Arrays in PHP with examples.(2079)
An array in PHP is a variable that can store multiple values under a single name. Each value in an array is called an element, and it can be accessed using an index or a key.
Types of Arrays in PHP:
-
Indexed Array:
An array with numeric indexes starting from 0.
Example:
-
Associative Array:
An array where each key is a custom string.
Example:
-
Multidimensional Array:
An array containing one or more arrays.
Example:
Differentiate mysql_fetch_row() and mysql_fetch_array() function.(2079)
mysql_fetch_row() vs mysql_fetch_array()
|
Feature |
mysql_fetch_row() |
mysql_fetch_array() |
|
Returns |
Returns
a numeric array (indexed by numbers) |
Returns an
array that can be numeric, associative, or both |
|
Access |
Values are
accessed using numeric indexes |
Values can be
accessed using column names or numeric indexes |
|
Memory |
Uses less
memory |
Uses more
memory because it stores both numeric and associative keys |
|
Example |
$row =
mysql_fetch_row($result); echo $row[0]; |
$row =
mysql_fetch_array($result); echo $row['column_name']; |
Summary:
-
Use
mysql_fetch_row()for simple numeric access and better memory efficiency. -
Use
mysql_fetch_array()when you need flexibility to access data by column name or index.
How PHP and MYSQL are related? Explain how to execute mysql "insert and select" query and fetch results stu_roll, stu_name, stu_address from database table "students" using PHP.(2079)
Relation between PHP and MySQL:
PHP is a server-side scripting language used to create dynamic web pages, while MySQL is a database management system used to store and manage data. PHP can connect to MySQL, execute queries, and fetch or manipulate data. Together, they allow developers to build data-driven websites.
Executing MySQL Queries in PHP:
-
Insert Query Example:
-
Select Query and Fetch Results Example:
Explanation:
-
mysqli_connect()– Connects PHP to MySQL. -
mysqli_query()– Executes SQL queries. -
mysqli_fetch_assoc()– Fetches each row as an associative array. -
mysqli_close()– Closes the database connection.
What do ou mean by responsive CSS? What are its advantages?(2078)
Responsive CSS:
Responsive CSS is a technique used to make a web page adjust automatically according to the screen size, resolution, and device type (desktop, tablet, or mobile). It ensures that the web page looks good and functions properly on all devices. Media queries in CSS are commonly used to achieve responsiveness.
Advantages of Responsive CSS:
-
Provides a better user experience on all devices.
-
Reduces the need for multiple versions of the same website.
-
Improves SEO ranking because Google prefers mobile-friendly sites.
-
Saves time and cost in development and maintenance.
-
Makes websites flexible and adaptable to future devices.
What is session in PHP? How is it different from cookies?(2078)
Session in PHP:
A session in PHP is a way to store information (variables) on the server for a particular user. It allows data to be used across multiple pages during a user’s visit. Sessions are temporary and usually expire when the user closes the browser.
Difference between Session and Cookie:
|
Feature |
Session |
Cookie |
|
Storage |
Stored
on server |
Stored
on client’s browser |
|
Security |
More secure |
Less secure,
can be modified by user |
|
Size Limit |
Can
store larger data |
Limited to
about 4 KB |
|
Expiry |
Ends when
browser is closed (or set manually) |
Can have a
specific expiry time |
|
Access |
Accessible
only on the server |
Accessible
on client and server |
Write short notes on AMP, server side scripting language and static website.(2078)
AMP (Accelerated Mobile Pages):
AMP is a web technology that allows web pages to load faster on mobile devices by using a simplified HTML and optimized CSS. It improves user experience and SEO on mobile platforms.
Server-Side Scripting Language:
A server-side scripting language is executed on the web server before the page is sent to the user’s browser. Examples include PHP, ASP, and Python. It is used to generate dynamic content, handle forms, and interact with databases.
Static Website:
A static website consists of fixed web pages written in HTML and CSS. The content does not change dynamically. It is simple, fast, and easy to host, but cannot interact with databases or provide personalized content.
What do you mean by event handler in javascript? Write script to show it.
An event handler is a function or code that responds to user actions on a web page, such as clicking a button, moving the mouse, typing, or loading a page. Event handlers allow web pages to be interactive.
Example Script:
Explanation:
-
The
onclickattribute is an event handler for the button. -
When the user clicks the button, the function
showMessage()is executed. -
The function shows a popup alert.
Event Handler in JavaScript:
An event handler is a function or code that responds to user actions on a web page, such as clicking a button, moving the mouse, typing, or loading a page. Event handlers allow web pages to be interactive.
Example Script:
Explanation:
-
The
onclickattribute is an event handler for the button. -
When the user clicks the button, the function
showMessage()is executed. -
The function shows a popup alert.
Write about scope of variable in PHP. How can you pass value by reference in function ? Give example.(2078)
Scope of Variable in PHP:
The scope of a variable in PHP defines where the variable can be accessed in the program.
-
Local Scope: Variables declared inside a function can only be used within that function.
-
Global Scope: Variables declared outside any function can be used anywhere in the script if declared
globalinside a function. -
Static Scope: Variables declared as
staticinside a function retain their value between function calls.
Passing Value by Reference in Function:
In PHP, you can pass a variable by reference so that the function modifies the original variable instead of a copy. Use & before the parameter.
Example:
Explanation:
-
$numis passed by reference using&. -
The original
$valueis modified inside the function.
Differentiate between GET and POST.(2078)
|
Feature |
GET |
POST |
|
Data
Transmission |
Sent via URL |
Sent via HTTP
request body |
|
Security |
Less secure,
visible in URL |
More secure,
not visible in URL |
|
Data Limit |
Limited (URL
length restriction) |
No
significant limit |
|
Use |
Used for retrieving
data |
Used for sending
or submitting data |
|
Bookmarking |
Can be bookmarked |
Cannot be
bookmarked |
|
Speed |
Faster |
Slightly
slower due to larger data handling |
Write about any three database function of PHP with syntax.(2078)
Three Database Functions of PHP:
-
mysqli_connect() – Used to connect PHP with MySQL database.
Syntax:
-
mysqli_query() – Used to execute SQL queries on the database.
Syntax:
-
mysqli_fetch_assoc() – Used to fetch a result row as an associative array.
Syntax:
Explanation:
-
mysqli_connect()establishes the connection. -
mysqli_query()runs queries like SELECT, INSERT, UPDATE. -
mysqli_fetch_assoc()retrieves query results row by row in an associative array format.
| A | B | C |
| D | E | |
| F | ||
CSS Layout:
CSS layout refers to the way HTML elements are positioned and arranged on a web page using CSS. It controls the structure, alignment, and spacing of elements to create visually organized pages.
Types of CSS Layouts:
-
Normal Flow / Static Layout:
-
Default layout where elements appear one after another in the order they are written in HTML.
Example:
-
Float Layout:
-
Uses the
floatproperty to position elements left or right. Commonly used for multi-column layouts.
Example:
-
Flexbox Layout:
-
Uses
display: flex;to align and distribute elements in a row or column.
Example:
-
Grid Layout:
-
Uses
display: grid;to create a 2D layout with rows and columns.
Example:
Define HTML lists? Explain different types of lists with examples.
HTML Lists:
HTML lists are used to display a collection of items in an organized way. Lists make content easier to read and understand.
Types of HTML Lists:
-
Ordered List (
<ol>):
-
Displays items in a numbered order.
-
Each item is placed inside a
<li>tag.
Example:
-
Unordered List (
<ul>):
-
Displays items with bullets.
-
Each item is placed inside a
<li>tag.
Example:
-
Definition List (
<dl>):
-
Displays items as terms and definitions.
-
<dt>defines a term,<dd>defines its description.
Example: