exam-sub 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -25,6 +25,11 @@ const subjects = {
25
25
  mlf: {
26
26
  name: "MLF - Machine Learning Fundamentals",
27
27
  file: "mlf.txt"
28
+ },
29
+
30
+ rpa: {
31
+ name: "rpa - Robotic Process Automation",
32
+ file: "rpa.txt"
28
33
  }
29
34
  };
30
35
 
@@ -91,6 +96,10 @@ async function main() {
91
96
  {
92
97
  name: "MLF - Machine Learning Fundamentals",
93
98
  value: "mlf"
99
+ },
100
+ {
101
+ name: "rpa - Robotic Process Automation",
102
+ value: "rpa"
94
103
  }
95
104
  ]
96
105
  });
@@ -115,6 +124,7 @@ if (command) {
115
124
  console.log(" div");
116
125
  console.log(" bdh");
117
126
  console.log(" mlf");
127
+ console.log(" rpa");
118
128
  }
119
129
  } else {
120
130
  main();
package/data/aiop.txt CHANGED
@@ -1,7 +1,14 @@
1
+ ================================================================================
1
2
  Q1. Implement AI Problem-Solving Techniques using Python
2
- Aim: To implement a simple AI problem-solving technique using Breadth First Search (BFS).
3
- Python Program:
3
+ ================================================================================
4
+
5
+ AIM:
6
+ To implement a simple AI problem-solving technique using Breadth-First Search (BFS).
7
+
8
+ PYTHON PROGRAM:
9
+ --------------------------------------------------------------------------------
4
10
  from collections import deque
11
+
5
12
  graph = {
6
13
  'A': ['B', 'C'],
7
14
  'B': ['D', 'E'],
@@ -10,36 +17,55 @@ graph = {
10
17
  'E': ['F'],
11
18
  'F': []
12
19
  }
20
+
13
21
  def bfs(start, goal):
14
22
  queue = deque([[start]])
15
23
  visited = set()
24
+
16
25
  while queue:
17
26
  path = queue.popleft()
18
27
  node = path[-1]
28
+
19
29
  if node == goal:
20
30
  return path
31
+
21
32
  if node not in visited:
22
33
  visited.add(node)
23
34
  for neighbour in graph[node]:
24
35
  new_path = path + [neighbour]
25
36
  queue.append(new_path)
37
+
26
38
  print("Path:", bfs('A', 'F'))
27
- Example Output:
39
+ --------------------------------------------------------------------------------
40
+
41
+ EXAMPLE OUTPUT:
28
42
  Path: ['A', 'C', 'F']
29
- Explanation: - BFS searches level by level.
43
+
44
+ EXPLANATION:
45
+ - BFS searches level by level.
30
46
  - It starts from node A.
31
47
  - It checks neighbouring nodes.
32
48
  - It finds the path from A to F.
33
49
 
50
+
51
+ ================================================================================
34
52
  Q3. Develop a Context-Aware Rule-Based Chatbot using Python
35
- Aim: To create a chatbot that responds according to the context of the conversation.
36
- Python Program:
53
+ ================================================================================
54
+
55
+ AIM:
56
+ To create a chatbot that responds according to the context of the conversation.
57
+
58
+ PYTHON PROGRAM:
59
+ --------------------------------------------------------------------------------
37
60
  context = ""
61
+
38
62
  while True:
39
63
  user = input("You: ").lower()
64
+
40
65
  if user == "bye":
41
66
  print("Bot: Goodbye!")
42
67
  break
68
+
43
69
  if "hello" in user or "hi" in user:
44
70
  print("Bot: Hello! How can I help you?")
45
71
  elif "my name is" in user:
@@ -54,34 +80,49 @@ while True:
54
80
  print("Bot: Which course are you studying?")
55
81
  else:
56
82
  print("Bot: Please tell me more.")
57
- Example Output:
83
+ --------------------------------------------------------------------------------
84
+
85
+ EXAMPLE OUTPUT:
58
86
  You: hi
59
87
  Bot: Hello! How can I help you?
60
88
  You: my name is Sunny
61
89
  Bot: Nice to meet you, sunny
62
90
  You: what is my name
63
91
  Bot: Your name is sunny
64
- Explanation: The chatbot stores information in the context variable and uses it in later conversations.
65
92
 
66
- Q4. Implement an Intent-Based Chatbot using Rule Matching and Pattern
67
- Processing
68
- Aim: To identify the user's intent using simple keyword/pattern matching.
69
- Python Program:
93
+ EXPLANATION:
94
+ - The chatbot stores user information inside the `context` variable.
95
+ - It reuses this stored context in later stages of the conversation.
96
+
97
+
98
+ ================================================================================
99
+ Q4. Implement an Intent-Based Chatbot using Rule Matching & Pattern Processing
100
+ ================================================================================
101
+
102
+ AIM:
103
+ To identify the user's intent using simple keyword and pattern matching.
104
+
105
+ PYTHON PROGRAM:
106
+ --------------------------------------------------------------------------------
70
107
  import re
108
+
71
109
  patterns = {
72
110
  "greeting": r"\b(hi|hello|hey)\b",
73
111
  "courses": r"\b(course|courses|subjects)\b",
74
112
  "fees": r"\b(fees|fee|payment)\b",
75
113
  "bye": r"\b(bye|goodbye)\b"
76
114
  }
115
+
77
116
  def get_intent(message):
78
117
  for intent, pattern in patterns.items():
79
118
  if re.search(pattern, message.lower()):
80
119
  return intent
81
120
  return "unknown"
121
+
82
122
  while True:
83
123
  user = input("You: ")
84
124
  intent = get_intent(user)
125
+
85
126
  if intent == "greeting":
86
127
  print("Bot: Hello! How can I help you?")
87
128
  elif intent == "courses":
@@ -93,32 +134,45 @@ while True:
93
134
  break
94
135
  else:
95
136
  print("Bot: Sorry, I don't understand.")
96
- Example Output:
137
+ --------------------------------------------------------------------------------
138
+
139
+ EXAMPLE OUTPUT:
97
140
  You: Hello
98
141
  Bot: Hello! How can I help you?
99
142
  You: Tell me about courses
100
143
  Bot: We offer Computer Science and IT courses.
101
144
  You: What are the fees?
102
145
  Bot: Please contact the college office for fee details.
103
- Explanation: - Intent means what the user wants.
104
- - Regular expressions (re) identify patterns.
105
- - The chatbot gives a response according to the detected intent.
106
-
107
- Q5. Implement a Rule-Based Recommendation Chatbot using Forward
108
- Chaining
109
- Aim: To recommend a course using rules and forward chaining.
110
- Python Program:
146
+
147
+ EXPLANATION:
148
+ - Intent represents what the user wants to accomplish.
149
+ - Regular expressions (`re`) identify key string patterns in user input.
150
+ - The chatbot selects and displays a response based on the detected intent.
151
+
152
+
153
+ ================================================================================
154
+ Q5. Implement a Rule-Based Recommendation Chatbot using Forward Chaining
155
+ ================================================================================
156
+
157
+ AIM:
158
+ To recommend a course using conditional rules and forward chaining.
159
+
160
+ PYTHON PROGRAM:
161
+ --------------------------------------------------------------------------------
111
162
  facts = set()
163
+
112
164
  print("Answer with yes or no.")
113
165
  python = input("Do you like Python? ").lower()
114
166
  web = input("Do you like Web Development? ").lower()
115
167
  data = input("Do you like Data Analysis? ").lower()
168
+
116
169
  if python == "yes":
117
170
  facts.add("python")
118
171
  if web == "yes":
119
172
  facts.add("web")
120
173
  if data == "yes":
121
174
  facts.add("data")
175
+
122
176
  # Forward chaining rules
123
177
  if "python" in facts and "data" in facts:
124
178
  print("Recommendation: Machine Learning / Data Science")
@@ -130,19 +184,31 @@ elif "python" in facts:
130
184
  print("Recommendation: Python Programming")
131
185
  else:
132
186
  print("Recommendation: Explore basic computer courses.")
133
- Example Output:
187
+ --------------------------------------------------------------------------------
188
+
189
+ EXAMPLE OUTPUT:
134
190
  Do you like Python? yes
135
191
  Do you like Web Development? no
136
192
  Do you like Data Analysis? yes
137
193
  Recommendation: Machine Learning / Data Science
138
- Explanation: Forward chaining starts with known facts and applies rules to reach a conclusion.
139
- Python + Data Analysis → Machine Learning
140
194
 
195
+ EXPLANATION:
196
+ - Forward chaining begins with known facts collected from user choices.
197
+ - It evaluates rules against facts to deduce a recommendation (e.g., Python + Data Analysis → Machine Learning).
198
+
199
+
200
+ ================================================================================
141
201
  Q6. Develop an Intelligent Academic-Assistance Chatbot using Python
142
- Aim: To create a chatbot that helps students with common academic queries.
143
- Python Program:
202
+ ================================================================================
203
+
204
+ AIM:
205
+ To create a chatbot that assists students with common academic questions.
206
+
207
+ PYTHON PROGRAM:
208
+ --------------------------------------------------------------------------------
144
209
  while True:
145
210
  user = input("Student: ").lower()
211
+
146
212
  if "hello" in user or "hi" in user:
147
213
  print("Bot: Hello! How can I help you?")
148
214
  elif "exam" in user:
@@ -160,3 +226,16 @@ while True:
160
226
  break
161
227
  else:
162
228
  print("Bot: Sorry, I don't have information about that.")
229
+ --------------------------------------------------------------------------------
230
+
231
+ EXAMPLE OUTPUT:
232
+ Student: hi
233
+ Bot: Hello! How can I help you?
234
+ Student: how to prepare for exam
235
+ Bot: Prepare important topics and practice previous papers.
236
+ Student: bye
237
+ Bot: Good luck with your studies!
238
+
239
+ EXPLANATION:
240
+ - Uses string keyword searching to map student inquiries directly to advice.
241
+ - Handles multiple common topics including exams, assignments, attendance, and study schedules.
package/data/bdh.txt CHANGED
@@ -1,13 +1,20 @@
1
- University and Hospital database questions using TEXTFILE storage format.
2
- Question 9 – University Database
3
- -- ==========================================
4
- -- Q9: UNIVERSITY
5
- -- ==========================================
6
- -- Create Database
1
+ ================================================================================
2
+ PART 1: UNIVERSITY & HOSPITAL DATABASES (TEXTFILE STORAGE)
3
+ ================================================================================
4
+
5
+ --------------------------------------------------------------------------------
6
+ Question 9: University Database (TEXTFILE Storage Format)
7
+ --------------------------------------------------------------------------------
8
+
9
+ SQL / HIVE SCRIPT:
10
+
11
+ -- Step 1: Create Database
7
12
  CREATE DATABASE university_db;
8
- -- Select Database
13
+
14
+ -- Step 2: Select Database
9
15
  USE university_db;
10
- -- Create Table
16
+
17
+ -- Step 3: Create Table
11
18
  CREATE TABLE students (
12
19
  student_id INT,
13
20
  name STRING,
@@ -15,35 +22,46 @@ CREATE TABLE students (
15
22
  marks FLOAT
16
23
  )
17
24
  STORED AS TEXTFILE;
18
- -- Insert Sample Values
25
+
26
+ -- Step 4: Insert Sample Values
19
27
  INSERT INTO students VALUES
20
28
  (101, 'John', 'Computer Science', 85),
21
29
  (102, 'Alice', 'Mathematics', 72),
22
30
  (103, 'Bob', 'Physics', 45),
23
31
  (104, 'Charlie', 'Mathematics', 65);
24
- -- 1. Retrieve Computer Science students
32
+
33
+ -- Query 1: Retrieve Computer Science students
25
34
  SELECT *
26
35
  FROM students
27
36
  WHERE course = 'Computer Science';
28
- -- 2. Delete students whose marks are below 50
37
+
38
+ -- Query 2: Delete students whose marks are below 50
29
39
  DELETE FROM students
30
40
  WHERE marks < 50;
31
- -- 3. Add 10 bonus marks to Mathematics students
41
+
42
+ -- Query 3: Add 10 bonus marks to Mathematics students
32
43
  UPDATE students
33
44
  SET marks = marks + 10
34
45
  WHERE course = 'Mathematics';
35
- -- 4. Delete student whose student_id is 102
46
+
47
+ -- Query 4: Delete student whose student_id is 102
36
48
  DELETE FROM students
37
49
  WHERE student_id = 102;
38
- Question 11 – Hospital Database
39
- -- ==========================================
40
- -- Q11: HOSPITAL
41
- -- ==========================================
42
- -- Create Database
50
+
51
+
52
+ --------------------------------------------------------------------------------
53
+ Question 11: Hospital Database (TEXTFILE Storage Format)
54
+ --------------------------------------------------------------------------------
55
+
56
+ SQL / HIVE SCRIPT:
57
+
58
+ -- Step 1: Create Database
43
59
  CREATE DATABASE hospital_db;
44
- -- Select Database
60
+
61
+ -- Step 2: Select Database
45
62
  USE hospital_db;
46
- -- Create Table
63
+
64
+ -- Step 3: Create Table
47
65
  CREATE TABLE patients (
48
66
  patient_id INT,
49
67
  patient_name STRING,
@@ -51,40 +69,51 @@ CREATE TABLE patients (
51
69
  disease STRING
52
70
  )
53
71
  STORED AS TEXTFILE;
54
- -- Insert Sample Values
72
+
73
+ -- Step 4: Insert Sample Values
55
74
  INSERT INTO patients VALUES
56
75
  (1, 'Rahul', 45, 'Diabetes'),
57
76
  (2, 'Amit', 30, 'Hypertension'),
58
77
  (3, 'Priya', 16, 'Fever'),
59
78
  (4, 'Neha', 55, 'Diabetes'),
60
79
  (8, 'Raj', 40, 'Hypertension');
61
- -- 1. Retrieve patients with Diabetes
80
+
81
+ -- Query 1: Retrieve patients with Diabetes
62
82
  SELECT *
63
83
  FROM patients
64
84
  WHERE disease = 'Diabetes';
65
- -- 2. Delete patients whose age is below 18
85
+
86
+ -- Query 2: Delete patients whose age is below 18
66
87
  DELETE FROM patients
67
88
  WHERE age < 18;
68
- -- 3. Change Hypertension to Chronic Hypertension
89
+
90
+ -- Query 3: Change Hypertension to Chronic Hypertension
69
91
  UPDATE patients
70
92
  SET disease = 'Chronic Hypertension'
71
93
  WHERE disease = 'Hypertension';
72
- -- 4. Delete patient whose patient_id is 8
94
+
95
+ -- Query 4: Delete patient whose patient_id is 8
73
96
  DELETE FROM patients
74
97
  WHERE patient_id = 8;
75
98
 
76
99
 
77
- Complete Hive code for the University (Q9) and Hospital (Q11) database questions, including database creation,
78
- table creation, sample data, SELECT, DELETE and UPDATE operations.
79
- Question 9 – University Database
80
- -- ==========================================
81
- -- Q9: UNIVERSITY
82
- -- ==========================================
83
- -- Create Database
100
+ ================================================================================
101
+ PART 2: UNIVERSITY & HOSPITAL DATABASES (ORC TRANSACTIONAL STORAGE)
102
+ ================================================================================
103
+
104
+ --------------------------------------------------------------------------------
105
+ Question 9: University Database (ORC Transactional Format)
106
+ --------------------------------------------------------------------------------
107
+
108
+ SQL / HIVE SCRIPT:
109
+
110
+ -- Step 1: Create Database
84
111
  CREATE DATABASE university_db;
85
- -- Select Database
112
+
113
+ -- Step 2: Select Database
86
114
  USE university_db;
87
- -- Create Table
115
+
116
+ -- Step 3: Create Table
88
117
  CREATE TABLE students (
89
118
  student_id INT,
90
119
  name STRING,
@@ -93,35 +122,46 @@ CREATE TABLE students (
93
122
  )
94
123
  STORED AS ORC
95
124
  TBLPROPERTIES ('transactional'='true');
96
- -- Insert Sample Values
125
+
126
+ -- Step 4: Insert Sample Values
97
127
  INSERT INTO students VALUES
98
128
  (101, 'John', 'Computer Science', 85),
99
129
  (102, 'Alice', 'Mathematics', 72),
100
130
  (103, 'Bob', 'Physics', 45),
101
131
  (104, 'Charlie', 'Mathematics', 65);
102
- -- 1. Retrieve Computer Science students
132
+
133
+ -- Query 1: Retrieve Computer Science students
103
134
  SELECT *
104
135
  FROM students
105
136
  WHERE course = 'Computer Science';
106
- -- 2. Delete students whose marks are below 50
137
+
138
+ -- Query 2: Delete students whose marks are below 50
107
139
  DELETE FROM students
108
140
  WHERE marks < 50;
109
- -- 3. Add 10 bonus marks to Mathematics students
141
+
142
+ -- Query 3: Add 10 bonus marks to Mathematics students
110
143
  UPDATE students
111
144
  SET marks = marks + 10
112
145
  WHERE course = 'Mathematics';
113
- -- 4. Delete student whose student_id is 102
146
+
147
+ -- Query 4: Delete student whose student_id is 102
114
148
  DELETE FROM students
115
149
  WHERE student_id = 102;
116
- Question 11 – Hospital Database
117
- -- ==========================================
118
- -- Q11: HOSPITAL
119
- -- ==========================================
120
- -- Create Database
150
+
151
+
152
+ --------------------------------------------------------------------------------
153
+ Question 11: Hospital Database (ORC Transactional Format)
154
+ --------------------------------------------------------------------------------
155
+
156
+ SQL / HIVE SCRIPT:
157
+
158
+ -- Step 1: Create Database
121
159
  CREATE DATABASE hospital_db;
122
- -- Select Database
160
+
161
+ -- Step 2: Select Database
123
162
  USE hospital_db;
124
- -- Create Table
163
+
164
+ -- Step 3: Create Table
125
165
  CREATE TABLE patients (
126
166
  patient_id INT,
127
167
  patient_name STRING,
@@ -130,28 +170,38 @@ CREATE TABLE patients (
130
170
  )
131
171
  STORED AS ORC
132
172
  TBLPROPERTIES ('transactional'='true');
133
- -- Insert Sample Values
173
+
174
+ -- Step 4: Insert Sample Values
134
175
  INSERT INTO patients VALUES
135
176
  (1, 'Rahul', 45, 'Diabetes'),
136
177
  (2, 'Amit', 30, 'Hypertension'),
137
178
  (3, 'Priya', 16, 'Fever'),
138
179
  (4, 'Neha', 55, 'Diabetes'),
139
180
  (8, 'Raj', 40, 'Hypertension');
140
- -- 1. Retrieve patients with Diabetes
181
+
182
+ -- Query 1: Retrieve patients with Diabetes
141
183
  SELECT *
142
184
  FROM patients
143
185
  WHERE disease = 'Diabetes';
144
- -- 2. Delete patients whose age is below 18
186
+
187
+ -- Query 2: Delete patients whose age is below 18
145
188
  DELETE FROM patients
146
189
  WHERE age < 18;
147
- -- 3. Change Hypertension to Chronic Hypertension
190
+
191
+ -- Query 3: Change Hypertension to Chronic Hypertension
148
192
  UPDATE patients
149
193
  SET disease = 'Chronic Hypertension'
150
194
  WHERE disease = 'Hypertension';
151
- -- 4. Delete patient whose patient_id is 8
195
+
196
+ -- Query 4: Delete patient whose patient_id is 8
152
197
  DELETE FROM patients
153
198
  WHERE patient_id = 8;
154
- Note: These examples use ORC transactional tables so that Hive UPDATE and DELETE operations can be
155
- performed. If your college specifically requires TEXTFILE syntax, replace the storage clause as instructed by your
156
- lab/teacher.
157
-  
199
+
200
+
201
+ ================================================================================
202
+ NOTE ON STORAGE FORMATS:
203
+ ================================================================================
204
+ These ORC examples use transactional tables so that Apache Hive UPDATE and
205
+ DELETE operations execute natively. If your lab environment specifically
206
+ requires TEXTFILE syntax, swap the storage clause as instructed by your lab
207
+ instructor.