Skip to content

Commit 0f4c9f3

Browse files
Merge pull request hack2skill#13 from ANGELOANTU7/dev_3
test
2 parents 88202ff + 7f95b49 commit 0f4c9f3

File tree

3 files changed

+326
-0
lines changed

3 files changed

+326
-0
lines changed

Backend/modelpaper_test.py

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
import openai
2+
3+
prompt = "generate two new question paper by analysing the question papers given below"
4+
5+
data = """BTS-411(15)-11.16-1510 Reg. No. D
6+
7+
8+
9+
B. Tech. Degree III Semester Examination November 2016
10+
11+
CS 15-1302 LOGIC DESIGN
12+
(2015 Scheme)
13+
Time : 3 Hours Maximum Marks : 60
14+
15+
PART A
16+
(Answer ALL questions) (10 x 2 = 20)
17+
18+
I. (a) Convert (63.25) 10 to Hexa decimal and octal.
19+
(b) State De-Morgans theorem.
20+
(c) Express the Boolean function F = A+ B'C as a sum of minterms.
21+
(d) Differentiate between combinational and sequential circuits.
22+
(e) Design a 4 x 16 decoder constructed two 3 x 8 decoder.
23+
(f) Implement a full adder using ONE 3 input decoder and gates.
24+
(g) Write short notes on triggering of flip flops.
25+
(h) Write a short note on excitation tables.
26+
(i) Draw the PLA block diagram and explain its features.
27+
(j) Write the features of CMOS logic devices.
28+
PART B (4 x 10 = 40)
29+
II. Simplify the following Boolean function into (1) sum-of-products form
30+
and (ii) product-of-sums form F(A,B,C,D)-----E(0,1,2,5,8,9,10).
31+
OR
32+
III. Prove the theorems of Boolean algebra by using postulates.
33+
34+
IV. Explain the design procedure of combinational circuit with an example
35+
that converts the BCD to Excess-3 code.
36+
OR
37+
V. Implement the following function using a multiplexer
38+
F(A,B,C,D)--E(1, 3, 4,11,12,13,14,15)
39+
40+
VI Design a 4 bit ripple counter using J1( flip flop.
41+
OR
42+
VII. Design and explain a 4 bit asynchronous up-down binary counter.
43+
44+
VIII. Write short notes on (1) Fan in and Fan out (ii) Propogation delay
45+
(iii) Noise margin.
46+
OR
47+
IX. Compare TTL and CMOS logic families.
48+
49+
***
50+
BTS —11I(S)— 05.17 — 0720 Reg. No.
51+
A
52+
53+
54+
Tech. Degree III Semester Supplementary Examination
55+
May 2017
56+
57+
CS 154302 LOGIC DESIGN
58+
(2015 Scheme)
59+
e: 3 Hours Maximum Marks:60
60+
PART A
61+
(Answer ALL questions)
62+
(10 x 2 = 20)
63+
I. (a) Perform the following number conversions:
64+
(i) 567 in Octal to Hex
65+
(ii) 234.54 in decimal to binary.
66+
(b) Differentiate between canonical and standard forms of Boolean functions.
67+
(c) What are universal gates? Why are they called so?
68+
(d) What is carry look-ahead addition? What is the need?
69+
(e) Explain the design procedure of a combinational circuit.
70+
(f) Differentiate between synchronous and asynchronous circuits.
71+
(g) What is master slave flip flop?
72+
(h) Differentiate between PLA and PAL.
73+
(i) Write about ROM, PROM, EPROM and EEPROM.
74+
(j) Define the following terms: Fan out, Propagation delay and Noise margin.
75+
76+
PART B
77+
(4 x 10 = 40)
78+
II. Simplify the following function using Quine McCluskey method.
79+
F(A,B,C,D)=1(0,2,3,5,7,8,9,10,11,13,15).
80+
OR
81+
Simplify the following expression using the K-Map method and implement
82+
it using logic gates.
83+
(i) F = ACE + AlCD1E + A'C' DE.
84+
(ii) d = DE' + D E + AD 'E' .
85+
86+
IV. Derive the expressions for a 4-bit magnitude comparator and implement it
87+
using logic gates.
88+
OR
89+
V. (a) Design a decimal adder using 4-bit binary parallel adders.
90+
(b) Design an excess 3 to BCD code converter using a 4-bit binary parallel
91+
adder.
92+
93+
VI. Design a 4-bit Johnson counter. How does it differ from a ring counter?
94+
OR
95+
VII. Design a 4-bit binary ripple counter using JK flip flops.
96+
97+
VIII. Design a RAM consisting of four words of four bits each. Also show the
98+
logic diagram of a typical binary cell.
99+
OR
100+
1 Draw and explain the circuit for a TTL gate with Totem pole output driver.
101+
***
102+
BTS-III(S)-04.18-0784 Reg. No.
103+
104+
105+
B. Tech. Degree III Semester Supplementary Examination
106+
April 2018
107+
108+
CS 15 - 1302 LOGIC DESIGN
109+
(2015 Scheme)
110+
111+
Time: 3 Hours Maximum Marks: 60
112+
113+
PART A
114+
(Answer ALL questions)
115+
116+
(10 x 2 = 20)
117+
I. (a) Convert (AB2)16 to octal.
118+
(b) Evaluate (DA4C) 16 (648)16 using (r - 1)'s complement.
119+
(c) Find the complement of AB' + C' D' and reduce it to a minimum number of
120+
literals.
121+
(d) Differentiate between canonical and standard forms of Boolean functions.
122+
(e) Design a 4 x 16 decoder constructed two 3 x 8 decoder.
123+
(f) Write notes on triggering of flip flops.
124+
(g) Write a short note on state tables of a sequential circuit.
125+
(h) Draw the PLA block diagram and explain its features.
126+
(i) What is meant by Propagation delay?
127+
(j) Differentiate between RTL and DTL.
128+
129+
PART B
130+
(4 x 10 = 40)
131+
Simplify the following expression using the K-Map method and realize
132+
using NOR gates. F(w, x, y, z) m(1, 5, 6, 12 13, 14) + d(2, 4).
133+
Prove the theorems of Boolean algebra by using postulates.OR
134+
135+
IV. Simplify the following Boolean function into (i) sum-of-products form and
136+
(ii) product-of-sums form: F(A, B, C, D) = 1(0, 1, 2, 5, 8, 9, 10).
137+
V. Implement the following Boolean function with NAND gates: OR
138+
F(x, y, z) (1, 2, 3, 4, 5, 7).
139+
140+
VI. Implement the following function using a multiplexer (Use B as input).
141+
F(A, B, C, D) = 1(0,1, 3, 4, 8, 9,15).
142+
VII. Design a 4 bit binary ripple counter using JK flip flops. OR
143+
144+
VIII. Explain the operation of 2 input CMOS NOR gate and CMOS inverter in
145+
detail.
146+
OR
147+
IX. Explain with circuit diagram a typical 2 input TTL NAND gate.
148+
* *
149+
"""
150+
151+
152+
153+
def separate_question_papers(chunk):
154+
papers = chunk.split('\n\n')
155+
question_papers = []
156+
157+
for paper in papers:
158+
if paper.strip() != '':
159+
question_papers.append(paper.strip())
160+
161+
return question_papers
162+
163+
164+
165+
166+
# Set up OpenAI API credentials
167+
openai.api_key = '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'
168+
169+
# Function to generate a model question paper using ChatGPT
170+
response = openai.ChatCompletion.create(
171+
model="gpt-3.5-turbo",
172+
messages=[
173+
{
174+
"role": "user",
175+
"content": prompt + data
176+
}
177+
]
178+
)
179+
180+
important_topics = response.choices[0].message.content
181+
182+
183+
print(important_topics)

Backend/test_buck.py

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import boto3
2+
from botocore.exceptions import NoCredentialsError
3+
import chardet
4+
import openai
5+
6+
7+
s3_access_key = "AKIAZTHHIOR4JJ5HLTUB"
8+
s3_secret_access_key = "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"
9+
s3_bucket_name = "learnmateai"
10+
openai.api_key = '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'
11+
12+
mocknumber = 1
13+
14+
s3 = boto3.client("s3", aws_access_key_id=s3_access_key, aws_secret_access_key=s3_secret_access_key)
15+
16+
def detect_encoding(data):
17+
result = chardet.detect(data)
18+
return result['encoding']
19+
20+
prompt = "generate two new question paper by analysing the question papers given below"
21+
22+
23+
def read_text_files_from_s3(bucket_name, folder_path, last_file=None, batch_size=3):
24+
print("function called\n")
25+
response = s3.list_objects_v2(Bucket=bucket_name, Prefix=folder_path)
26+
text_files = []
27+
encoding = None
28+
if "Contents" in response:
29+
file_count = 0
30+
start_processing = False
31+
for obj in response["Contents"]:
32+
if obj["Key"].lower().endswith('.txt'):
33+
if last_file is None or start_processing:
34+
file_obj = s3.get_object(Bucket=bucket_name, Key=obj["Key"])
35+
file_content = file_obj['Body'].read()
36+
if encoding is None:
37+
encoding = detect_encoding(file_content)
38+
file_content = file_content.decode(encoding)
39+
text_files.append(file_content)
40+
file_count += 1
41+
if file_count >= batch_size:
42+
start_processing = False
43+
break
44+
elif obj["Key"] == last_file:
45+
start_processing = True
46+
47+
# Process any files found
48+
if text_files:
49+
process_batch(text_files, last_file)
50+
51+
# Determine the last file processed
52+
if file_count >= batch_size:
53+
last_file = obj["Key"]
54+
else:
55+
last_file = None
56+
57+
return last_file
58+
59+
def process_batch(text_files, last_file):
60+
data = ""
61+
batch_number = 1
62+
if last_file is not None:
63+
print(f"Batch starting after file: {last_file}")
64+
print(f"Batch {batch_number}:\n")
65+
for i, text_file in enumerate(text_files):
66+
print(f"Text file {i+1}")
67+
#print(text_file)
68+
data = data + text_file
69+
print()
70+
print(f"{batch_number} data \n-------------------------------------------\n ")
71+
global prompt
72+
response = openai.ChatCompletion.create(
73+
model="gpt-3.5-turbo",
74+
messages=[
75+
{
76+
"role": "user",
77+
"content": prompt + data
78+
}
79+
]
80+
)
81+
global mocknumber
82+
important_topics = response.choices[0].message.content
83+
print(important_topics)
84+
s3.put_object(
85+
Body=important_topics.encode(),
86+
Bucket=s3_bucket_name,
87+
Key=f'Mock_QuestionPapers/Mock{mocknumber}.txt'
88+
)
89+
batch_number += 1
90+
mocknumber += 1
91+
92+
93+
# Usage example
94+
bucket_name = s3_bucket_name
95+
folder_path = "pyqs_txt/"
96+
batch_size = 2
97+
98+
# Initial call
99+
last_file = read_text_files_from_s3(bucket_name, folder_path, batch_size=batch_size)
100+
101+
102+
103+
104+
105+
106+
107+
# Subsequent calls until all files are processed
108+
while last_file is not None:
109+
last_file = read_text_files_from_s3(bucket_name, folder_path, last_file, batch_size=batch_size)

prompt1.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
As an enthusiastic and knowledgeable instructor, you are preparing a set of questions for your imaginary students studying microprocessors, with a specific focus on the Intel 8085 microprocessor. Your objective is to categorize the questions based on their scores (3 marks and 5 marks) to assess different levels of understanding. Additionally, you want to identify important questions that are repeated within the provided set, create new questions from the reference set, and ensure a diverse range of questions that cover various aspects, concepts, and applications related to the Intel 8085 microprocessor.
3+
4+
Here is a reference set of questions related to the Intel 8085 microprocessor:
5+
6+
1. Explain the internal architecture of Intel 8085 microprocessor.
7+
2. Describe the block diagram of Intel 8085 microprocessor.
8+
3. What are the functional details of the pins in Intel 8085 microprocessor?
9+
4. How does external address/data bus multiplexing and demultiplexing work in Intel 8085 microprocessor?
10+
5. Discuss the internal bus organization of Intel 8085 microprocessor.
11+
6. What control signals are used in Intel 8085 microprocessor?0 I:
12+
1. What is the internal architecture of Intel 8085 microprocessor?
13+
2. Explain the block diagram of the Intel 8085 microprocessor.
14+
3. What are the registers used in Intel 8085 microprocessor?
15+
4. How is the internal bus organization of Intel 8085 microprocessor structured?
16+
5. What are the functional details of pins in Intel 8085 microprocessor?
17+
6. Explain the control signals used in Intel 8085 microprocessor.
18+
7. How is the external address/data bus multiplexing and demultiplexing done in Intel 8085 microprocessor?0 I:
19+
1. What is the internal architecture of the Intel 8085 microprocessor?
20+
2. What are the functional details of the pins of the Intel 8085 microprocessor?
21+
3. How does the external address/data bus multiplexing and demultiplexing work?
22+
4. What are the control signals of the Intel 8085 microprocessor?0 I:
23+
1. What is the internal architecture of Intel 8085 microprocessor?
24+
2. Explain the block diagram of Intel 8085 microprocessor.
25+
3. What are the registers used in the Intel 8085 microprocessor?
26+
4. How is the internal bus organized in the Intel 8085 microprocessor?
27+
5. Explain the functional details of pins in the Intel 8085 microprocessor.
28+
6. What are the control signals used in the Intel 8085 microprocessor?
29+
7. Explain the external address/data bus multiplexing and demultiplexing in the Intel 8085 microprocessor.0 I:
30+
1. What is the internal architecture of the Intel 8085 microprocessor?
31+
2. What are the components of the block diagram of the Intel 8085 microprocessor?
32+
3. What are the functional details of the pins of the Intel 8085 microprocessor?
33+
4. How is the external address/data bus multiplexed and demultiplexed in the Intel 8085 microprocessor?
34+
Your task is to categorize these questions based on their scores (3 marks and 5 marks) to assess different levels of understanding. Additionally, identify the important questions that are repeated within the provided set. Furthermore, create new questions based on the concepts covered in the reference set, ensuring a diverse range of questions that cover various aspects, concepts, and applications related to the Intel 8085 microprocessor. This will encourage students to showcase their depth of knowledge and critical thinking skills. Ensure each section contains at least 15 questions to comprehensively evaluate the students' grasp of the subject matter.

0 commit comments

Comments
 (0)