0% found this document useful (0 votes)
0 views5 pages

Web Development QA

The document provides a series of questions and answers related to web development topics, including JavaScript events, Angular components, AJAX, HTML, CSS, and Git commands. It covers fundamental concepts such as the structure of Angular applications, types of HTML lists, and methods to apply CSS styles. Additionally, it includes example code snippets for various programming tasks and explanations of key web development principles.

Uploaded by

Tagore Nampally
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)
0 views5 pages

Web Development QA

The document provides a series of questions and answers related to web development topics, including JavaScript events, Angular components, AJAX, HTML, CSS, and Git commands. It covers fundamental concepts such as the structure of Angular applications, types of HTML lists, and methods to apply CSS styles. Additionally, it includes example code snippets for various programming tasks and explanations of key web development principles.

Uploaded by

Tagore Nampally
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/ 5

Web Development Questions & Answers

Q: What is an event? List various types of events.


A: An event in JavaScript is an action detected by the browser, triggered by user interaction or
system processes. Types: Mouse events, Keyboard events, Form events, Document events,
Window events.

Q: Write short notes on Angular components.


A: Angular components are the building blocks of an Angular application, consisting of a TypeScript
class, an HTML template, and a CSS file.

Q: Explain functions in JavaScript.


A: Functions in JavaScript are reusable blocks of code that perform a specific task. They can be
declared using the 'function' keyword or as arrow functions.

Q: Write a JavaScript program for creating an instance of an Object.


A: function Person(name, age) {
this.name = name;
this.age = age;
}
let person1 = new Person('John', 25);
console.log(person1);

Q: Write a JS program on load and unload events.


A: window.onload = function() {
alert('Page Loaded');
};
window.onunload = function() {
alert('Page Unloaded');
};

Q: Write a jQuery program on double-click event.


A: $(document).ready(function() {
$('#btn').dblclick(function() {
alert('Button Double-Clicked');
});
});
Q: Mention points in AJAX for data exchange with server with a diagram.
A: AJAX (Asynchronous JavaScript and XML) allows exchanging data with the server without
refreshing the page.
Key Points: XMLHttpRequest, Fetch API, JSON response, asynchronous requests.

Q: Write syntax for creating a JSON object.


A: {
"name": "John",
"age": 25,
"city": "New York"
}

Q: List four main components of a web framework.


A: Routing, Templating Engine, Middleware, Database Integration.

Q: What is the difference between an HTML Tag and an HTML Element?


A: An HTML Tag is the actual code (e.g., <p>), while an HTML Element includes the tag and content
(e.g., <p>Hello</p>).

Q: What is a web server?


A: A web server is software that processes HTTP requests and serves web pages. Example:
Apache, Nginx.

Q: What is HTML?
A: HTML (HyperText Markup Language) is the standard language for creating web pages and
applications.

Q: Explain the purpose of a web server in the context of web development.


A: A web server handles client requests, processes dynamic content, and serves web pages over
the internet.

Q: Define lists? Explain ordered and unordered lists with suitable examples.
A: Lists in HTML allow structuring content in a readable format.
Ordered List (<ol>): Items are displayed with numbers.
Unordered List (<ul>): Items are displayed with bullet points.

Example:
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>

<ul>
<li>Item A</li>
<li>Item B</li>
</ul>

Q: Explain different types of selectors in CSS.


A: CSS selectors target HTML elements for styling. Types include:
1. Universal Selector (*): Applies to all elements.
2. Class Selector (.class): Targets elements with a specific class.
3. ID Selector (#id): Targets an element with a specific ID.
4. Attribute Selector ([type='text']): Targets elements with specific attributes.

Q: Explain different types of form tags in HTML with a suitable example.


A: HTML form tags include:
<form>: Defines a form.
<input>: Accepts user input.
<textarea>: Allows multi-line text input.
<button>: Submits the form.

Example:
<form>
<input type='text' placeholder='Enter name'>
<button>Submit</button>
</form>

Q: Explain three different ways to apply CSS styles with HTML.


A: 1. Inline CSS: Added directly to an element using 'style' attribute.
Example: <p style='color:red;'>Hello</p>

2. Internal CSS: Defined inside a <style> tag within the HTML file.
Example:
<style>
p {color: blue;}
</style>

3. External CSS: Stored in a separate file and linked via <link>.


Example: <link rel='stylesheet' href='styles.css'>

Q: Explain the following Git commands: git status, git log, git push, git restore.
A: 1. git status: Shows the current state of the working directory.
2. git log: Displays the commit history.
3. git push: Pushes local commits to a remote repository.
4. git restore: Restores modified or deleted files.

Q: What is an event? Explain keyboard events with an example in JS.


A: An event in JavaScript is an action triggered by user interaction.
Keyboard events:
1. keydown: Triggered when a key is pressed.
2. keyup: Triggered when a key is released.
3. keypress: Triggered when a character key is pressed.

Example:
document.addEventListener('keydown', function(event) {
console.log('Key pressed: ' + event.key);
});

Q: How does data exchange with a server using AJAX work? Provide an example program.
A: AJAX allows exchanging data without reloading the page.

Example:
fetch('https://api.example.com/data')
.then(response => response.json())
.then(data => console.log(data));

Q: Discuss the basic structure of an Angular application with an example program.


A: Angular applications consist of:
1. Components: UI building blocks.
2. Modules: Organize code.
3. Services: Handle business logic.
4. Routing: Manages navigation.

Example:
@Component({
selector: 'app-root',
template: '<h1>Hello Angular</h1>'
})
export class AppComponent {}

Q: Write a short note on Angular and its importance.


A: Angular is a TypeScript-based framework for building web applications. It is important because:
1. Provides a component-based architecture.
2. Supports two-way data binding.
3. Has built-in dependency injection.
4. Enables SPA (Single Page Application) development.

You might also like