BCA / B.Tech 46 min read

Internet Tools All Important Questions and Answers in English (MDSU)

1. What is the current state of the internet?

Answer: Today, the internet is spread all over the world, and technologies like high-speed broadband, 5G, and fiber optic networks are making it faster and more secure. People are using the internet for social media, e-commerce, online studies, and business.

2. What hardware and software are required to run the internet?

Answer: To use the internet, you need a computer/smartphone, a network card, a modem/router, and an operating system. Additionally, a web browser, email client, and security tools are also useful.

3. What is an ISP (Internet Service Provider)?

Answer: An ISP is a company that provides an internet connection, such as Jio, Airtel, BSNL, and ACT Fibernet.

4. What is an internet account and why is it needed?

Answer: An internet account is a user ID and password that allows a person to access the services of an ISP. This account is necessary for email, cloud storage, and other online services.

5. What is a web home page?

Answer: When someone enters a website's URL in a web browser, the first page that opens is called the home page.

6. What is a URL?

Answer: A URL (Uniform Resource Locator) is the complete address of a website, such as https://www.google.com. It includes the protocol, domain name, and resource path.

7. What is a web browser?

Answer: A web browser is software that allows us to open websites on the internet, such as Chrome, Firefox, Edge, and Safari.

8. Why is security important on the internet?

Answer: Problems like hacking, viruses, and data theft exist on the internet, so security is essential. For this, antivirus software, firewalls, and secure passwords are used.

9. What is a search engine?

Answer: A search engine is a program that helps find information on the internet. Examples include Google, Bing, and Yahoo.

10. What is FTP and where is it used?

Answer: FTP (File Transfer Protocol) is a protocol used to transfer files over the internet. It is used in web development to upload website files.

11. What is Gopher?

Answer: Gopher was an old internet service that allowed access to files and documents in a hierarchical manner. However, its use has become very rare now.

12. What is Telnet?

Answer: Telnet is a protocol that allows a remote computer to be controlled through a command line. It has now been replaced by SSH.

13. How does email work?

Answer:

How does the email workflow work?

  1. User composes an email (in clients like Gmail, Outlook).

  2. It is sent to the mail server via SMTP (Simple Mail Transfer Protocol).

  3. The mail server identifies the receiver's mail server through DNS.

  4. The email reaches the receiver via POP3/IMAP.

Protocols used for sending and receiving email:

ProtocolFunctionPort
SMTPFor sending mail25, 465 (SSL), 587
POP3For downloading mail110, 995 (SSL)
IMAPFor storing and managing mail on the server143, 993 (SSL)

14. What is TFTP?

Answer: TFTP (Trivial File Transfer Protocol) is a simple version of FTP used for file transfer in small networks.

15. What are the components of a web browser architecture?

Answer: It includes the UI (User Interface), browser engine, rendering engine, networking, JavaScript interpreter, and data storage.

16. Why is multimedia important in a web page?

Answer: Multimedia (images, videos, audio) makes a website attractive and improves the user experience.

17. What is the difference between Static, Dynamic, and Active web pages?

Answer:

  • Static: These are pages with fixed content that look the same to every user.

  • Dynamic: These pages change according to user input or the database.

  • Active: These have backend processing, like a chat application.

18. What is PHP and where is it used?

Answer: PHP (Hypertext Preprocessor) is a server-side scripting language used to create dynamic websites and web applications.

19. What is the history of PHP?

Answer: PHP was created by Rasmus Lerdorf in 1994. It was initially Personal Home Page tools, but later became a full-fledged scripting language.

20. How many data types are there in PHP?

Answer: There are mainly four types of data types in PHP –

  1. String

  2. Integer

  3. Float

  4. Boolean

21. How are variables declared in PHP?

Answer: In PHP, variables start with a $ sign, like –

$name = "Ratan";
$age = 21;

22. How many types of operators are there in PHP?

Answer: There are mainly four types of operators in PHP –

  1. Arithmetic Operators (+, -, *, /)

  2. Comparison Operators (==, !=, >, <)

  3. Logical Operators (&&, ||, !)

  4. Assignment Operators (=, +=, -=, *=, /=)

23. How are functions created in PHP?

Answer: In PHP, functions are created with the function keyword, like –

function greet() {
    return "Hello, World!";
}
echo greet();

24. How are strings managed in PHP?

Answer: In PHP, strings are managed with functions for concatenation (. operator), splitting (explode()), getting length (strlen()), and searching (strpos()).

25. How many types of arrays are there in PHP?

Answer:

Definition:

An Array is a data structure that can store multiple values in a single variable. In PHP, arrays are used to organize and manage data.

There are three types of Arrays in PHP:

  1. Indexed Array

  2. Associative Array

  3. Multidimensional Array


1. Indexed Array

In an indexed array, values are stored with a numeric index (0, 1, 2, …).
These arrays work like a list.

Syntax & Example:

$fruits = array("Apple", "Banana", "Cherry"); 
// Accessing elements
echo $fruits[0]; 
echo $fruits[1]; 
echo $fruits[2]; 

Output:

Apple  
Banana  
Cherry  

2. Associative Array

In an associative array, values are stored with named keys (string key).
This is useful when you want to store data with a meaningful key.

Syntax & Example:

$person = array(
    "name" => "Ratan",
    "age" => 21,
    "city" => "Ajmer"
);
// Accessing elements
echo $person["name"];
echo $person["age"]; 
echo $person["city"]; 

Output:

Ratan  
21  
Ajmer  

3. Multidimensional Array

A multidimensional array contains other arrays within it.
It is used to structure complex data.

Syntax & Example:

$students = array(
    array("Bhavesh", 90),
    array("Imran", 85),
    array("Aman", 78)
);
// Accessing elements
echo $students[0][0]; 
echo $students[1][1]; 

Output:
Bhavesh
85

26. What is MySQL and why is it used?

Answer: MySQL is an open-source relational database management system (RDBMS) used to store, manage, and process data. It is used in web applications, CMS (like WordPress), e-commerce sites, and large database-driven websites.


27. How to connect and disconnect from a MySQL server?

Answer:
To connect to a MySQL server, we run this command in the terminal –

mysql -u root -p

And to disconnect –

exit;

To connect from PHP –

$conn = mysqli_connect("localhost", "username", "password", "database_name");
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

28. How are queries run in MySQL?

Answer: SQL (Structured Query Language) is used to access, update, or delete data in MySQL. For example –

  • To fetch all records from a database:

    SELECT * FROM users;
    
  • To fetch data of a specific user:

    SELECT * FROM users WHERE user_id = 5;
    

29. How is a database created in MySQL?

Answer: This SQL command is used to create a database –

CREATE DATABASE my_database;

Then to use it –

USE my_database;

30. How is a table created in MySQL?

Answer:

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    email VARCHAR(255) UNIQUE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

31. How is data inserted in MySQL?

Answer:

INSERT INTO users (name, email) VALUES ('Ratan', '[email protected]');

32. How is data updated in MySQL?

Answer:

UPDATE users SET email = '[email protected]' WHERE id = 1;

33. How is data deleted in MySQL?

Answer:

DELETE FROM users WHERE id = 1;

34. How is data sorted in MySQL?

Answer:

SELECT * FROM users ORDER BY name ASC;

This query will display the data in ascending order (A-Z) by name.


35. What is the significance of a NULL value in MySQL?

Answer: NULL means that there is no value in that column. To check for it –

SELECT * FROM users WHERE email IS NULL;

36. How is pattern matching done in MySQL?

Answer: Pattern matching is done with the LIKE operator –

SELECT * FROM users WHERE name LIKE 'R%';

This will fetch all users whose name starts with 'R'.


37. How are two tables joined in MySQL?

Answer: In MySQL, two tables are joined using JOIN

SELECT users.name, orders.order_id FROM users 
JOIN orders ON users.id = orders.user_id;

38. How are MySQL and PHP connected?

Answer: In PHP, mysqli or PDO is used to connect to MySQL. For example –

$conn = new mysqli("localhost", "root", "", "my_database");
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";

39. How is a MySQL query run in PHP?

Answer:

$result = $conn->query("SELECT * FROM users");
while($row = $result->fetch_assoc()) {
    echo $row['name'] . "";
}

40. How is data deleted in PHP?

Answer:

$conn->query("DELETE FROM users WHERE id = 3");

41. How is form data stored in MySQL from PHP?

Answer:

$name = $_POST['name'];
$email = $_POST['email'];
$conn->query("INSERT INTO users (name, email) VALUES ('$name', '$email')");

42. What is the difference between GET and POST in PHP?

Answer:

  • GET and POST

    These are both HTTP methods used to send data between the client and the server. In PHP, GET and POST are used for form data or API calls.

  • Difference between GET and POST

FeatureGETPOST
Data Sending MethodVisible in the URL (?name=Ratan&age=21)Sent in the body, not visible in the URL
Data SecurityLess secure because data is visible in the URLMore secure because data is hidden
Data LengthLimited (URL limit ~2048 characters)Can send unlimited data
Back Button and Bookmark SupportSupportsDoes not support
Data AccessAccessed via the $_GET superglobalAccessed via the $_POST superglobal

43. What are Sessions and Cookies in PHP?

Answer:

  • Session: Stores user information on the server.

  • Cookies: Stores user information in the browser.


44. How is a file uploaded in PHP?

Answer:

move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);

45. How is data encrypted in PHP?

Answer:

$password = password_hash("mypassword", PASSWORD_BCRYPT);

46. How is an API call made in PHP?

Answer:

$response = file_get_contents("https://api.example.com/data");

47. Why is AJAX used in PHP? And how does it work?

Answer:

What is AJAX?

AJAX (Asynchronous JavaScript and XML) is a technique that allows a web page to exchange data with a server without refreshing the page. AJAX is used for things like real-time updates, auto-suggestions, chat applications, live search, and data submission.

Why is AJAX used in PHP?

The combination of PHP and AJAX is very powerful because:

  1. Data can be updated without reloading the page.

  2. Provides a better user experience.

  3. Fast data exchange between the backend (PHP) and frontend (JavaScript).

  4. No new page needs to be loaded when submitting form data.

  5. Data can be loaded dynamically from the database.


48. How is a PHP script called from AJAX?

Answer:

$.post("server.php", {name: "Ratan"}, function(data) {
    alert(data);
});

49. What is a cron job in PHP?

Answer: A cron job is used to schedule automated tasks, such as –

* * * * * php /var/www/html/script.php

50. What is the difference between PHP and JavaScript?

Answer:

  • PHP is a server-side language.

  • JavaScript is a client-side language.

  • PHP generates HTML, while JavaScript enhances interaction.

51. Write about the following built-in functions -

  1. require()
  2. include()
  3. trim()
  4. explode()
  5. join()
  6. strcmp()
  7. strlen()

1. require() Function

require() is used to import another PHP file.
If the file does not exist, a fatal error will occur and script execution will be stopped.

Example:

require("config.php"); // If config.php is not found, the script will stop.
echo "This line will never be executed if the file is missing!";

2. include() Function

include() also imports another file.
But if the file is not found, a warning will be issued and the script will continue to execute.

Example:

include("header.php"); // If header.php is not found, a warning will be issued but the script will continue.
echo "The script will keep running!";

Difference Between require() and include()

Function Error on Missing File Script Execution
require() Fatal Error Stops
include() Warning Continues

3. trim() Function

trim() removes whitespace (space, tab, newline) from the beginning and end of a string.

Example:

$str = "   Hello World!   ";
echo trim($str);

Output:

Hello World!


4. explode() Function

explode() splits a string by a specific delimiter and converts it into an array.

Example:

$str = "apple,banana,mango";
$arr = explode(",", $str);
print_r($arr);

Output:

Array ( [0] => apple [1] => banana [2] => mango )

5. join() Function

join() (or implode()) is used to join all elements of an array into a single string.

Example:

$arr = ["apple", "banana", "mango"];
$str = join(" | ", $arr);
echo $str; 

Output:

apple | banana | mango


6. strcmp() Function

strcmp() compares two strings and returns an integer.

Return Values:

  • 0 → if both strings are equal.

  • < 0 → if the first string is smaller.

  • > 0 → if the first string is larger.

Example:

echo strcmp("apple", "banana"); // Output: -1 (because "apple" < "banana")
echo strcmp("hello", "hello");  // Output: 0 (because both are equal)

7. strlen() Function

strlen() returns the length of a string. Meaning it counts the characters (with spaces).

Example:

$str = "Hello World!";
echo strlen($str); 

Output:

12


52. What is a control statement. write PHP code to find prime numbers between 21 to 30

Control statements are used to control the execution flow of a program.

They are of three types:

  1. Conditional Statements (if, if-else, switch)

  2. Looping Statements (for, while, do-while, foreach)

  3. Jump Statements (break, continue, return)


PHP Code to Find Prime Numbers Between 21 to 30

A Prime Number is a number that is divisible only by 1 and itself.

PHP Code:


Output:

Prime numbers between 21 and 30 are: 23 29



1. Table Structure

We will create a single table named people which includes employees and faculties with fields like ID, Name, Role, Salary, Commission, and Date of Joining.

Table: people

person_id name role date_of_joining salary commission
1011 Ajay Analyst 2002-06-01 55000 6000
1020 Vijay Manager 2008-07-10 82000 NULL
1031 Sunil Salesman 2011-02-03 40000 2000
1046 Mohit Salesman 2016-04-10 28000 3000
1052 Ankush Clerk 2012-04-20 17000 NULL
1060 Anita Professor 2021-06-12 25000 NULL
1061 Babita Professor 2018-08-10 22000 NULL
1062 Kavita Professor 2015-08-23 20000 NULL
1063 Savita Professor 2021-06-19 18000 NULL
1064 Sunita Professor 2018-07-09 30000 NULL

2. Questions that can be formed from this Table

Basic Queries

  1. Display all records from the table.

  2. Show name and salary of all people.

  3. Display names and roles of people who are Managers or Professors.

  4. List all people whose salary is greater than 25000.

  5. Show details of people who joined after 2018.

  6. Display people whose role is not Salesman.

  7. List all people whose commission is NULL (i.e., those who don't get a commission).

Conditional Queries

  1. Display records of people whose salary is between 30,000 to 60,000.

  2. Show details of people whose name starts with 'S'.

  3. List people whose name ends with 'a'.

  4. Find the person with the highest salary.

  5. Find the person with the lowest salary.

  6. Count the number of people whose salary is above 20,000.

Date-based Queries

  1. Display people who joined before 2015.

  2. Show names of people who joined on 23-08-2015.

  3. Count how many people joined after 2018.

  4. Show names of people who joined in July.


3. SQL Queries for the Above Questions

Basic Queries

-- 1. Display all records
SELECT * FROM people;
-- 2. Show name and salary of all people
SELECT name, salary FROM people;
-- 3. Display names and roles of people who are Managers or Professors
SELECT name, role FROM people WHERE role IN ('Manager', 'Professor');
-- 4. List all people whose salary is greater than 25000
SELECT * FROM people WHERE salary > 25000;
-- 5. Show details of people who joined after 2018
SELECT * FROM people WHERE YEAR(date_of_joining) > 2018;
-- 6. Display people whose role is not Salesman
SELECT * FROM people WHERE role <> 'Salesman';
-- 7. List all people whose commission is NULL
SELECT * FROM people WHERE commission IS NULL;

Conditional Queries

-- 8. Display records of people whose salary is between 30,000 to 60,000
SELECT * FROM people WHERE salary BETWEEN 30000 AND 60000;
-- 9. Show details of people whose name starts with 'S'
SELECT * FROM people WHERE name LIKE 'S%';
-- 10. List people whose name ends with 'a'
SELECT * FROM people WHERE name LIKE '%a';
-- 11. Find the person with the highest salary
SELECT name FROM people WHERE salary = (SELECT MAX(salary) FROM people);
-- 12. Find the person with the lowest salary
SELECT name FROM people WHERE salary = (SELECT MIN(salary) FROM people);
-- 13. Count the number of people whose salary is above 20,000
SELECT COUNT(*) FROM people WHERE salary > 20000;

Date-based Queries

-- 14. Display people who joined before 2015
SELECT * FROM people WHERE YEAR(date_of_joining) < 2015;
-- 15. Show names of people who joined on 23-08-2015
SELECT name FROM people WHERE date_of_joining = '2015-08-23';
-- 16. Count how many people joined after 2018
SELECT COUNT(*) FROM people WHERE YEAR(date_of_joining) > 2018;
-- 17. Show names of people who joined in July
SELECT name FROM people WHERE MONTH(date_of_joining) = 7;