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

Python,DSA,AIML,Security

The document provides a comprehensive overview of key concepts in Python programming, data structures and algorithms (DSA), artificial intelligence and machine learning (AIML), and cybersecurity fundamentals. It includes definitions, differences, and explanations of various terms and techniques relevant to each topic. The content is structured in a Q&A format, making it easy to reference specific information.

Uploaded by

Bhuvanesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Python,DSA,AIML,Security

The document provides a comprehensive overview of key concepts in Python programming, data structures and algorithms (DSA), artificial intelligence and machine learning (AIML), and cybersecurity fundamentals. It includes definitions, differences, and explanations of various terms and techniques relevant to each topic. The content is structured in a Q&A format, making it easy to reference specific information.

Uploaded by

Bhuvanesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

PYTHON

1. Q: What is the difference between is and == in Python?


A: == checks for value equality, while is checks for object identity (same memory
location).
2. Q: How do you create a virtual environment in Python?
A: Use python -m venv env_name to create a virtual environment.
3. Q: What are Python’s key data types?
A: int, float, str, bool, list, tuple, set, dict.
4. Q: What is a lambda function?
A: It’s an anonymous function defined using the lambda keyword.
5. Q: How do you handle exceptions in Python?
A: Using try, except, optionally finally blocks.
6. Q: What does the pass statement do in Python?
A: It acts as a placeholder and does nothing when executed.
7. Q: Explain the use of *args and **kwargs.
A: *args allows passing variable number of positional arguments; **kwargs allows
passing variable number of keyword arguments.
8. Q: What is list comprehension? Give an example.
A: A concise way to create lists. Example: [x*x for x in range(5)].
9. Q: Differentiate between a list and a tuple.
A: Lists are mutable, while tuples are immutable.
10. Q: What is the use of the id() function in Python?
A: It returns the unique memory address of an object.
11. Q: How do you convert a string to an integer in Python?
A: Using the int() function.
12. Q: What is the purpose of __init__() in Python classes?
A: It is a constructor used to initialize object attributes.
13. Q: What is the difference between break and continue?
A: break exits the loop; continue skips the current iteration.
14. Q: How do you import a module in Python?
A: Using the import module_name statement.
15. Q: What is slicing in Python?
A: It is extracting a portion of a sequence using [start:stop:step].
16. Q: How do you check the type of a variable?
A: Using the type() function.
17. Q: What is the output of bool('False')?
A: True — any non-empty string is True.
18. Q: How can you remove duplicates from a list?
A: Convert it to a set using set(list).
19. Q: What are Python decorators?
A: Functions that modify the behavior of other functions.
20. Q: How is memory managed in Python?
A: Using automatic garbage collection and reference counting.
21. Q: What is the use of with statement in Python?
A: It simplifies exception handling for resources like files.
22. Q: What is the difference between append() and extend()?
A: append() adds a single element; extend() adds elements from another iterable.
23. Q: What are docstrings in Python?
A: Strings used to document a function, class, or module.
24. Q: What is the purpose of zip() in Python?
A: Combines elements from multiple iterables into tuples.
25. Q: How do you reverse a list in Python?
A: Using list.reverse() or list[::-1].

DSA
1. Q: What is a data structure?
A: A data structure is a way to store and organize data efficiently for access and
modification.
2. Q: What is the difference between an array and a linked list?
A: Arrays have fixed size and allow random access; linked lists are dynamic and
support efficient insertions/deletions.
3. Q: What is a stack?
A: A linear data structure that follows the LIFO (Last In First Out) principle.
4. Q: What is a queue?
A: A linear data structure that follows the FIFO (First In First Out) principle.
5. Q: What is the time complexity of searching in a binary search tree (BST)?
A: Average case: O(log n), Worst case: O(n).
6. Q: What is a circular queue?
A: A queue where the last position is connected back to the first, forming a circle.
7. Q: What is a hash table?
A: A data structure that maps keys to values using a hash function.
8. Q: What is the difference between BFS and DFS?
A: BFS explores neighbors level-wise; DFS explores as far as possible along each
branch before backtracking.
9. Q: What is the time complexity of linear search?
A: O(n)
10. Q: What is the time complexity of binary search?
A: O(log n)
11. Q: What is a priority queue?
A: A queue where elements are dequeued based on priority, not order of insertion.
12. Q: What is recursion?
A: A function calling itself to solve a problem in smaller instances.
13. Q: What is dynamic programming?
A: A method for solving complex problems by breaking them into subproblems and
storing results.
14. Q: What is a greedy algorithm?
A: An approach that makes the locally optimal choice at each step hoping to find the
global optimum.
15. Q: What is a graph?
A: A non-linear data structure consisting of nodes (vertices) and edges.
16. Q: What is the difference between a tree and a graph?
A: A tree is a hierarchical structure with no cycles; a graph can have cycles and
complex relationships.
17. Q: What is a heap?
A: A special tree-based structure that satisfies the heap property (max-heap or min-
heap).
18. Q: What is the use of a Trie data structure?
A: Efficient for searching and storing strings, like dictionaries or autocomplete.
19. Q: What is the time complexity of bubble sort?
A: O(n²)
20. Q: What is the best-case time complexity of insertion sort?
A: O(n)
21. Q: What is a binary tree?
A: A tree in which each node has at most two children.
22. Q: What is a balanced binary tree?
A: A tree where the height difference between left and right subtrees is at most one.
23. Q: What is a spanning tree?
A: A subgraph of a graph that includes all the vertices with minimum possible edges
and no cycles.
24. Q: What is topological sorting?
A: Linear ordering of vertices of a DAG (Directed Acyclic Graph) such that for every
directed edge u → v, u comes before v.
25. Q: What is backtracking?
A: A technique to solve problems incrementally and abandon solutions that fail to
satisfy constraints.

AIML

1. Q: What is Artificial Intelligence?


A: AI is the simulation of human intelligence in machines that can learn, reason, and
make decisions.
2. Q: Define Machine Learning.
A: Machine Learning is a subset of AI where machines learn patterns from data
without being explicitly programmed.
3. Q: What is supervised learning?
A: A type of ML where the model is trained on labeled data.
4. Q: What is unsupervised learning?
A: Learning from data without labels to find hidden patterns or groupings.
5. Q: What is reinforcement learning?
A: A learning technique where an agent learns to act in an environment by receiving
rewards or penalties.
6. Q: What is a dataset?
A: A collection of data used to train and test machine learning models.
7. Q: What is the difference between AI and ML?
A: AI is the broader concept of machines being intelligent; ML is a subset that
focuses on learning from data.
8. Q: What is overfitting in machine learning?
A: When a model learns the training data too well, including noise, and performs
poorly on unseen data.
9. Q: What is underfitting?
A: When a model is too simple to capture the patterns in the data, leading to poor
performance.
10. Q: What is a feature in machine learning?
A: An individual measurable property or characteristic of the data.
11. Q: What is a label in supervised learning?
A: The output or target variable that the model aims to predict.
12. Q: What is the confusion matrix?
A: A table used to evaluate the performance of a classification model.
13. Q: What is precision in ML classification?
A: The ratio of true positives to the sum of true and false positives.
14. Q: What is recall?
A: The ratio of true positives to the sum of true positives and false negatives.
15. Q: What is accuracy?
A: The ratio of correctly predicted observations to total observations.
16. Q: What is a neural network?
A: A series of algorithms that mimic the operations of a human brain to recognize
relationships in data.
17. Q: What is deep learning?
A: A subset of ML involving neural networks with many layers for complex pattern
recognition.
18. Q: What is gradient descent?
A: An optimization algorithm used to minimize the loss function by adjusting model
parameters.
19. Q: What is a loss function?
A: A method to evaluate how well the model's predictions match the actual values.
20. Q: What is k-means clustering?
A: An unsupervised algorithm that groups data into k clusters based on feature
similarity.
21. Q: What is a decision tree?
A: A flowchart-like tree structure used for decision making and classification.
22. Q: What is a support vector machine (SVM)?
A: A supervised learning algorithm that finds the optimal boundary between classes.
23. Q: What is the purpose of train-test split?
A: To evaluate a model’s performance on unseen data by splitting data into training
and testing sets.
24. Q: What is cross-validation?
A: A technique to assess how a model will generalize to an independent dataset.
25. Q: What is an AI agent?
A: An entity that perceives its environment through sensors and acts upon it using
actuators.
SECURITY FUNDAMENTALS

1. Q: What is cybersecurity?
A: Cybersecurity is the practice of protecting systems, networks, and data
from digital attacks.
2. Q: What is the CIA triad?
A: Confidentiality, Integrity, and Availability — the core principles of
information security.
3. Q: What is a firewall?
A: A firewall is a security device that monitors and controls incoming and
outgoing network traffic.
4. Q: What is encryption?
A: Encryption is the process of converting plain text into unreadable form to
prevent unauthorized access.
5. Q: What is the difference between symmetric and asymmetric
encryption?
A: Symmetric uses the same key for encryption and decryption; asymmetric
uses a public and a private key.
6. Q: What is a vulnerability?
A: A weakness in a system that can be exploited to compromise security.
7. Q: What is malware?
A: Malicious software designed to harm, exploit, or disrupt systems and
networks.
8. Q: What is phishing?
A: A social engineering attack where attackers trick users into revealing
personal or sensitive information.
9. Q: What is two-factor authentication (2FA)?
A: A security method requiring two different forms of identification to access
an account.
10. Q: What is an intrusion detection system (IDS)?
A: A system that monitors network traffic for suspicious activity and possible
threats.
11. Q: What is hashing?
A: A process that converts data into a fixed-size hash value, typically used for
verifying data integrity.
12. Q: What is the role of antivirus software?
A: It detects, prevents, and removes malware from computers and networks.
13. Q: What is a digital certificate?
A: A digital file that verifies the ownership of a public key, issued by a
Certificate Authority (CA).
14. Q: What is a DDoS attack?
A: Distributed Denial of Service — an attack that overwhelms a server or
network with traffic to make it unavailable.
15. Q: What is authentication?
A: The process of verifying the identity of a user or system.
16. Q: What is authorization?
A: The process of giving access rights to authenticated users based on roles or
policies.
17. Q: What is a man-in-the-middle (MITM) attack?
A: An attack where the attacker secretly intercepts and possibly alters
communication between two parties.
18. Q: What is social engineering?
A: A manipulation technique to trick users into giving confidential
information.
19. Q: What is a security policy?
A: A documented set of rules and procedures for maintaining and enforcing
security in an organization.
20. Q: What is penetration testing?
A: A simulated cyberattack to test the security of systems and identify
vulnerabilities.
21. Q: What is a zero-day vulnerability?
A: A security flaw that is unknown to the vendor and has no patch available.
22. Q: What is public key infrastructure (PKI)?
A: A framework for managing digital certificates and public-key encryption.
23. Q: What is access control?
A: A security method that restricts access to systems or data to authorized
users only.
24. Q: What is a brute-force attack?
A: An attack that tries every possible password combination to gain
unauthorized access.
25. Q: What is multi-factor authentication (MFA)?
A: A security process that uses more than one method of authentication from
independent categories.

You might also like