0% found this document useful (0 votes)
7 views

IT 2024

The document outlines a curriculum divided into four units covering topics such as internet protocols, HTML, JavaScript, and web development concepts. Each unit includes short and long questions, coding exercises, and numerical problems related to JavaScript operations and functions. The content is designed to enhance understanding of web technologies and programming skills.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

IT 2024

The document outlines a curriculum divided into four units covering topics such as internet protocols, HTML, JavaScript, and web development concepts. Each unit includes short and long questions, coding exercises, and numerical problems related to JavaScript operations and functions. The content is designed to enhance understanding of web technologies and programming skills.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Unit -1

Short Questions:

1. What is the main function of the TCP protocol?


2. Name two key internet services.
3. What is the purpose of a proxy server?

Long Questions:

1. Explain the history and evolution of the internet.


2. Describe how web servers and proxy servers work.
3. Compare and contrast TCP and UDP protocols with examples of their applications.

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:

1. What is the difference between incremental crawlers and parallel crawlers?


2. Write a brief note on browsing tricks and browser customization.
3. Explain the role of cookies in web browsing.
4. What is webcasting, and how is it different from live streaming?

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:

1. Differentiate between let, var, and const in JavaScript.


2. What is the use of regular expressions in JavaScript? Provide an example.
3. Explain the Math.random() and Math.pow() methods.
4. Write a short note on the toUpperCase() and split() methods of the String object.

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.

Coading Questions:- (UNIT -04)

1. Pre-Increment and Post-Increment

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:

 Line 1: ++x increases x to 6 before printing. Output: 6


 Line 2: x++ uses the value (6) and then increments it to 7. Output: 6
 Line 3: x is now 7. Output: 7

2. Pre-Decrement and Post-Decrement

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:

 Line 1: --y decreases y to 9 before printing. Output: 9


 Line 2: y-- uses the value (9) and then decreases it to 8. Output: 9
 Line 3: y is now 8. Output: 8

3. Increment in Expressions

Question:
What will be the value of result in the following code?

let a = 3, b = 2;

let result = ++a + b++ - --b;

console.log(result);

Answer:

 ++a: Pre-increment, a becomes 4.


 b++: Post-increment, uses b as 2, then increases to 3.
 --b: Pre-decrement, decreases b back to 2.
 result = 4 + 2 - 2 = 4.

Numerical Questions on Increment and Decrement Operators in


JavaScript

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 (--):

o Pre-Decrement (--x): Decreases the value before using it.


o Post-Decrement (x--): Uses the value first, then decreases it.

Sample Coding Numerical Questions

1. Pre-Increment and Post-Increment

Question:
What will be the output of the following code?

let x = 5;console.log(++x); // Line 1console.log(x++); // Line 2console.log(x); // Line


3
Answer:

 Line 1: ++x increases x to 6 before printing. Output: 6


 Line 2: x++ uses the value (6) and then increments it to 7. Output: 6
 Line 3: x is now 7. Output: 7

2. Pre-Decrement and Post-Decrement

Question:
What will be the output of the following code?

let y = 10;console.log(--y); // Line 1console.log(y--); // Line 2console.log(y); // Line


3

Answer:

 Line 1: --y decreases y to 9 before printing. Output: 9


 Line 2: y-- uses the value (9) and then decreases it to 8. Output: 9
 Line 3: y is now 8. Output: 8

3. Increment in Expressions

Question:
What will be the value of result in the following code?

let a = 3, b = 2;let result = ++a + b++ - --b;console.log(result);

Answer:

 ++a: Pre-increment, a becomes 4.


 b++: Post-increment, uses b as 2, then increases to 3.
 --b: Pre-decrement, decreases b back to 2.
 result = 4 + 2 - 2 = 4.

Output: 4

4. Mixing Increment and Decrement

Question:
Predict the output:

let x = 5, y = 3;

let z = x++ + --y + ++x - y--;

console.log(z);
Answer:

 x++: Post-increment, uses x as 5, then increases to 6.


 --y: Pre-decrement, y becomes 2.
 ++x: Pre-increment, x increases to 7.
 y--: Post-decrement, uses y as 2, then decreases to 1.
 z = 5 + 2 + 7 - 2 = 12.

5. Increment/Decrement in Loops

Question:
Write a JavaScript program to print numbers from 1 to 10 using an increment operator.

Answer: for (let i = 1; i <= 10; i++) {

console.log(i);

1. Variables and Loops (Basic)

Question:
Write a JavaScript program to calculate the sum of all numbers from 1 to 100 using a
for loop.

let sum = 0;

for (let i = 1; i <= 100; i++) {

sum += i;

console.log("Sum of numbers from 1 to 100 is:", sum);

What will be the output?

let x = 10;

let result = x-- - --x + ++x + x++;

console.log(result);

What will be the output?

let a = 5, b = 6; let result = ++a - b-- + b + a--; 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;

console.log("Sum:", a + b); // Output: 19

console.log("Difference:", a - b); // Output: 11

console.log("Product:", a * b); // Output: 60

console.log("Quotient:", a / b); // Output: 3.75

console.log("Remainder:", a % b); // Output: 3

Question 2:

What will be the output of the following code?

let x = 10, y = 20;

console.log(x > y); // Line 1

console.log(x <= y); // Line 2

console.log(x == 10); // Line 3

console.log(x !== y); // Line 4

Answer:

 Line 1: false (10 is not greater than 20).


 Line 2: true (10 is less than or equal to 20).
 Line 3: true (10 is equal to 10).
 Line 4: true (10 is not equal to 20).

Question 3:

What will be the output of the following code?

let a = true, b = false;

console.log(a && b); // Line 1

console.log(a || b); // Line 2

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 Operator Numerical Questions

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:

What will be the output of the following code?

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:

 Line 1: false (10 is not greater than 20).


 Line 2: true (10 is less than or equal to 20).
 Line 3: true (10 is equal to 10).
 Line 4: true (10 is not equal to 20).

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:

 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).

Question 4:

Predict the output of the following code:

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:

What will be the output of the following code?

let a = 5, b = 3; // Binary of 5: 0101, Binary of 3: 0011

console.log(a & b); // Line 1

console.log(a | b); // Line 2

console.log(a ^ b); // Line 3

console.log(~a); // Line 4
Answer:

 Line 1: 5 & 3 = 1 (Bitwise AND: 0101 & 0011 = 0001).


 Line 2: 5 | 3 = 7 (Bitwise OR: 0101 | 0011 = 0111).
 Line 3: 5 ^ 3 = 6 (Bitwise XOR: 0101 ^ 0011 = 0110).
 Line 4: ~5 = -6 (Bitwise NOT: Flips bits and negates the value).

What will be the result of the following code?

let result = 10 + 5 * 2 - 3 / 3;

console.log(result);

Answer:

 Multiplication and division first:

5 * 2 = 10, 3 / 3 = 1.

 Perform addition and subtraction:

10 + 10 - 1 = 19. Output: 19

Predict the output of the following code:

let x = 8;

let result = x++ + --x + x-- - ++x;

console.log(result);

Answer:

 x++: Post-increment, uses 8 then increases x to 9.


 --x: Pre-decrement, decreases x back to 8.
 x--: Post-decrement, uses 8 then decreases x to 7.
 ++x: Pre-increment, increases x to 8.
 result = 8 + 8 + 8 - 8 = 16.

2. Functions and Conditional Statements

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";

console.log(checkEvenOrOdd(10)); // Output: Even

console.log(checkEvenOrOdd(7)); // Output: Odd

3.String Manipulation

Question:
Write a JavaScript program to reverse a given string.

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.

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.

const date = new Date();

const day = String(date.getDate()).padStart(2, '0');

const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based

const 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.

function validateEmail(email) {

const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

return regex.test(email);

console.log(validateEmail("[email protected]")); // Output: true

console.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.

const student = {

name: "John Doe",

age: 20,

grade: "A",

displayDetails: function () {
console.log(`Name: ${this.name}, Age: ${this.age}, Grade: ${this.grade}`);

};

student.displayDetails();

// Output: Name: John Doe, Age: 20, Grade: A

Sample Coding Questions on JavaScript

1. Variables and Loops (Basic)

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);

2. Functions and Conditional Statements

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}`);
}
};

student.displayDetails();// Output: Name: John Doe, Age: 20, Grade: A

8. Array Methods

Question:
Write a JavaScript program to filter all even numbers from an array using the filter()
method.

const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

const evenNumbers = numbers.filter(num => num % 2 === 0);

console.log(evenNumbers); // Output: [2, 4, 6, 8, 10]


9. Map Object

Question:
Write a JavaScript program that uses a Map object to store and display the names and
ages of people.

const people = new Map();

people.set("Alice", 25);

people.set("Bob", 30);

people.set("Charlie", 35);

people.forEach((age, name) => {

console.log(`${name} is ${age} years old.`);

});

// Output:

// Alice is 25 years old.

// Bob is 30 years old.

// Charlie is 35 years old.

10. DOM Manipulation

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>

<p id="demo">Original Text</p>


<script>

document.getElementById("demo").textContent = "Hello, World!";

</script>

</body>

</html>

Unit -05

Short Questions:-

1. What is the difference between client-side and server-side scripting?


2. Write a short note on the Request and Response objects in ASP.
3. Explain how to declare variables and constants in C#. Provide examples.

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#.

You might also like