IT 2024
IT 2024
Short Questions:
Long Questions:
Unit -02
Short Questions:
1. What is the purpose of a <meta> tag in the head section of an HTML document?
2. Differentiate between XML and HTML.
3. What are the key considerations for website usability?
Long Questions:
1. Explain the structure of an HTML document and describe the roles of the head and body
sections.
2. Discuss the importance of XML and XML schema documents in web development.
3. Analyze the key issues in website design and propose solutions for load time optimization and
security concerns.
Unit -03
Short Questions:
Long Questions:
1. Explain the architecture of search engines, highlighting the role of web crawlers and their
types.
2. Discuss the features, advantages, and limitations of a popular web server (e.g., Apache or
NGINX).
3. Describe the hardware and software requirements for developing web-based applications.
Unit -04
Short Questions:
Long Questions:
1. Explain the key features and language elements of JavaScript with examples.
2. Describe the Date and Math objects in JavaScript. Provide examples of their common
methods.
3. Write a detailed note on JavaScript arrays, highlighting their properties and common methods.
Question:
What will be the output of the following code?
let x = 5;
console.log(++x); // Line 1
console.log(x++); // Line 2
console.log(x); // Line 3
Answer:
Question:
What will be the output of the following code?
let y = 10;
console.log(--y); // Line 1
console.log(y--); // Line 2
console.log(y); // Line 3
Answer:
3. Increment in Expressions
Question:
What will be the value of result in the following code?
let a = 3, b = 2;
console.log(result);
Answer:
Key Concepts
Increment (++):
o Pre-Increment (++x): Increases the value before using it.
o Post-Increment (x++): Uses the value first, then increases it.
Decrement (--):
Question:
What will be the output of the following code?
Question:
What will be the output of the following code?
Answer:
3. Increment in Expressions
Question:
What will be the value of result in the following code?
Answer:
Output: 4
Question:
Predict the output:
let x = 5, y = 3;
console.log(z);
Answer:
5. Increment/Decrement in Loops
Question:
Write a JavaScript program to print numbers from 1 to 10 using an increment operator.
console.log(i);
Question:
Write a JavaScript program to calculate the sum of all numbers from 1 to 100 using a
for loop.
let sum = 0;
sum += i;
let x = 10;
console.log(result);
Question 1:
Write a JavaScript program to calculate the sum, difference, product, quotient, and
remainder of two numbers a and b.
let a = 15, b = 4;
Question 2:
Answer:
Question 3:
console.log(!a); // Line 3
Answer:
Line 1: false (true AND false evaluates to false).
Line 2: true (true OR false evaluates to true).
Line 3: false (NOT true evaluates to false).
JavaScript operators are symbols used to perform operations on variables and values.
Below are numerical problems that involve various types of operators: arithmetic,
relational, logical, bitwise, and assignment.
1. Arithmetic Operators
Question 1:
Write a JavaScript program to calculate the sum, difference, product, quotient, and
remainder of two numbers a and b.
javascript
Copy code
let a = 15, b = 4;console.log("Sum:", a + b); // Output:
19console.log("Difference:", a - b); // Output: 11console.log("Product:", a * b); //
Output: 60console.log("Quotient:", a / b); // Output: 3.75console.log("Remainder:",
a % b); // Output: 3
2. Relational Operators
Question 2:
javascript
Copy code
let x = 10, y = 20;console.log(x > y); // Line 1console.log(x <= y); // Line
2console.log(x == 10); // Line 3console.log(x !== y); // Line 4
Answer:
3. Logical Operators
Question 3:
What will be the output of the following code?
javascript
Copy code
let a = true, b = false;console.log(a && b); // Line 1console.log(a || b); // Line
2console.log(!a); // Line 3
Answer:
Question 4:
let num = 5;
num += 3; // Line 1
num *= 2; // Line 2
num -= 4; // Line 3
num /= 2; // Line 4
console.log(num);
Answer:
Line 1: num = 5 + 3 = 8.
Line 2: num = 8 * 2 = 16.
Line 3: num = 16 - 4 = 12.
Line 4: num = 12 / 2 = 6. Output: 6
Question 5:
console.log(~a); // Line 4
Answer:
let result = 10 + 5 * 2 - 3 / 3;
console.log(result);
Answer:
5 * 2 = 10, 3 / 3 = 1.
10 + 10 - 1 = 19. Output: 19
let x = 8;
console.log(result);
Answer:
Question:
Write a function in JavaScript that takes a number as input and returns whether the
number is even or odd.
function checkEvenOrOdd(num) {
if (num % 2 === 0) {
return "Even";
} else {
return "Odd";
3.String Manipulation
Question:
Write a JavaScript program to reverse a given string.
function reverseString(str) {
return str.split('').reverse().join('');
4. Arrays
Question:
Write a JavaScript program to find the largest number in an array.
function findLargestNumber(arr) {
return Math.max(...arr);
5. Date Object
Question:
Write a program to display the current date in the format DD-MM-YYYY.
console.log(`${day}-${month}-${year}`);
6. Regular Expressions
Question:
Write a JavaScript program to validate if a given string is a valid email address.
function validateEmail(email) {
return regex.test(email);
7. Objects
Question:
Write a program that creates a JavaScript object for a student with properties name, age,
and grade, and a method to display student details.
const student = {
age: 20,
grade: "A",
displayDetails: function () {
console.log(`Name: ${this.name}, Age: ${this.age}, Grade: ${this.grade}`);
};
student.displayDetails();
Question:
Write a JavaScript program to calculate the sum of all numbers from 1 to 100 using a
for loop.
Answer:
javascript
Copy code
let sum = 0;for (let i = 1; i <= 100; i++) {
sum += i;
}console.log("Sum of numbers from 1 to 100 is:", sum);
Question:
Write a function in JavaScript that takes a number as input and returns whether the
number is even or odd.
Answer:
javascript
Copy code
function checkEvenOrOdd(num) {
if (num % 2 === 0) {
return "Even";
} else {
return "Odd";
}
}
console.log(checkEvenOrOdd(10)); // Output: Evenconsole.log(checkEvenOrOdd(7));
// Output: Odd
3. String Manipulation
Question:
Write a JavaScript program to reverse a given string.
Answer:
javascript
Copy code
function reverseString(str) {
return str.split('').reverse().join('');
}
console.log(reverseString("JavaScript")); // Output: tpircSavaJ
4. Arrays
Question:
Write a JavaScript program to find the largest number in an array.
Answer:
javascript
Copy code
function findLargestNumber(arr) {
return Math.max(...arr);
}
console.log(findLargestNumber([10, 20, 45, 5, 100])); // Output: 100
5. Date Object
Question:
Write a program to display the current date in the format DD-MM-YYYY.
Answer:
javascript
Copy code
const date = new Date();const day = String(date.getDate()).padStart(2, '0');const
month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-basedconst year
= date.getFullYear();
console.log(`${day}-${month}-${year}`);
6. Regular Expressions
Question:
Write a JavaScript program to validate if a given string is a valid email address.
Answer:
javascript
Copy code
function validateEmail(email) {
const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return regex.test(email);
}
console.log(validateEmail("[email protected]")); // Output:
trueconsole.log(validateEmail("invalid-email")); // Output: false
7. Objects
Question:
Write a program that creates a JavaScript object for a student with properties name, age,
and grade, and a method to display student details.
Answer:
javascript
Copy code
const student = {
name: "John Doe",
age: 20,
grade: "A",
displayDetails: function () {
console.log(`Name: ${this.name}, Age: ${this.age}, Grade: ${this.grade}`);
}
};
8. Array Methods
Question:
Write a JavaScript program to filter all even numbers from an array using the filter()
method.
Question:
Write a JavaScript program that uses a Map object to store and display the names and
ages of people.
people.set("Alice", 25);
people.set("Bob", 30);
people.set("Charlie", 35);
});
// Output:
Question:
Write a JavaScript program to change the text content of a paragraph with id="demo" to
"Hello, World!".
<!DOCTYPE html>
<html lang="en">
<head>
<title>DOM Example</title>
</head>
<body>
</script>
</body>
</html>
Unit -05
Short Questions:-
Long Questions:
1. Explain ASP's object model in detail. Discuss the role of Application, Session, Request, and
Response objects.
2. Describe how to create and use objects from classes in ASP.NET with an example in C#.