Loading...
Loading...
Phase 1: Technical Theory | Date: 26 July 2026 | Subject: New 2026 Topics | Expected Questions: About 3–4 Introductory Questions
Today you will study five important areas:
| Hour | Topic |
|---|---|
| 1 | Python indentation, data types, dynamic typing, mutable and immutable objects |
| 2 | Python list, tuple, dictionary, set, conditions, loops, lambda and list comprehension |
| 3 | Artificial Intelligence: Narrow AI, General AI, Super AI, Turing Test, expert systems and applications |
| 4 | Machine Learning: supervised, unsupervised and reinforcement learning; algorithms and applications |
| 5 | Blockchain: distributed ledger, mining, cryptocurrency and smart contracts; .NET: CLR, CTS, MSIL and .NET Framework |
After completing this material, you will be able to:
if-elif-else, for and while.Python is a high-level, general-purpose programming language.
High-level language means its instructions are easier for humans to read than machine language.
Python is widely used for:
| Feature | Meaning |
|---|---|
| Simple syntax | Programs are relatively easy to read |
| High-level | Hardware details are mostly hidden |
| Interpreted | Python code is normally executed through a Python implementation |
| Dynamically typed | A variable name is not permanently fixed to one data type |
| Object-oriented | Supports classes and objects |
| Cross-platform | Runs on Windows, Linux, macOS and other systems |
| Open source | Source code is publicly available |
| Large library | Many ready-made modules are available |
| Case-sensitive | name, Name and NAME are different |
print("Hello, World!")
Output:
Hello, World!
print() is a built-in function.A comment is explanatory text ignored by the Python interpreter.
# This is a comment
print("Hello")
Python has no separate traditional multi-line comment symbol like C’s /* ... */.
Triple-quoted strings are sometimes used as explanatory text, but they are string literals, not a special comment syntax.
Indentation means spaces or tabs placed at the beginning of a line.
Python uses indentation to define a block of code.
Other languages often use braces:
{
statements
}
Python uses indentation instead.
age = 20
if age >= 18:
print("Adult")
print("Eligible")
print("Done")
Output:
Adult
Eligible
Done
The two indented statements belong to the if block.
age = 20
if age >= 18:
print("Adult")
This causes an IndentationError because the if block is not indented.
if condition:
statement 1
statement 2
statement 3
statement 4
Meaning:
if block
├── statement 1
├── statement 2
└── statement 3
outside block
└── statement 4
Use four spaces for each indentation level.
Example:
if marks >= 40:
if marks >= 75:
print("Distinction")
else:
print("Pass")
ifelifelseforwhiledefclasstryA variable is a name that refers to a value or object.
Examples:
age = 20
name = "Asha"
marks = 85.5
Python does not require a data type before a variable name.
C-style declaration:
int age = 20;
Python style:
age = 20
A Python variable name:
age
student_name
marks2
_count
2marks
student name
class
total-marks
value = 10
Value = 20
These are two different names.
Python can assign several values in one statement.
a, b, c = 10, 20, 30
Now:
a = 10
b = 20
c = 30
x = y = z = 0
a = 5
b = 8
a, b = b, a
Now:
a = 8
b = 5
A data type describes the kind of value represented by an object.
| Category | Data Type | Example |
|---|---|---|
| Integer | int | 10, -5, 1000 |
| Decimal number | float | 3.14, -2.5 |
| Complex number | complex | 2 + 3j |
| Boolean | bool | True, False |
| Text | str | "Computer" |
| Sequence | list | [10, 20, 30] |
| Sequence | tuple | (10, 20, 30) |
| Range | range | range(5) |
| Mapping | dict | {"name": "Asha"} |
| Set | set | {10, 20, 30} |
| Immutable set | frozenset | frozenset({1, 2}) |
| No value | NoneType | None |
| Binary | bytes | b"ABC" |
| Mutable binary | bytearray | bytearray(b"ABC") |
An integer has no decimal point.
age = 20
temperature = -5
Type:
int
A float represents a number with a decimal point or exponential notation.
price = 99.50
value = 1.5e3
Here:
1.5e3 = 1500.0
Type:
float
Python uses j for the imaginary part.
number = 2 + 3j
Type:
complex
A Boolean value is either:
True
False
The first letter must be uppercase.
Example:
is_adult = True
is_empty = False
Comparison operations produce Boolean values:
print(10 > 5)
Output:
True
In Python:
True behaves numerically like 1
False behaves numerically like 0
Example:
print(True + True)
Output:
2
A string is a sequence of Unicode characters.
Strings may use single or double quotation marks.
city = "Jaipur"
subject = 'Computer'
String indices begin at zero.
word = "PYTHON"
| Index | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| Character | P | Y | T | H | O | N |
Examples:
word[0] = "P"
word[2] = "T"
word[-1] = "N"
A negative index counts from the end.
Syntax:
sequence[start:stop:step]
The stop position is excluded.
word = "PYTHON"
word[1:4] gives "YTH"
word[:3] gives "PYT"
word[3:] gives "HON"
word[::-1] gives "NOHTYP"
None represents the absence of a value.
result = None
It is not the same as:
Check it using:
if result is None:
print("No result")
The type() function returns the type of an object.
x = 10
print(type(x))
Output is similar to:
<class 'int'>
Other examples:
type(3.5) → float
type("Hello") → str
type([1, 2]) → list
type((1, 2)) → tuple
Type conversion changes a value from one type to another when possible.
| Function | Purpose | Example |
|---|---|---|
int() | Converts to integer | int("25") gives 25 |
float() | Converts to float | float("2.5") gives 2.5 |
str() | Converts to string | str(100) gives "100" |
list() | Converts to list | list("ABC") gives ['A','B','C'] |
tuple() | Converts to tuple | tuple([1,2]) gives (1,2) |
set() | Converts to set | set([1,1,2]) gives {1,2} |
x = input("Enter a number: ")
input() returns a string.
To read an integer:
x = int(input("Enter a number: "))
Python is dynamically typed.
This means a variable name is not permanently declared as one type. It can refer to objects of different types at different times.
Example:
x = 10
print(type(x))
x = "Computer"
print(type(x))
First:
x refers to an int object
Later:
x refers to a str object
It is the object that has a type. A variable name refers to the object.
| Static Typing | Dynamic Typing |
|---|---|
| Variable type is declared or checked mainly before execution | Type is associated with the value and checked during execution |
Example: int x = 10; in C++ | Example: x = 10 in Python |
| A name usually has a fixed declared type | A name can later refer to another type |
| Some errors are detected during compilation | Some type errors appear at runtime |
x = 10
y = "5"
print(x + y)
This causes a TypeError because Python does not automatically add an integer and a string.
Valid alternatives:
print(x + int(y))
or:
print(str(x) + y)
Mutable means changeable after creation.
Immutable means not changeable after creation.
| Mutable Types | Immutable Types |
|---|---|
list | int |
dict | float |
set | bool |
bytearray | str |
| Most user-defined objects | tuple |
frozenset | |
bytes |
numbers = [10, 20, 30]
numbers[1] = 99
Now:
numbers = [10, 99, 30]
The same list object was modified.
word = "CAT"
word[0] = "B"
This causes a TypeError because strings are immutable.
To produce a new string:
word = "B" + word[1:]
Now:
word = "BAT"
A new string object is created.
x = 10
x = x + 1
The integer object 10 is not modified. The name x is changed to refer to a new integer object, 11.
Before:
x ───> 10
After:
x ───> 11
The original integer value was not changed.
Two variable names can refer to the same mutable object.
a = [1, 2, 3]
b = a
b.append(4)
Now both show:
a = [1, 2, 3, 4]
b = [1, 2, 3, 4]
Diagram:
a ─────┐
v
[1, 2, 3, 4]
^
b ─────┘
a = [1, 2, 3]
b = a.copy()
b.append(4)
Now:
a = [1, 2, 3]
b = [1, 2, 3, 4]
For nested structures, a shallow copy still shares nested objects.
A list is an ordered, mutable collection.
numbers = [10, 20, 30]
names = ["Asha", "Ravi", "Mohan"]
mixed = [10, "Hello", 3.5, True]
numbers = [10, 20, 30]
numbers[0] → 10
numbers[1] → 20
numbers[-1] → 30
| Method | Purpose |
|---|---|
append(x) | Adds one item at the end |
extend(items) | Adds multiple items |
insert(i, x) | Inserts item at index i |
remove(x) | Removes first matching value |
pop() | Removes and returns last item |
pop(i) | Removes and returns item at index i |
clear() | Removes all items |
index(x) | Returns index of first matching value |
count(x) | Counts occurrences |
sort() | Sorts the list in place |
reverse() | Reverses the list in place |
copy() | Creates a shallow copy |
values = [10, 20]
values.append(30)
values.insert(1, 15)
values.remove(20)
Final list:
[10, 15, 30]
append() vs extend()a = [1, 2]
a.append([3, 4])
Result:
[1, 2, [3, 4]]
The entire list is added as one element.
b = [1, 2]
b.extend([3, 4])
Result:
[1, 2, 3, 4]
The elements are added individually.
A tuple is an ordered, immutable collection.
point = (10, 20)
colours = ("red", "green", "blue")
point[0] → 10
point[-1] → 20
student = 101, "Asha", 85
Python packs these values into a tuple.
roll, name, marks = student
Now:
roll = 101
name = "Asha"
marks = 85
This is not a tuple:
x = (5)
It is an integer.
A single-element tuple requires a comma:
x = (5,)
The comma creates the tuple.
| List | Tuple |
|---|---|
Written as [ ] | Usually written as ( ) |
| Mutable | Immutable |
| More modification methods | Fewer methods |
| Suitable for changing data | Suitable for fixed data |
Example: [1, 2] | Example: (1, 2) |
List = Changeable
Tuple = Fixed
A dictionary stores data as key-value pairs.
student = {
"name": "Asha",
"roll": 101,
"marks": 85
}
Key Value
--- -----
name → Asha
roll → 101
marks → 85
student["name"] → "Asha"
student["marks"] → 85
get()student.get("name") → "Asha"
Difference:
student["age"] raises KeyError if the key is absent.student.get("age") returns None by default if the key is absent.student["city"] = "Jaipur"
Adds a new pair.
student["marks"] = 90
Updates an existing value.
del student["roll"]
Deletes a pair.
| Method | Purpose |
|---|---|
keys() | Returns a view of keys |
values() | Returns a view of values |
items() | Returns key-value pairs |
get(key) | Safely obtains a value |
update(other) | Adds or updates pairs |
pop(key) | Removes a key and returns its value |
clear() | Removes all pairs |
for key, value in student.items():
print(key, value)
Dictionary keys must be hashable, which generally means their hash value does not change during their lifetime.
Common valid key types:
A list cannot normally be a dictionary key because a list is mutable.
Valid:
data["name"] = "Asha"
data[10] = "Ten"
data[(1, 2)] = "Point"
Invalid:
data[[1, 2]] = "List key"
A set is a mutable collection of unique elements.
numbers = {10, 20, 30}
values = {1, 2, 2, 3, 3, 3}
The set contains:
{1, 2, 3}
This creates an empty dictionary:
empty = {}
To create an empty set:
empty = set()
| Operation | Meaning |
|---|---|
add(x) | Adds one element |
remove(x) | Removes x; error if absent |
discard(x) | Removes x; no error if absent |
union() or ` | ` |
intersection() or & | Elements common to both |
difference() or - | Elements in first but not second |
symmetric_difference() or ^ | Elements in exactly one set |
A = {1, 2, 3}
B = {3, 4, 5}
Results:
A | B = {1, 2, 3, 4, 5}
A & B = {3}
A - B = {1, 2}
A ^ B = {1, 2, 4, 5}
| Feature | List | Tuple | Dictionary | Set |
|---|---|---|---|---|
| Syntax | [1, 2] | (1, 2) | {"a": 1} | {1, 2} |
| Ordered | Yes | Yes | Preserves insertion order | No positional order guarantee |
| Indexed | Yes | Yes | Accessed by key | No |
| Mutable | Yes | No | Yes | Yes |
| Duplicates | Yes | Yes | Keys: No; Values: Yes | No |
| Main Use | Changing sequence | Fixed sequence | Key-value mapping | Unique values |
| Empty Form | [] | () | {} | set() |
LiTuDiSe
Memory sentence:
List changes, Tuple freezes, Dictionary maps, Set removes duplicates.
Python uses:
innot inExamples:
20 in [10, 20, 30] → True
"a" in "cat" → True
5 not in {1, 2, 3} → True
For a dictionary, in checks keys by default.
student = {"name": "Asha", "marks": 85}
"name" in student → True
"Asha" in student → False
Conditional statements allow a program to make decisions.
ifage = 20
if age >= 18:
print("Adult")
Output:
Adult
if-elsenumber = 7
if number % 2 == 0:
print("Even")
else:
print("Odd")
Output:
Odd
if-elif-elsemarks = 72
if marks >= 75:
print("Distinction")
elif marks >= 60:
print("First Division")
elif marks >= 40:
print("Pass")
else:
print("Fail")
Output:
First Division
Start
│
v
Condition 1 true? ──Yes──> Block 1
│ No
v
Condition 2 true? ──Yes──> Block 2
│ No
v
Else block
| Operator | Meaning |
|---|---|
== | Equal to |
!= | Not equal to |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
| Operator | Meaning |
|---|---|
and | True if both conditions are true |
or | True if at least one condition is true |
not | Reverses the Boolean result |
Example:
age = 20
citizen = True
if age >= 18 and citizen:
print("Eligible")
In a condition, Python treats certain values as false.
Common falsy values:
FalseNone0 and 0.0""[](){}set()Most other values are truthy.
Example:
name = ""
if name:
print("Name exists")
else:
print("Empty")
Output:
Empty
for LoopA for loop visits items from an iterable.
An iterable is an object whose elements can be visited one by one.
for value in [10, 20, 30]:
print(value)
Output:
10
20
30
for character in "CAT":
print(character)
Output:
C
A
T
range() Functionrange() produces a sequence of integers for iteration.
range(stop)
Example:
for i in range(5):
print(i, end=" ")
Output:
0 1 2 3 4
The stop value is excluded.
range(start, stop)
for i in range(2, 6):
print(i, end=" ")
Output:
2 3 4 5
range(start, stop, step)
for i in range(2, 11, 2):
print(i, end=" ")
Output:
2 4 6 8 10
for i in range(5, 0, -1):
print(i, end=" ")
Output:
5 4 3 2 1
while LoopA while loop repeats while its condition is true.
i = 1
while i <= 5:
print(i, end=" ")
i += 1
Output:
1 2 3 4 5
Initialize
│
v
Condition true?
│ Yes
v
Execute body
│
v
Update value
│
└────> Test again
i = 1
while i <= 5:
print(i)
This never changes i, so it continues indefinitely.
break, continue and passbreakEnds the nearest loop immediately.
for i in range(1, 6):
if i == 4:
break
print(i, end=" ")
Output:
1 2 3
continueSkips the remaining statements in the current iteration.
for i in range(1, 6):
if i == 3:
continue
print(i, end=" ")
Output:
1 2 4 5
passDoes nothing. It acts as a placeholder where a statement is required.
if True:
pass
| Keyword | Action |
|---|---|
break | Ends the loop |
continue | Skips to the next iteration |
pass | Does nothing |
A function is a reusable block of code.
def add(a, b):
return a + b
result = add(5, 3)
print(result)
Output:
8
| Part | Meaning |
|---|---|
def | Defines a function |
add | Function name |
a, b | Parameters |
return | Sends a value back |
add(5, 3) | Function call |
A lambda function is a small anonymous function.
Anonymous means it may be created without a normal function name.
lambda arguments: expression
def square(x):
return x * x
square = lambda x: x * x
Call:
print(square(5))
Output:
25
add = lambda a, b: a + b
print(add(4, 6))
Output:
10
def function is better for complex logic.sorted()students = [("Asha", 85), ("Ravi", 70), ("Mohan", 90)]
result = sorted(students, key=lambda item: item[1])
The lambda returns each student’s marks, so sorting uses marks.
Result:
[("Ravi", 70), ("Asha", 85), ("Mohan", 90)]
A list comprehension is a concise way to create a list from an iterable.
[expression for item in iterable]
squares = []
for x in range(1, 6):
squares.append(x * x)
Result:
[1, 4, 9, 16, 25]
squares = [x * x for x in range(1, 6)]
Result:
[1, 4, 9, 16, 25]
Syntax:
[expression for item in iterable if condition]
Example:
evens = [x for x in range(1, 11) if x % 2 == 0]
Result:
[2, 4, 6, 8, 10]
range(1, 11)
│
v
Take each x
│
v
Is x even?
/ \
No Yes
│ │
Skip Add x
│
v
New list
labels = ["Even" if x % 2 == 0 else "Odd" for x in range(1, 5)]
Result:
["Odd", "Even", "Odd", "Even"]
The if-else expression comes before for in this form.
Artificial Intelligence, abbreviated as AI, is the field of creating computer systems that perform tasks normally associated with human intelligence.
These tasks may include:
AI enables machines to perform tasks that appear intelligent.
These terms are related but not identical.
Artificial Intelligence
└── Machine Learning
└── Deep Learning
| Term | Main Idea |
|---|---|
| AI | Make machines perform intelligent tasks |
| ML | Learn patterns from data |
| Deep Learning | Learn through multi-layer neural networks |
The common capability-based classification is:
Narrow AI, also called Weak AI, is designed for a specific task or a limited set of tasks.
It does not possess general human-level intelligence.
A chess AI may play chess extremely well, but it cannot automatically diagnose a disease or drive a car.
General AI, also called Artificial General Intelligence or AGI, is a theoretical system with broad human-like intellectual ability.
It would be able to:
General AI remains a research goal. It is not established as a completed, generally available human-level system.
Super AI or Artificial Superintelligence is a hypothetical form of AI that would exceed human intelligence in almost every important area.
Possible abilities would include:
Super AI is hypothetical. It does not currently exist as an established technology.
| Feature | Narrow AI | General AI | Super AI |
|---|---|---|---|
| Scope | Specific task | Broad human-level tasks | Beyond human intelligence |
| Current Status | Exists | Research goal/theoretical | Hypothetical |
| Adaptability | Limited to trained area | Broad adaptability | Greater than humans |
| Example | Spam filter | Human-like general machine | Hypothetical superior system |
NGS
The Turing Test was proposed by Alan Turing in 1950.
It is a test of whether a machine can produce conversational behaviour that a human evaluator cannot reliably distinguish from a human’s behaviour.
Human evaluator
/ \
/ \
v v
Human Machine
participant participant
Communication is usually text-based so appearance and voice do not reveal identity.
Can the evaluator reliably determine which participant is the machine?
If the machine’s replies are indistinguishable from a human’s replies under the test conditions, it is said to perform successfully in the test.
Passing the Turing Test does not necessarily prove that a machine:
It mainly evaluates observable conversational behaviour.
An expert system is an AI program designed to imitate the decision-making of a human expert in a specific domain.
Examples of domains:
The knowledge base stores:
Example rule:
IF fever is high
AND cough is present
THEN consider respiratory infection
The inference engine applies rules to known facts and produces conclusions.
User facts
│
v
Inference engine
│
├── Reads rules from knowledge base
├── Matches facts with rules
└── Produces conclusion
│
v
Advice or decision
Starts with known facts and applies rules to reach a conclusion.
Facts → Rules → Conclusion
Starts with a possible conclusion and checks whether supporting facts and rules are true.
Possible conclusion → Required conditions → Facts
| Advantages | Limitations |
|---|---|
| Available at any time | Limited to its knowledge domain |
| Gives consistent decisions | Cannot replace all human judgment |
| Preserves expert knowledge | Knowledge collection can be difficult |
| Can process rules quickly | May fail in unfamiliar situations |
| Useful for training | Maintenance may be expensive |
| Area | AI Application |
|---|---|
| Healthcare | Disease detection, medical-image analysis |
| Education | Adaptive learning and automatic assessment |
| Banking | Fraud detection and credit-risk analysis |
| Agriculture | Crop monitoring and disease detection |
| Transport | Route planning and driver assistance |
| Cybersecurity | Threat and anomaly detection |
| E-commerce | Product recommendations |
| Customer service | Chatbots |
| Manufacturing | Predictive maintenance and quality control |
| Entertainment | Content recommendations |
| Language | Translation and speech recognition |
| Government | Document processing and service automation |
Machine Learning, abbreviated as ML, is a branch of AI in which computer systems learn patterns from data to make predictions or decisions.
Instead of writing every decision rule manually, we provide:
The system creates a model.
A model is the learned pattern or mathematical representation used for predictions.
Data + Written rules
│
v
Output
Training data + Learning algorithm
│
v
Model
New data + Model
│
v
Prediction
| Term | Meaning |
|---|---|
| Dataset | Collection of examples |
| Feature | Input characteristic used for learning |
| Label | Correct output or target |
| Training | Process of learning from data |
| Model | Learned pattern used for prediction |
| Prediction | Model’s output for new data |
| Classification | Predicting a category |
| Regression | Predicting a numeric value |
| Clustering | Grouping similar items |
| Agent | Decision-maker in reinforcement learning |
| Reward | Feedback received by an agent |
| Feature | Example |
|---|---|
| Area | 1500 square feet |
| Bedrooms | 3 |
| Location | Jaipur |
| Age | 5 years |
| Label | House price |
The roadmap focuses on:
SUR
Memory sentence:
Student Uses Rewards
In supervised learning, a model learns from labelled data.
Labelled data contains both:
| Email Text | Label |
|---|---|
| “Win a free prize” | Spam |
| “Meeting at 10 AM” | Not spam |
| “Claim your reward” | Spam |
The model learns from these examples and predicts whether a new email is spam.
Labelled training data
Inputs + correct answers
│
v
Learning algorithm
│
v
Model
│
v
Prediction for new input
Classification predicts a category.
Examples:
Regression predicts a continuous numeric value.
Examples:
| Classification | Regression |
|---|---|
| Predicts a class or category | Predicts a numeric value |
| Example: Spam/Not spam | Example: Price ₹25 lakh |
| Output is discrete | Output is continuous |
| Algorithm | Common Use |
|---|---|
| Linear Regression | Numeric prediction |
| Logistic Regression | Classification |
| Decision Tree | Classification and regression |
| Random Forest | Classification and regression |
| Support Vector Machine | Classification and regression |
| k-Nearest Neighbours | Classification and regression |
| Naive Bayes | Classification, especially text |
| Neural Network | Complex classification and prediction |
Despite its name, Logistic Regression is mainly used for classification.
In unsupervised learning, the model learns from unlabelled data.
Unlabelled data has inputs but no given correct answers.
The system tries to discover:
A company has customer data but no predefined customer categories.
The algorithm groups customers according to:
This is customer segmentation.
Clustering groups similar items.
Examples:
Association finds items or events that occur together.
Example:
Customers who buy bread may also buy butter.
It reduces the number of features while keeping important information.
This can help with:
It finds unusual patterns.
Example:
| Algorithm | Common Use |
|---|---|
| K-Means | Clustering |
| Hierarchical Clustering | Building clusters in a hierarchy |
| DBSCAN | Density-based clustering |
| Apriori | Association-rule mining |
| Principal Component Analysis | Dimensionality reduction |
| Autoencoder | Representation learning and anomaly detection |
In reinforcement learning, an agent learns by interacting with an environment.
The agent takes an action and receives:
The goal is to learn a policy that maximizes long-term reward.
| Component | Meaning |
|---|---|
| Agent | Learner or decision-maker |
| Environment | World in which the agent operates |
| State | Current situation |
| Action | Choice made by the agent |
| Reward | Feedback after an action |
| Policy | Strategy for selecting actions |
Environment gives state
│
v
Agent
│
│ selects action
v
Environment
│
├── New state
└── Reward or penalty
│
└────> Agent learns
A reinforcement-learning agent must balance:
Trying a new action to gain information.
Using the action already believed to give the best reward.
| Exploration | Exploitation |
|---|---|
| Try something new | Use known best action |
| May discover better choices | Gains known reward |
| Increases knowledge | Uses existing knowledge |
| Algorithm | Main Idea |
|---|---|
| Q-Learning | Learns values of state-action pairs |
| SARSA | Learns using the action actually selected |
| Deep Q-Network | Uses a neural network with Q-learning ideas |
| Policy Gradient | Directly improves the action-selection policy |
For an introductory exam, remember:
Q-Learning → Reinforcement learning
| Basis | Supervised | Unsupervised | Reinforcement |
|---|---|---|---|
| Training Data | Labelled | Unlabelled | Interaction experience |
| Correct Answers Given | Yes | No | Rewards or penalties |
| Main Goal | Predict output | Find hidden patterns | Maximize long-term reward |
| Main Tasks | Classification, regression | Clustering, association | Sequential decisions |
| Example | Spam detection | Customer segmentation | Game-playing agent |
| Common Algorithm | Decision Tree | K-Means | Q-Learning |
Ask:
A dataset is commonly divided into:
Used to teach the model.
Used to select settings and compare model choices.
Used to evaluate the final model on unseen examples.
Testing on the same data used for training can give an unrealistically high score.
The model memorizes training details and performs poorly on new data.
Excellent training performance
Poor new-data performance
The model is too simple to learn the important pattern.
Poor training performance
Poor new-data performance
Learns important patterns
Performs well on unseen data
| Application | Likely Task |
|---|---|
| Spam detection | Supervised classification |
| House price prediction | Supervised regression |
| Customer segmentation | Unsupervised clustering |
| Product association | Unsupervised association |
| Robot navigation | Reinforcement learning |
| Game-playing AI | Reinforcement learning |
| Credit-risk prediction | Supervised classification |
| Sales forecasting | Supervised regression |
| Fraud anomaly detection | Supervised or unsupervised |
| Image recognition | Supervised learning/deep learning |
A ledger is a record of transactions.
Example:
| Transaction | From | To | Amount |
|---|---|---|---|
| 1 | A | B | 100 |
| 2 | B | C | 40 |
| 3 | C | D | 15 |
A bank traditionally maintains a centralized ledger.
One central organization controls the main record.
Users
│
v
Central server
│
v
Main ledger
Copies of the ledger are shared across multiple participating computers called nodes.
A node is a computer participating in the network.
Node A ─── Node B
│ │
│ │
Node C ─── Node D
Each authorized participant may hold or verify a copy according to the network’s design.
| Centralized Ledger | Distributed Ledger |
|---|---|
| Controlled by one central authority | Shared across multiple nodes |
| One main control point | Distributed control or validation |
| Central server failure may cause disruption | Replication can improve resilience |
| Trust placed mainly in central authority | Trust supported by protocol and consensus |
A blockchain is a type of distributed ledger in which transaction records are grouped into blocks.
Each block is cryptographically linked to the previous block.
Cryptography means techniques used to protect information and verify integrity.
┌────────────────────┐
│ Block 1 │
│ Transactions │
│ Previous hash: 0 │
│ Hash: H1 │
└─────────┬──────────┘
│
v
┌────────────────────┐
│ Block 2 │
│ Transactions │
│ Previous hash: H1 │
│ Hash: H2 │
└─────────┬──────────┘
│
v
┌────────────────────┐
│ Block 3 │
│ Transactions │
│ Previous hash: H2 │
│ Hash: H3 │
└────────────────────┘
The linking creates a chain of blocks.
A simplified block may contain:
The previous hash links the current block to the earlier block.
A nonce is a value changed during some proof-of-work mining processes to search for a valid block hash.
Not every blockchain uses proof of work or the same type of nonce.
A hash function converts input data into a fixed-length output called a hash or digest.
Conceptual example:
Input data
│
v
Hash function
│
v
Fixed-length hash
A cryptographic hash function is designed so that:
If someone changes data in an old block:
Blockchain data is often described as immutable, but “tamper-evident” or “tamper-resistant” is more precise. Changing accepted history is designed to be very difficult, not magically impossible under every condition.
A consensus mechanism is the method used by distributed nodes to agree on valid transactions and the ledger state.
Common examples:
Participants perform computational work to propose valid blocks.
Used historically and currently by some blockchain systems.
Validators are selected using rules involving cryptocurrency placed at stake and other protocol conditions.
It usually requires less computational energy than proof of work.
Mining commonly refers to the process used in proof-of-work blockchains to:
New transactions
│
v
Candidate block
│
v
Try nonce values
│
v
Valid proof found?
/ \
No Yes
│ │
└─ Try again v
Broadcast block
│
v
Network verifies
│
v
Block accepted
Not all blockchains use mining.
A cryptocurrency is a digital asset that uses cryptographic techniques and is recorded on a blockchain or similar distributed-ledger system.
Examples include:
| Term | Meaning |
|---|---|
| Coin | Native digital asset of a blockchain |
| Token | Digital asset created using an existing platform |
| Wallet | Software or hardware used to manage keys |
| Public key/address | Used to identify a destination or verify signatures |
| Private key | Secret key used to authorize operations |
| Transaction | Transfer or operation recorded by the network |
A private key must remain secret.
If another person obtains the private key, that person may be able to authorize transactions.
A wallet usually manages cryptographic keys. The cryptocurrency record itself remains on the blockchain.
A smart contract is a program stored and executed in a blockchain environment.
It performs actions automatically when its programmed conditions are met.
IF payment is received
THEN transfer digital ownership
User transaction
│
v
Smart contract receives input
│
v
Conditions checked
/ \
False True
│ │
No action Execute programmed action
│
v
Record result
An oracle supplies external data to a blockchain application.
| Type | Access and Control |
|---|---|
| Public blockchain | Broad participation according to public protocol rules |
| Private blockchain | Controlled by one organization |
| Consortium blockchain | Controlled by a group of organizations |
| Advantages | Limitations |
|---|---|
| Shared record | Limited transaction speed in some systems |
| Tamper-evident history | Energy use can be high in proof-of-work systems |
| Reduced dependence on one central record | Data may be difficult to correct |
| Traceability | Privacy challenges |
| Automated smart contracts | Smart-contract bugs |
| Replication across nodes | Storage and scalability costs |
| Blockchain | Traditional Database |
|---|---|
| Distributed ledger design | Often centrally administered |
| Records may be append-oriented | Records can usually be freely updated or deleted |
| Consensus validates changes | Database administrator controls rules |
| Useful among parties needing a shared history | Useful for general data storage and fast queries |
| Cryptographically linked records | No block-chain structure required |
Blockchain is not automatically better than a normal database. The correct choice depends on the problem.
.NET is a software development platform created by Microsoft.
It is used to build applications such as:
Modern .NET is cross-platform and can run on Windows, Linux and macOS.
The term .NET Framework usually refers to the older Windows-focused implementation.
For the examination, remember:
CLR stands for Common Language Runtime.
It is the execution environment for managed .NET code.
Managed code is code whose execution is managed by the CLR.
Java uses JVM
.NET uses CLR
They are not identical, but both provide managed runtime services.
CTS stands for Common Type System.
CTS defines how data types are declared, used and managed in .NET.
It helps different .NET languages understand compatible types.
A C# integer type:
int
corresponds to a .NET type:
System.Int32
A Visual Basic program can use a corresponding CTS-compatible type.
Suppose one component is written in C# and another in Visual Basic. CTS gives them a shared understanding of types.
CTS broadly supports:
Store their value directly.
Examples:
Store a reference to an object.
Examples:
CLS stands for Common Language Specification.
CLS is a set of rules that .NET languages follow to improve language interoperability.
Interoperability means different languages or systems can work together.
| CTS | CLS |
|---|---|
| Defines all .NET types and type behaviour | Defines a common subset of language rules |
| Broad type system | Rules for language compatibility |
| Helps runtime type safety | Helps components written in different languages interact |
Memory rule:
CTS = Types
CLS = Language rules
Although CLS is not explicitly listed in the Day 6 roadmap, it is commonly asked with CLR and CTS.
MSIL stands for Microsoft Intermediate Language.
The modern standardized term is:
CIL — Common Intermediate Language
Many exam books still use MSIL.
A .NET language compiler converts source code into intermediate language rather than directly into one processor’s native machine code.
C# source code
Program.cs
│
│ C# compiler
v
CIL/MSIL + metadata
Assembly
│
│ CLR and JIT compiler
v
Native machine code
│
v
Execution
Metadata means data describing other data.
In a .NET assembly, metadata describes:
The CLR uses metadata to understand the program’s structure.
An assembly is a compiled .NET deployment unit.
Common file extensions:
.exe.dllAn assembly commonly contains:
The manifest contains assembly information such as:
JIT stands for Just-In-Time compiler.
The JIT compiler converts CIL/MSIL into native machine code when the program runs.
Source language
│
v
Language compiler
│
v
CIL/MSIL
│
v
CLR
│
v
JIT compiler
│
v
Native machine code
The Framework Class Library, abbreviated as FCL, is a collection of reusable classes and functions.
It provides support for:
The Base Class Library, or BCL, is the core part of the available class libraries.
The CLR provides automatic garbage collection.
It finds managed objects that are no longer reachable and makes their memory available for reuse.
Benefits:
Garbage collection does not remove the need to properly release unmanaged resources such as open files or network connections.
┌─────────────────────────────────────┐
│ Applications │
│ Web, Desktop, Services, APIs │
└──────────────────┬──────────────────┘
│
┌──────────────────v──────────────────┐
│ Framework Class Library │
│ Collections, Files, Network, UI │
└──────────────────┬──────────────────┘
│
┌──────────────────v──────────────────┐
│ Common Language Runtime │
│ JIT, GC, Exceptions, Security │
└──────────────────┬──────────────────┘
│
┌──────────────────v──────────────────┐
│ Operating System and Hardware │
└─────────────────────────────────────┘
| Java | .NET |
|---|---|
| Java source commonly compiles to bytecode | .NET languages compile to CIL/MSIL |
| JVM executes Java bytecode | CLR manages .NET execution |
| JIT may convert bytecode to native code | JIT converts CIL to native code |
| JRE provides runtime environment concept | CLR and .NET runtime provide runtime services |
| Java Class Library | .NET Class Library |
| Mainly Java language, though JVM supports others | Designed for several .NET languages |
Java bytecode ≈ CIL/MSIL
JVM ≈ CLR
Java libraries ≈ .NET class libraries
The items are similar in role, but they are not the same technology.
| Concept | Key Point |
|---|---|
| Indentation | Defines code blocks |
| Dynamic typing | A name can refer to objects of different types |
| Mutable | Object can be changed |
| Immutable | Object cannot be changed |
type(x) | Returns the type |
input() | Returns a string |
None | Represents no value |
Mutable:
list, dict, set, bytearray
Immutable:
int, float, bool, str, tuple, bytes, frozenset
| Feature | List | Tuple | Dictionary | Set |
|---|---|---|---|---|
| Syntax | [] | () | {key: value} | {value} |
| Mutable | Yes | No | Yes | Yes |
| Duplicates | Yes | Yes | Keys: No | No |
| Access | Index | Index | Key | Membership |
| Main Use | Changing sequence | Fixed sequence | Key-value data | Unique values |
Memory sentence:
List changes
Tuple freezes
Dictionary maps
Set removes duplicates
if condition:
statement
elif condition:
statement
else:
statement
for x in iterable:
statement
while condition:
statement
| Keyword | Meaning |
|---|---|
break | End loop |
continue | Skip current iteration |
pass | Do nothing |
Syntax:
lambda arguments: expression
Example:
square = lambda x: x * x
Basic:
[expression for item in iterable]
With condition:
[expression for item in iterable if condition]
Example:
[x * x for x in range(1, 5)]
Result:
[1, 4, 9, 16]
| Type | Meaning | Status |
|---|---|---|
| Narrow AI | Specific task | Exists |
| General AI | Broad human-level intelligence | Research goal |
| Super AI | Beyond human intelligence | Hypothetical |
Mnemonic:
Narrow = Now
General = Goal
Super = Speculation
Main components:
Knowledge base + Inference engine + User interface
Reasoning:
Forward chaining: Facts → Conclusion
Backward chaining: Conclusion → Required facts
| Type | Data/Feedback | Example |
|---|---|---|
| Supervised | Labelled data | Spam detection |
| Unsupervised | Unlabelled data | Customer clustering |
| Reinforcement | Rewards and penalties | Game-playing agent |
Classification → Category
Regression → Numeric value
Clustering → Similar groups
| Algorithm | Type |
|---|---|
| Linear Regression | Supervised |
| Logistic Regression | Supervised classification |
| Decision Tree | Supervised |
| K-Means | Unsupervised |
| Apriori | Unsupervised association |
| PCA | Unsupervised dimensionality reduction |
| Q-Learning | Reinforcement |
Transactions
│
v
Block
│ linked by hashes
v
Block
│
v
Block
Key terms:
| Term | Meaning |
|---|---|
| Distributed ledger | Shared transaction record across nodes |
| Block | Group of transaction records |
| Hash | Fixed-length digital digest |
| Consensus | Method for agreeing on ledger state |
| Mining | Proof-of-work block creation process |
| Cryptocurrency | Blockchain-based digital asset |
| Smart contract | Program executed in a blockchain environment |
| Term | Full Form | Purpose |
|---|---|---|
| CLR | Common Language Runtime | Manages .NET execution |
| CTS | Common Type System | Defines shared .NET types |
| CLS | Common Language Specification | Common language rules |
| MSIL | Microsoft Intermediate Language | Intermediate compiled code |
| CIL | Common Intermediate Language | Standardized name for intermediate language |
| JIT | Just-In-Time compiler | Converts CIL to native code |
| FCL | Framework Class Library | Reusable .NET classes |
Source code
│
v
Language compiler
│
v
CIL/MSIL + Metadata
│
v
CLR + JIT
│
v
Native machine code
What defines a block of code in Python?
A. Parentheses
B. Curly braces only
C. Indentation
D. Semicolon
Which statement best explains dynamic typing in Python?
A. Every variable must be declared as int.
B. A variable name can refer to objects of different types at different times.
C. Python has no data types.
D. All values are automatically strings.
Which Python type is mutable?
A. String
B. Tuple
C. List
D. Integer
Which Python type is immutable?
A. Dictionary
B. Set
C. List
D. Tuple
What is the output?
values = [10, 20]
values.append(30)
print(values)
A. [10, 20]
B. [10, 20, 30]
C. [30, 10, 20]
D. 10 20 30
Which expression creates a single-element tuple?
A. (5)
B. [5]
C. {5}
D. (5,)
What is the output?
values = {1, 2, 2, 3, 3}
print(len(values))
A. 2
B. 3
C. 5
D. Error
What is the output?
for i in range(1, 6, 2):
print(i, end=" ")
A. 1 2 3 4 5
B. 1 3 5
C. 2 4 6
D. 1 3
What is the output?
square = lambda x: x * x
print(square(4))
A. 4
B. 8
C. 16
D. Error
What is the value of result?
result = [x for x in range(1, 7) if x % 2 == 0]
A. [1, 3, 5]
B. [2, 4, 6]
C. [1, 2, 3, 4, 5, 6]
D. [4, 16, 36]
Which type of AI is designed for a specific task?
A. Narrow AI
B. General AI
C. Super AI
D. Biological AI
Which statement about General AI is most accurate?
A. It is the same as a calculator.
B. It is a broad human-level intelligence research goal.
C. It exists in every mobile phone.
D. It is limited to one fixed task by definition.
Who proposed the test that evaluates whether machine conversation can be distinguished from human conversation?
A. Charles Babbage
B. Alan Turing
C. Tim Berners-Lee
D. Dennis Ritchie
Which component of an expert system stores facts and rules?
A. Compiler
B. Knowledge base
C. Cache memory
D. Operating system
Which component applies expert-system rules to known facts?
A. Inference engine
B. Keyboard
C. Loader
D. Blockchain miner
Which type of Machine Learning uses labelled training data?
A. Unsupervised learning
B. Reinforcement learning
C. Supervised learning
D. Random learning
Customer segmentation without predefined group labels is commonly an example of:
A. Supervised regression
B. Unsupervised clustering
C. Reinforcement learning
D. Compilation
Which task predicts a continuous numeric value?
A. Classification
B. Clustering
C. Regression
D. Association only
Which algorithm is strongly associated with reinforcement learning?
A. K-Means
B. Q-Learning
C. Linear Search
D. Bubble Sort
In reinforcement learning, feedback after an action is called:
A. Index
B. Reward
C. Tuple
D. Compiler
In a blockchain, each block is normally linked to the previous block using:
A. A keyboard code
B. A hash
C. A compiler variable
D. A list index only
Which statement about mining is correct?
A. Every blockchain must use mining.
B. Mining is associated mainly with proof-of-work blockchains.
C. Mining means deleting old blocks.
D. Mining converts Java code into bytecode.
What is a smart contract?
A. A paper contract scanned into a computer
B. A program executed in a blockchain environment
C. A password for a cryptocurrency wallet
D. A traditional database table
What does CLR stand for?
A. Common Language Runtime
B. Central Ledger Record
C. Computer Learning Rule
D. Common List Register
Which sequence correctly shows basic .NET execution?
A. Source → CIL/MSIL → CLR/JIT → Native code
B. Source → HTML → Blockchain → Native code
C. CIL → Python list → Source code
D. Native code → Source → CIL
| Q. | Answer | Q. | Answer | Q. | Answer | Q. | Answer | Q. | Answer |
|---|---|---|---|---|---|---|---|---|---|
| 1 | C | 6 | D | 11 | A | 16 | C | 21 | B |
| 2 | B | 7 | B | 12 | B | 17 | B | 22 | B |
| 3 | C | 8 | B | 13 | B | 18 | C | 23 | B |
| 4 | D | 9 | C | 14 | B | 19 | B | 24 | A |
| 5 | B | 10 | B | 15 | A | 20 | B | 25 | A |
Python uses indentation to create code blocks.
if condition:
indented statement
The indented statement belongs to the if block.
Python is dynamically typed.
Example:
value = 10
value = "Computer"
First, value refers to an integer. Later, it refers to a string.
The objects have types. The variable name can be connected to a different object later.
A list is mutable, which means its contents can be changed after creation.
Example:
values = [10, 20, 30]
values[1] = 50
Result:
[10, 50, 30]
Strings, tuples and integers are immutable.
A tuple is immutable.
Example:
values = (10, 20, 30)
This is invalid:
values[0] = 50
It causes a TypeError.
[10, 20, 30]Initial list:
[10, 20]
Operation:
values.append(30)
append() adds one element at the end.
Result:
[10, 20, 30]
(5,)A comma is required to create a single-element tuple.
(5) → integer
(5,) → tuple
[5] → list
{5} → set
A set stores unique values.
Original values:
1, 2, 2, 3, 3
Unique values:
1, 2, 3
Therefore:
len(values) = 3
1 3 5The range is:
range(start, stop, step)
range(1, 6, 2)
Start at 1, add 2 each time and stop before 6:
1, 3, 5
Output:
1 3 5
The lambda function is:
lambda x: x * x
For x = 4:
4 × 4 = 16
Output:
16
[2, 4, 6]The list comprehension examines numbers from 1 to 6.
Condition:
x % 2 == 0
Only even values are selected:
2, 4, 6
Result:
[2, 4, 6]
Narrow AI is designed for a specific task or limited group of tasks.
Examples:
Narrow AI is the practical form of AI used today.
General AI would be able to:
It remains a research goal rather than an established, generally available human-level system.
Alan Turing proposed the imitation game, commonly called the Turing Test, in 1950.
The test evaluates whether a machine’s conversational responses can be reliably distinguished from a human’s responses.
The knowledge base stores:
Example rule:
IF temperature is high
AND cough is present
THEN consider infection
The inference engine applies rules from the knowledge base to known facts.
Basic flow:
Facts
│
v
Inference engine
│
v
Rules applied
│
v
Conclusion
Supervised learning uses labelled data.
Each training example contains:
Example:
| Label | |
|---|---|
| “Win a prize” | Spam |
| “Meeting today” | Not spam |
Customer segmentation groups customers according to similarities without predefined labels.
Example features:
A common clustering algorithm is K-Means.
Regression predicts a continuous numeric value.
Examples:
Classification predicts a category, such as spam or not spam.
Q-Learning is a reinforcement-learning algorithm.
It learns the value of actions in different states so that an agent can select actions that produce greater long-term reward.
In reinforcement learning:
A block normally stores a reference to the previous block’s hash.
Simplified chain:
Block 1
Hash = H1
│
v
Block 2
Previous hash = H1
Hash = H2
│
v
Block 3
Previous hash = H2
This cryptographic linking makes changes detectable.
Mining commonly involves:
Not every blockchain uses mining. Proof-of-stake systems generally use validators instead.
A smart contract is a program stored and executed in a blockchain environment.
Example:
IF payment is received
THEN transfer digital ownership
It automatically performs programmed actions when its conditions are met.
CLR stands for:
Common Language Runtime
It manages the execution of .NET programs.
Its responsibilities include:
The basic .NET execution flow is:
Source code
│
v
Language compiler
│
v
CIL/MSIL and metadata
│
v
CLR and JIT compiler
│
v
Native machine code
Complete these tests without looking at the main notes.
Which lines belong to the if block?
marks = 80
if marks >= 40:
print("Pass")
print("Successful")
print("Completed")
These statements belong to the if block:
print("Pass")
print("Successful")
This statement is outside the block:
print("Completed")
Output:
Pass
Successful
Completed
Trace the types:
value = 25
print(type(value))
value = 2.5
print(type(value))
value = "RSSB"
print(type(value))
First:
value = 25
type = int
Second:
value = 2.5
type = float
Third:
value = "RSSB"
type = str
This demonstrates dynamic typing.
Classify each type:
| Type | Mutable or Immutable |
|---|---|
| List | Mutable |
| Tuple | Immutable |
| Dictionary | Mutable |
| String | Immutable |
| Set | Mutable |
| Integer | Immutable |
| Float | Immutable |
| Boolean | Immutable |
Mnemonic:
Mutable: List, Dictionary, Set
Immutable: Number, String, Tuple
Predict the output:
a = [1, 2]
b = a
b.append(3)
print(a)
print(b)
a and b refer to the same mutable list.
Diagram:
a ───┐
v
[1, 2, 3]
^
b ───┘
Output:
[1, 2, 3]
[1, 2, 3]
Predict the output:
a = [1, 2]
b = a.copy()
b.append(3)
print(a)
print(b)
b is a separate list.
Output:
[1, 2]
[1, 2, 3]
Start with:
values = [10, 20, 30]
Perform:
values.append(40)
values.insert(1, 15)
values.remove(30)
After append(40):
[10, 20, 30, 40]
After insert(1, 15):
[10, 15, 20, 30, 40]
After remove(30):
[10, 15, 20, 40]
append() vs extend()Predict the lists:
a = [1, 2]
a.append([3, 4])
b = [1, 2]
b.extend([3, 4])
For append():
a = [1, 2, [3, 4]]
The complete list [3, 4] is added as one element.
For extend():
b = [1, 2, 3, 4]
The elements are added separately.
Trace:
student = 101, "Asha", 85
roll, name, marks = student
Python first packs the values into a tuple:
student = (101, "Asha", 85)
It then unpacks them:
roll = 101
name = "Asha"
marks = 85
Trace the dictionary:
student = {
"name": "Asha",
"marks": 80
}
student["marks"] = 90
student["city"] = "Jaipur"
print(student["name"])
print(student.get("age"))
The marks value changes from 80 to 90.
A new key named city is added.
Output:
Asha
None
get("age") returns None because the key does not exist.
Given:
A = {1, 2, 3}
B = {3, 4, 5}
Find:
A | BA & BA - BA ^ BUnion:
A | B = {1, 2, 3, 4, 5}
Intersection:
A & B = {3}
Difference:
A - B = {1, 2}
Symmetric difference:
A ^ B = {1, 2, 4, 5}
Complete the table:
| Feature | List | Tuple | Dictionary | Set |
|---|---|---|---|---|
| Mutable | ? | ? | ? | ? |
| Uses index | ? | ? | ? | ? |
| Allows duplicate elements | ? | ? | Keys? | ? |
| Main syntax | ? | ? | ? | ? |
| Feature | List | Tuple | Dictionary | Set |
|---|---|---|---|---|
| Mutable | Yes | No | Yes | Yes |
| Uses index | Yes | Yes | Uses keys | No |
| Allows duplicate elements | Yes | Yes | Keys: No | No |
| Main syntax | [ ] | ( ) | {key: value} | {value} |
if-elif-elsePredict the output:
marks = 68
if marks >= 75:
print("Distinction")
elif marks >= 60:
print("First")
elif marks >= 40:
print("Pass")
else:
print("Fail")
First condition:
68 >= 75 → False
Second condition:
68 >= 60 → True
Output:
First
After a true branch is found, the remaining branches are skipped.
for LoopPredict the output:
total = 0
for number in range(1, 5):
total += number
print(total)
range(1, 5) produces:
1, 2, 3, 4
Calculation:
total = 0 + 1 = 1
total = 1 + 2 = 3
total = 3 + 3 = 6
total = 6 + 4 = 10
Output:
10
while LoopPredict the output:
i = 1
while i <= 4:
print(i, end=" ")
i += 1
Iterations:
i = 1 → print 1
i = 2 → print 2
i = 3 → print 3
i = 4 → print 4
i = 5 → condition false
Output:
1 2 3 4
break and continuefor i in range(1, 6):
if i == 4:
break
print(i, end=" ")
Output:
1 2 3
break ends the loop when i becomes 4.
for i in range(1, 6):
if i == 3:
continue
print(i, end=" ")
Output:
1 2 4 5
continue skips only the iteration where i is 3.
Convert this normal function to a lambda:
def multiply(a, b):
return a * b
multiply = lambda a, b: a * b
Example:
print(multiply(4, 5))
Output:
20
Convert this loop into a list comprehension:
cubes = []
for x in range(1, 5):
cubes.append(x ** 3)
cubes = [x ** 3 for x in range(1, 5)]
Result:
[1, 8, 27, 64]
Predict the result:
values = [x * 2 for x in range(1, 6) if x % 2 != 0]
range(1, 6) produces:
1, 2, 3, 4, 5
Odd values are:
1, 3, 5
Multiply each by 2:
2, 6, 10
Result:
[2, 6, 10]
Identify the AI type.
A system only identifies spam emails.
Answer:
Narrow AI
A theoretical machine can learn and perform intellectual tasks across many areas at a human level.
Answer:
General AI
A hypothetical system exceeds human intelligence in almost every important intellectual area.
Answer:
Super AI
Memory rule:
Narrow = Now
General = Goal
Super = Speculation
Complete the statement:
The Turing Test evaluates whether a human judge can reliably distinguish between __________ and __________ through conversation.
A human participant and a machine
Important limitation:
Passing this behavioural test does not automatically prove consciousness, emotion or complete general intelligence.
Match the component with its purpose.
| Component | Purpose |
|---|---|
| Knowledge base | ? |
| Inference engine | ? |
| User interface | ? |
| Explanation facility | ? |
| Component | Purpose |
|---|---|
| Knowledge base | Stores facts and rules |
| Inference engine | Applies rules to facts |
| User interface | Communicates with the user |
| Explanation facility | Explains how a conclusion was reached |
Basic formula:
Expert system = Knowledge base + Inference engine
Starts with:
Known facts
Moves toward:
Conclusion
Flow:
Facts → Rules → Conclusion
Starts with:
Possible conclusion or goal
Checks:
Whether supporting facts and rules are true
Flow:
Goal → Required conditions → Facts
A model learns from images marked “cat” and “dog.”
Answer:
Supervised learning
Reason:
Correct labels are provided.
A model groups customers without predefined group names.
Answer:
Unsupervised learning
Reason:
No correct group labels are provided.
A robot learns movement by receiving rewards and penalties.
Answer:
Reinforcement learning
Reason:
An agent learns from environmental feedback.
Classify each task.
| Task | Answer |
|---|---|
| Predict whether an email is spam | Classification |
| Predict a house price | Regression |
| Predict pass or fail | Classification |
| Predict tomorrow’s temperature | Regression |
| Identify an image as cat, dog or bird | Classification |
| Predict monthly sales amount | Regression |
Memory rule:
Classification = Category
Regression = Number
| Algorithm | Correct Type or Task |
|---|---|
| Linear Regression | Supervised numeric prediction |
| Logistic Regression | Supervised classification |
| Decision Tree | Supervised learning |
| K-Means | Unsupervised clustering |
| Apriori | Association-rule mining |
| PCA | Dimensionality reduction |
| Q-Learning | Reinforcement learning |
Important exam trap:
Logistic Regression is mainly used for classification.
Complete the loop:
Environment gives a __________
│
v
Agent
│
│ chooses an __________
v
Environment returns a __________
Environment gives a state
│
v
Agent
│
│ chooses an action
v
Environment returns a reward and new state
The strategy used by the agent is called a policy.
A model performs very well on training data but poorly on new data.
Answer:
Overfitting
A model performs poorly on both training data and new data.
Answer:
Underfitting
A useful model should learn general patterns and perform well on unseen data.
Fill in the missing values:
Block 1:
Hash = H1
Block 2:
Previous hash = ______
Hash = H2
Block 3:
Previous hash = ______
Hash = H3
Block 2 previous hash = H1
Block 3 previous hash = H2
This linking creates the chain of blocks.
Suppose someone changes a transaction in Block 2.
This makes blockchain records tamper-evident.
Arrange these proof-of-work mining steps:
1. New transactions are collected.
2. Miner forms a candidate block.
3. Miner tries nonce values.
4. A valid proof is found.
5. Network verifies the proposed block.
6. The accepted block joins the chain.
Remember:
Not every blockchain uses mining.
Match the terms.
| Term | Meaning |
|---|---|
| Wallet | Manages cryptographic keys |
| Public address | Identifies a destination or account position |
| Private key | Secret used to authorize operations |
| Coin | Native asset of a blockchain |
| Token | Asset created using an existing blockchain platform |
Important rule:
Never reveal a private key.
Complete the flow:
User sends transaction
│
v
Smart contract checks __________
│
┌────┴────┐
False True
│ │
No action Execute programmed __________
Smart contract checks conditions.
If true:
Execute programmed action.
Example:
IF payment is received
THEN transfer digital ownership
Answer:
Public blockchain
Answer:
Private blockchain
Answer:
Consortium blockchain
Complete the sequence:
C# source
│
v
__________ compiler
│
v
__________ or CIL
│
v
CLR and __________ compiler
│
v
Native machine code
C# source
│
v
C# compiler
│
v
MSIL or CIL
│
v
CLR and JIT compiler
│
v
Native machine code
Which of these are CLR responsibilities?
All of them are CLR responsibilities.
CLR means:
Common Language Runtime
Complete:
CTS = __________________________
CLS = __________________________
CTS = Common Type System
CLS = Common Language Specification
Purpose:
CTS defines common .NET types.
CLS defines common language-compatibility rules.
Memory rule:
CTS = Types
CLS = Language rules
Complete:
MSIL = __________________________
CIL = __________________________
MSIL = Microsoft Intermediate Language
CIL = Common Intermediate Language
CIL is the standardized modern term. Many examination books use MSIL.
Complete the comparison:
| Java | .NET |
|---|---|
| Java bytecode | ? |
| JVM | ? |
| Java class libraries | ? |
| Java | .NET |
|---|---|
| Java bytecode | CIL/MSIL |
| JVM | CLR |
| Java class libraries | .NET class libraries |
These technologies have similar roles, but they are not identical.
Answer these aloud without reading the main notes.
print() do?input() return?type() do?int() and str()?-1 mean?None represent?dictionary[key] and dictionary.get(key)?append() and extend()?if?elif?else?for and while?range() appear in the sequence?break do?continue do?pass do?return do?Use your score from the 25 practice questions.
| Correct Answers | Level | Required Action |
|---|---|---|
| 23–25 | Excellent | Revise the Quick Revision Sheet tomorrow |
| 20–22 | Good | Review your incorrect answers |
| 16–19 | Developing | Repeat Python collections and ML types |
| 10–15 | Weak | Restudy all five main sections |
| 0–9 | Beginning | Read the document again slowly |
| Questions Missed | Topic to Revise |
|---|---|
| 1–10 | Python |
| 11–15 | Artificial Intelligence |
| 16–20 | Machine Learning |
| 21–23 | Blockchain |
| 24–25 | .NET |
Study:
Write from memory:
Mutable:
list, dictionary, set
Immutable:
integer, float, Boolean, string, tuple
Practice mentally:
x = 10
x = "Computer"
Explain why this is valid in Python.
Trace:
a = [1, 2]
b = a
b.append(3)
Explain why both a and b show the change.
Study:
if-elif-elseforwhilebreakcontinueReproduce this table:
| List | Tuple | Dictionary | Set |
|---|---|---|---|
| Mutable | Immutable | Mutable | Mutable |
| Indexed | Indexed | Key-based | Not indexed |
| Duplicates | Duplicates | Unique keys | Unique elements |
Practice:
range() examples.Study:
Memorize:
Narrow = Now
General = Goal
Super = Speculation
Draw:
Expert system
├── Knowledge base
├── Inference engine
├── User interface
└── Explanation facility
Practice:
Study:
Reproduce:
| Supervised | Unsupervised | Reinforcement |
|---|---|---|
| Labels | No labels | Rewards |
| Prediction | Patterns | Decisions |
| Decision Tree | K-Means | Q-Learning |
Practice identification:
Spam detection → Supervised classification
House price → Supervised regression
Customer groups → Unsupervised clustering
Robot learning → Reinforcement learning
Draw:
Block 1 → Block 2 → Block 3
Write inside each later block:
Previous block hash
Explain:
Draw:
Source
↓
Compiler
↓
CIL/MSIL
↓
CLR + JIT
↓
Native code
Memorize:
CLR = Runtime
CTS = Types
CLS = Language rules
CIL/MSIL = Intermediate code
JIT = Native-code conversion
Indentation defines blocks.
Python is dynamically typed.
Mutable:
list, dictionary, set
Immutable:
integer, float, Boolean, string, tuple
List:
ordered, indexed, mutable, duplicates
Tuple:
ordered, indexed, immutable, duplicates
Dictionary:
key-value, mutable, unique keys
Set:
unique values, mutable, not indexed
Lambda:
lambda arguments: expression
List comprehension:
[expression for item in iterable if condition]
Narrow AI:
Specific task; exists now
General AI:
Broad human-level intelligence; research goal
Super AI:
Beyond humans; hypothetical
Turing Test:
Alan Turing; conversational imitation
Expert system:
Knowledge base + Inference engine
Supervised:
Labelled data
Unsupervised:
Unlabelled data
Reinforcement:
Rewards and penalties
Classification:
Category
Regression:
Numeric value
Clustering:
Similar groups
K-Means:
Unsupervised
Q-Learning:
Reinforcement
Blockchain:
Distributed ledger of linked blocks
Hash:
Fixed-length digest
Mining:
Proof-of-work block process
Cryptocurrency:
Digital blockchain-based asset
Smart contract:
Blockchain-executed program
CLR:
Common Language Runtime
CTS:
Common Type System
CLS:
Common Language Specification
MSIL:
Microsoft Intermediate Language
CIL:
Common Intermediate Language
JIT:
Just-In-Time compiler
Flow:
Source → CIL/MSIL → CLR/JIT → Native code