0% found this document useful (0 votes)
15 views12 pages

Short Answers

The document provides an overview of PHP, XML, JavaScript, jQuery, AJAX, and the CodeIgniter framework, covering definitions, purposes, features, and examples of various concepts. Key topics include variables, forms, predefined variables, XML structure, JavaScript functions, and MVC architecture in CodeIgniter. It also discusses AJAX as a technique for dynamic web applications and the use of XMLHttpRequest for server communication.

Uploaded by

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

Short Answers

The document provides an overview of PHP, XML, JavaScript, jQuery, AJAX, and the CodeIgniter framework, covering definitions, purposes, features, and examples of various concepts. Key topics include variables, forms, predefined variables, XML structure, JavaScript functions, and MVC architecture in CodeIgniter. It also discusses AJAX as a technique for dynamic web applications and the use of XMLHttpRequest for server communication.

Uploaded by

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

1. Define variable.

A variable in PHP is a named container used to store data like numbers, strings, or arrays. It
begins with a dollar sign $, followed by the variable name.
Example:

$name = "Nutan";
$age = 21;

2. Give the purpose of form.

A form is used to collect user input from a web page. It allows interaction between the user
and the server (e.g., submitting login details, feedback, etc.).

3. List predefined variables in PHP.

Predefined variables in PHP (also called superglobals):

 $_GET
 $_POST
 $_REQUEST
 $_SERVER
 $_FILES
 $_SESSION
 $_COOKIE
 $_ENV
 $GLOBALS

4. What is the purpose of POST and GET methods in forms in PHP?

 GET: Sends data via the URL. Used for simple queries (e.g., search).
 POST: Sends data in the request body. Used for secure or large form data (e.g.,
passwords, file uploads).

5. Which file is used to configure the behaviour of PHP?

The file used is php.ini, which controls settings like error reporting, upload limits, and
default timezone.

6. Define sticky form.


A sticky form retains the values entered by the user even after the form is submitted, usually
in case of validation errors.
Example:

<input type="text" name="name" value="<?php echo $_POST['name'] ?? ''; ?>">

7. Give the purpose of error_log().

The error_log() function is used to log error messages to a file or system log, helping
developers debug applications.

8. Which array is used for file uploading?

The $_FILES array is used to handle file uploads via forms.


Example: $_FILES['upload']['name']

9. Give the purpose of header().

The header() function sends raw HTTP headers. It’s used to:

 Redirect pages (header("Location: welcome.php");)


 Set content type (header("Content-Type: application/json");)

10. Define cookies.

A cookie is a small piece of data stored on the client’s browser, used to remember
information across page requests.
Example:

setcookie("user", "Nutan", time() + 3600);

11. What is the use of trigger_error()?

trigger_error() is used to manually generate a custom error message during runtime.


Example:

if ($age < 18) {


trigger_error("Age must be above 18");
}

12. Define session.


A session is a way to store information (e.g., user login) across multiple pages for the same
user.
It uses a unique session ID.

13. Define error.

An error is a mistake in the script that can stop the execution or cause incorrect output.
Types include syntax errors, runtime errors, and logical errors.

14. Enlist techniques for maintaining the state.

 Cookies
 Sessions
 Hidden form fields
 URL parameters (Query Strings)

1. What is XML?

XML (eXtensible Markup Language) is a markup language designed to store and transport
data in a human-readable and machine-readable format. It focuses on data structure and
sharing across different systems.

2. What is SimpleXML?

SimpleXML is a PHP extension that allows easy and efficient manipulation of XML data. It
provides an object-oriented way to read, traverse, and edit XML documents with less code.

3. List major parts of XML.

 XML Declaration (e.g., <?xml version="1.0"?>)


 Elements (e.g., <name>)
 Attributes (e.g., <user id="101">)
 Text content
 Comments (<!-- This is a comment -->)
 CDATA Sections
 Namespaces (optional)
4. Give any two syntax rules for XML.

 XML documents must have a root element.


 All tags must be properly closed.
Example: <title>Example</title>

5. What is CDATA?

CDATA (Character Data) is a section in XML where characters are not parsed by the
parser. It’s used to include special characters (like <, &, etc.) without them being treated as
markup.
Example:

<note><![CDATA[This <text> is raw & unparsed]]></note>

6. What is structure of XML?

A basic XML structure includes:

 XML declaration
 Root element
 Nested child elements with data
Example:

<?xml version="1.0"?>
<book>
<title>Web Tech</title>
<author>Nutan</author>
</book>

7. Give relationship between XML and PHP.

PHP provides extensions like SimpleXML, DOMDocument, and XMLReader to:

 Read, create, and modify XML files


 Validate XML data
 Use XML for config files, data exchange, or API communication

8. Define XML parser.

An XML parser is a program or library that reads XML data and makes it accessible to
programming languages. It checks for well-formedness and sometimes validity of the XML.
9. Define DOM.

DOM (Document Object Model) is a way to represent XML as a tree structure where
every node is an object. Using DOM, developers can navigate, modify, and manipulate the
XML structure programmatically.

10. Enlist parts of XML document.

 XML Declaration
 Root Element
 Child Elements
 Attributes
 Text Content
 CDATA Sections
 Comments
 Processing Instructions

1. What is JavaScript?

JavaScript is a client-side scripting language used to create dynamic, interactive content on


websites. It runs in the browser and allows actions like validation, animation, DOM
manipulation, and event handling.

2. List any two features of JavaScript.

 Lightweight & Interpreted: Executes directly in the browser without needing


compilation.
 Event-Based Programming: Responds to user actions like clicks, keypresses, etc.

3. What is jQuery?

jQuery is a fast, small, and feature-rich JavaScript library that simplifies HTML DOM
manipulation, event handling, animations, and Ajax interactions.
4. Enlist any two features of jQuery.

 Cross-browser compatibility
 Simplified DOM traversal and manipulation

5. Define variable in JavaScript.

A variable in JavaScript is a container for storing data values.


Syntax: let name = "Nutan";

6. List data types in JavaScript.

 String
 Number
 Boolean
 Object
 Undefined
 Null
 Symbol (ES6)
 BigInt (ES11)

7. Define regular expressions in JavaScript.

A Regular Expression is a pattern used to match character combinations in strings.


Example: /[a-z]/ matches any lowercase letter.

8. Define operator in JavaScript with example.

Operators are symbols used to perform operations on operands.


Example: + is an arithmetic operator.

let sum = 10 + 5; // Output: 15

9. List control statements in JavaScript.

 if, if...else, switch


 for, while, do...while
 break, continue
 try...catch
10. Define loop.

A loop is a control structure that repeats a block of code multiple times.

11. What is the purpose of switch statement in JavaScript?

The switch statement is used to execute different blocks of code based on the value of a
variable or expression.

12. What is the purpose of break and continue statements in JavaScript?

 break: Exits the current loop or switch block.


 continue: Skips the current iteration and continues with the next.

13. Define function in JavaScript.

A function is a reusable block of code designed to perform a specific task.


Syntax:

function greet() {
alert("Hello!");
}

14. Define events in JavaScript.

Events are actions that occur in the browser, like clicks, keypresses, form submits, etc.,
which can be handled using JavaScript.

15. Define string in JavaScript.

A string is a sequence of characters enclosed in quotes.


Example:

let name = "JavaScript";

16. List any two functions of string in JavaScript.

 length → Returns the length of string


 toUpperCase() → Converts to uppercase

17. What is meant by popup boxes in JavaScript?

Popup boxes are used to display messages or get input from users.
Types: alert(), confirm(), prompt()

18. Give two ways to use jQuery.

 Include from CDN (e.g., Google, jQuery CDN)


 Download and host locally

19. Define selector in jQuery.

Selectors in jQuery are used to select and manipulate HTML elements.


Example: $("#id"), $(".class"), $("p")

20. List any two DOM manipulation methods in jQuery.

 .html() – Get or set HTML content


 .append() – Add content to the end of selected elements

21. How to call a jQuery library function?

Include jQuery and use:

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function(){
$("p").hide();
});
</script>

22. List any two CSS manipulation methods in jQuery.

 .css() – Get or set CSS properties


 .addClass() – Add one or more class names
23. List any two traversing DOM elements methods using jQuery.

 .parent() – Selects the parent of selected element


 .children() – Selects the children of selected element

1. Give full form of Ajax:

Asynchronous JavaScript And XML

AJAX is a technique for creating fast and dynamic web pages by updating parts of a web
page without reloading the whole page.

2. “Ajax is not a technology”. Comment on this statement:

This statement is partially true.


AJAX is not a single technology, but rather a combination of existing technologies used
together to create asynchronous web applications. These include:

 HTML & CSS (for structure and presentation)


 JavaScript (for scripting)
 DOM (for accessing and manipulating page structure)
 XMLHttpRequest (for asynchronous communication with the server)
 XML or JSON (for data interchange)

So, AJAX is a technique, not a standalone technology.

3. List applications of Ajax:

 Live form validations (without refreshing page)


 Auto-suggest / search suggestions (like Google Search)
 Chat applications
 Live sports scores and stock updates
 Social media content updates (e.g., comments, likes)
 Real-time data filtering in dashboards
 Google Maps – loading data dynamically while dragging
4. What is the purpose of XMLHttpRequest object?

The XMLHttpRequest object is used to exchange data with a server behind the scenes.
It allows:

 Sending HTTP requests (GET, POST, etc.)


 Receiving server responses without reloading the page
 Handling asynchronous and synchronous communication
 Parsing XML or JSON responses from the server

Example:

let xhr = new XMLHttpRequest();


xhr.open("GET", "data.json", true);
xhr.send();

5. What is Sajax?

Sajax (Simple Ajax Toolkit) is an open-source tool to simplify AJAX calls in web
applications.

 It enables calling PHP, ASP, or other server-side functions from JavaScript in an


easy way.
 Automatically handles the creation of XMLHttpRequest and response handling.

Sajax reduces the complexity of writing raw AJAX code by offering ready-to-use functions.

Here are the answers to your questions:

1. What is the purpose of CodeIgniter framework?


The purpose of CodeIgniter is to provide a simple and powerful toolkit to build dynamic and
full-featured web applications in PHP. It follows the MVC (Model-View-Controller)
architecture and helps developers write clean, maintainable, and organized code with minimal
configuration.

2. List features of CodeIgniter.


Key features of CodeIgniter include:

 Lightweight and fast performance


 Follows MVC architecture
 No need for template language (uses plain PHP)
 Built-in libraries and helper functions
 Secure with XSS and CSRF filtering
 Easy to learn and well-documented
 Supports multiple database platforms
 Error handling and debugging tools
 URL routing and query builder support

3. Define MVC.
MVC stands for Model-View-Controller:

 Model: Manages data and business logic


 View: Handles the presentation layer (UI)
 Controller: Acts as an intermediary between Model and View, handling user input
and interaction

4. “CodeIgniter is PHP driven framework” – Comment on this sentence.


This sentence means that CodeIgniter is built using PHP and is designed to help PHP
developers build applications more efficiently. It enhances PHP by providing a structured
approach (MVC), built-in tools, and a clean separation of concerns for web application
development.

5. Which three components are the pillars for CodeIgniter application architecture?
The three main pillars of CodeIgniter architecture are:

 Model
 View
 Controller
These follow the MVC design pattern.

6. What is meant by CodeIgniter library?


In CodeIgniter, a library is a set of pre-written code that provides specific functionality (e.g.,
session handling, email, file uploads, etc.). You can load and use libraries to avoid writing
repetitive code, making development faster and more efficient.

7. What is helper?
A helper in CodeIgniter is a file containing a collection of procedural functions that assist in
performing specific tasks (like working with URLs, forms, text, arrays, etc.). Unlike libraries,
helpers are not object-oriented and don’t require instantiation.
8. What is cookie?
A cookie is a small piece of data stored on the client’s browser by the server. It is used to
remember information like user preferences, session identifiers, or tracking data across
requests or visits to a website.

9. Define page redirection.


Page redirection refers to the process of sending a user from one web page to another, either
on the same site or a different one. In CodeIgniter, redirection is typically handled using the
redirect() function provided by the URL helper.

Let me know if you'd like these compiled as notes or flashcards!

You might also like