Python Questions
- Q: What are Python’s key features?
A: Python is interpreted, high-level, dynamically typed, and supports object-oriented programming. - Q: What is the difference between a list and a tuple?
A: Lists are mutable, whereas tuples are immutable. - Q: How do you declare a variable in Python?
A: Variables are declared when they are assigned a value, e.g.,x = 5
. - Q: Explain the use of the
range()
function.
A: It generates a sequence of numbers. Example:range(5)
creates [0, 1, 2, 3, 4]. - Q: What is the difference between
is
and==
?
A:is
checks identity, whereas==
checks equality. - Q: What is a Python dictionary?
A: It is an unordered collection of key-value pairs. - Q: What is the output of
print(2 ** 3)
?
A:8
- Q: Explain list comprehension.
A: It provides a concise way to create lists. Example:[x**2 for x in range(5)]
. - Q: How can you handle exceptions in Python?
A: Usingtry
,except
, andfinally
blocks. - Q: What are Python’s data types?
A: Common types includeint
,float
,str
,list
,tuple
,dict
, andbool
. - Q: What is a Python module?
A: A file containing Python code that can be imported. - Q: What are *args and **kwargs?
A:*args
passes variable-length positional arguments;**kwargs
passes variable-length keyword arguments. - Q: How do you define a function in Python?
A: Using thedef
keyword, e.g.,def func_name():
. - Q: What are lambda functions?
A: Anonymous functions defined with thelambda
keyword. - Q: Explain the difference between
del
andremove()
in lists.
A:del
removes an element by index, whereasremove()
removes by value. - Q: What is recursion?
A: A function calling itself directly or indirectly. - Q: How do you read a file in Python?
A: Usingopen()
followed by.read()
or.readlines()
. - Q: What is the purpose of the
with
statement in file handling?
A: It ensures proper cleanup of file resources. - Q: How do you import a specific function from a module?
A: Usingfrom module import function
. - Q: How do you concatenate strings in Python?
A: Using the+
operator orjoin()
method.
MySQL Questions
- Q: What is SQL?
A: SQL stands for Structured Query Language used to manage relational databases. - Q: What are primary keys?
A: A column or set of columns uniquely identifying a row in a table. - Q: What is the difference between
CHAR
andVARCHAR
?
A:CHAR
is fixed-length, whileVARCHAR
is variable-length. - Q: How do you fetch data from a table?
A: Using theSELECT
statement, e.g.,SELECT * FROM table_name;
. - Q: Explain the use of the
WHERE
clause.
A: Filters rows based on a condition. - Q: What is a foreign key?
A: A key in one table referencing a primary key in another. - Q: How do you add a column to an existing table?
A: UsingALTER TABLE table_name ADD column_name datatype;
. - Q: What are joins in SQL?
A: Joins combine rows from two or more tables based on a related column. - Q: Explain the difference between
INNER JOIN
andOUTER JOIN
.
A:INNER JOIN
returns matching rows;OUTER JOIN
includes unmatched rows too. - Q: How do you create a database?
A: UsingCREATE DATABASE db_name;
. - Q: What are constraints in SQL?
A: Rules enforced on columns, likeNOT NULL
,UNIQUE
, andCHECK
. - Q: How do you delete a table?
A: UsingDROP TABLE table_name;
. - Q: What is the use of
GROUP BY
?
A: Groups rows sharing a property and performs aggregate calculations. - Q: How do you sort results in SQL?
A: UsingORDER BY column_name ASC/DESC;
. - Q: What are aggregate functions?
A: Functions likeSUM()
,AVG()
,COUNT()
,MIN()
, andMAX()
. - Q: Explain the
LIKE
operator.
A: Used for pattern matching with%
and_
. - Q: What is the difference between
TRUNCATE
andDELETE
?
A:TRUNCATE
removes all rows,DELETE
can filter rows. - Q: How do you back up a MySQL database?
A: Usingmysqldump
utility. - Q: What is indexing in SQL?
A: It improves query performance by reducing data retrieval time. - Q: How do you count rows in a table?
A: UsingSELECT COUNT(*) FROM table_name;
.
Networking Questions
- Q: What is a computer network?
A: A collection of interconnected devices sharing resources and information. - Q: What are the types of networks?
A: LAN, MAN, WAN, PAN, and WLAN. - Q: Define IP address.
A: A unique address identifying devices on a network. - Q: What is the difference between IPv4 and IPv6?
A: IPv4 uses 32-bit addresses; IPv6 uses 128-bit addresses. - Q: What is a MAC address?
A: A hardware address unique to a network interface. - Q: What are the layers of the OSI model?
A: Physical, Data Link, Network, Transport, Session, Presentation, Application. - Q: What is DNS?
A: Domain Name System maps domain names to IP addresses. - Q: Define HTTP and HTTPS.
A: HTTP is unsecured; HTTPS uses SSL/TLS for encryption. - Q: What is the role of a router?
A: Directs data packets between networks. - Q: What is a firewall?
A: A security system to monitor and control network traffic.
Societal Impacts Questions
- Q: What is digital divide?
A: The gap between those with and without access to technology. - Q: What are the ethical concerns in AI?
A: Bias, job displacement, privacy, and accountability. - Q: How can social media impact mental health?
A: It can lead to anxiety, depression, and self-esteem issues. - Q: What are the benefits of e-governance?
A: Transparency, efficiency, and accessibility of government services. - Q: Explain phishing.
A: Fraudulent attempts to obtain sensitive information via fake emails or websites. - Q: What is cyberbullying?
A: Bullying through digital platforms like social media. - Q: Define intellectual property rights (IPR).
A: Legal rights protecting creators’ works. - Q: What is net neutrality?
A: The principle that ISPs must treat all data equally. - Q: What is the impact of e-waste?
A: Pollution, health hazards, and resource depletion. - Q: How can technology reduce carbon footprints?
A: Through energy-efficient devices and renewable energy technologies.
Additional Questions
- Q: What is the difference between
sort()
andsorted()
in Python?
A:sort()
modifies the list in place, whilesorted()
returns a new sorted list. - Q: How do you create a virtual environment in Python?
A: Usingvenv
, e.g.,python -m venv env_name
. - Q: What is the use of
super()
in Python?
A: It is used to call a method from a parent class. - Q: What is the purpose of the
zip()
function in Python?
A: It combines two or more iterables into tuples. - Q: How do you create a view in MySQL?
A: UsingCREATE VIEW view_name AS SELECT ...
. - Q: What is a self-join in SQL?
A: A table joining with itself. - Q: What is subnetting in networking?
A: Dividing a network into smaller subnetworks. - Q: What is an IP conflict?
A: When two devices have the same IP address on a network. - Q: Explain the concept of port numbers.
A: Port numbers identify specific processes or services on a network. - Q: What is a proxy server?
A: It acts as an intermediary between a client and the internet. - Q: What are cookies in web technology?
A: Small data files stored on a user’s device by websites. - Q: What is the difference between symmetric and asymmetric encryption?
A: Symmetric uses one key for encryption and decryption; asymmetric uses a key pair. - Q: Define data encapsulation in networking.
A: Wrapping data with protocol information at each layer of the OSI model. - Q: What is the purpose of a gateway in a network?
A: It connects different networks and translates protocols. - Q: How does two-factor authentication work?
A: It combines two verification methods, like a password and an OTP. - Q: What is the purpose of a data dictionary in a database?
A: It stores metadata about the database structure. - Q: What is an ER diagram?
A: A visual representation of entities and relationships in a database. - Q: What is the difference between
HAVING
andWHERE
in SQL?
A:HAVING
filters grouped data;WHERE
filters rows before grouping. - Q: What is latency in networking?
A: The delay in data transfer from source to destination. - Q: What is the importance of green computing?
A: Reducing energy consumption and environmental impact of computing. - Q: Define multitasking in operating systems.
A: Running multiple processes simultaneously. - Q: What is steganography?
A: Hiding data within other non-secret files or data. - Q: Explain phishing attacks in cybersecurity.
A: Fraudulent attempts to steal sensitive information through fake communications. - Q: What is the purpose of MySQL’s
LIMIT
clause?
A: Restricts the number of rows returned by a query. - Q: What is a loopback address?
A: An IP address (127.0.0.1) used for testing the local machine. - Q: Define bandwidth in networking.
A: The maximum data transfer rate of a network. - Q: What is the function of the ARP protocol?
A: Resolves IP addresses to MAC addresses. - Q: What are the risks of open Wi-Fi networks?
A: Data theft, man-in-the-middle attacks, and unauthorized access. - Q: What is SQL injection?
A: A code injection attack exploiting database vulnerabilities. - Q: How does SSL/TLS secure data transmission?
A: By encrypting data between a client and server. - Q: What is cloud computing?
A: Delivery of computing services over the internet. - Q: Define biometrics in security.
A: Authentication using physical traits like fingerprints or retina scans. - Q: What is the function of a packet sniffer?
A: Captures and analyzes network traffic. - Q: How does a VPN work?
A: Creates a secure, encrypted connection over a public network. - Q: What is ransomware?
A: Malicious software that encrypts data until a ransom is paid. - Q: What are ethical hacking and penetration testing?
A: Practices to identify and fix security vulnerabilities. - Q: Define digital signature.
A: Electronic signature ensuring the authenticity of a message or document. - Q: What is hashing in cryptography?
A: Converting data into a fixed-size string, often used for verification. - Q: What is the Internet of Things (IoT)?
A: A network of interconnected devices that communicate over the internet. - Q: How can individuals ensure online privacy?
A: By using strong passwords, enabling encryption, and avoiding suspicious links.
Leave a Reply