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5 |
+
import streamlit as st
|
| 6 |
+
import random
|
| 7 |
+
import time
|
| 8 |
+
# Sample questions for each category
|
| 9 |
+
questions = {
|
| 10 |
+
"Python Basics": [
|
| 11 |
+
{"question": "What is the output of print(type([]))?", "options": ["<class 'list'>", "<class 'dict'>", "<class 'tuple'>"], "answer": "<class 'list'>"},
|
| 12 |
+
{"question": "What keyword is used to define a function in Python?", "options": ["def", "function", "fun"], "answer": "def"},
|
| 13 |
+
{"question": "How do you create a list in Python?", "options": ["[]", "{}", "()"], "answer": "[]"},
|
| 14 |
+
{"question": "What method adds an element to the end of a list?", "options": ["append()", "add()", "insert()"], "answer": "append()"},
|
| 15 |
+
{"question": "What is the purpose of the self keyword in class methods?", "options": ["To refer to the instance", "To refer to the class", "To define a function"], "answer": "To refer to the instance"},
|
| 16 |
+
{"question": "How can you handle exceptions in Python?", "options": ["try/except", "catch", "throw"], "answer": "try/except"},
|
| 17 |
+
{"question": "What is the difference between == and is?", "options": ["Value vs Identity", "Type vs Value", "None"], "answer": "Value vs Identity"},
|
| 18 |
+
{"question": "How do you read a file in Python?", "options": ["open()", "read()", "file()"], "answer": "open()"},
|
| 19 |
+
{"question": "What does the len() function do?", "options": ["Returns the length", "Returns the type", "Returns the sum"], "answer": "Returns the length"},
|
| 20 |
+
{"question": "How can you convert a string to an integer?", "options": ["int()", "str()", "float()"], "answer": "int()"},
|
| 21 |
+
{"question": "What is a lambda function?", "options": ["Anonymous function", "A type of loop", "None"], "answer": "Anonymous function"},
|
| 22 |
+
{"question": "How do you create a dictionary in Python?", "options": ["{}", "[]", "()"], "answer": "{}"},
|
| 23 |
+
{"question": "What is list comprehension?", "options": ["Creating lists from existing lists", "Creating dictionaries", "None"], "answer": "Creating lists from existing lists"},
|
| 24 |
+
{"question": "What does the map() function do?", "options": ["Applies a function to all items", "Filters items", "None"], "answer": "Applies a function to all items"},
|
| 25 |
+
{"question": "How can you remove duplicates from a list?", "options": ["set()", "unique()", "distinct()"], "answer": "set()"},
|
| 26 |
+
{"question": "What is the purpose of the with statement?", "options": ["Resource management", "Looping", "Condition checking"], "answer": "Resource management"},
|
| 27 |
+
{"question": "How do you merge two dictionaries in Python?", "options": ["dict.update()", "dict.merge()", "dict.concat()"], "answer": "dict.update()"},
|
| 28 |
+
{"question": "What is the difference between a list and a tuple?", "options": ["Mutability", "Size", "Type"], "answer": "Mutability"},
|
| 29 |
+
{"question": "How do you iterate over a dictionary?", "options": ["for key in dict", "for dict in key", "for item in dict"], "answer": "for key in dict"},
|
| 30 |
+
{"question": "What is the purpose of the enumerate() function?", "options": ["To get index and value", "To filter lists", "None"], "answer": "To get index and value"},
|
| 31 |
+
{"question": "How can you reverse a list?", "options": ["list.reverse()", "list[::-1]", "None"], "answer": "list.reverse()"},
|
| 32 |
+
{"question": "What is a generator in Python?", "options": ["An iterable", "A function", "Both"], "answer": "Both"},
|
| 33 |
+
{"question": "How do you define a class in Python?", "options": ["class ClassName:", "def ClassName:", "create ClassName:"], "answer": "class ClassName:"},
|
| 34 |
+
{"question": "What is the output of print('Hello' * 3)?", "options": ["HelloHelloHello", "3Hello", "Hello 3"], "answer": "HelloHelloHello"},
|
| 35 |
+
{"question": "How do you check if a key exists in a dictionary?", "options": ["key in dict", "dict.has_key()", "None"], "answer": "key in dict"},
|
| 36 |
+
{"question": "What is the difference between deep copy and shallow copy?", "options": ["Copy level", "Type of data", "None"], "answer": "Copy level"},
|
| 37 |
+
{"question": "How do you sort a list in Python?", "options": ["list.sort()", "sorted(list)", "Both"], "answer": "Both"},
|
| 38 |
+
{"question": "What is the purpose of the __init__ method?", "options": ["Constructor", "Destructor", "None"], "answer": "Constructor"},
|
| 39 |
+
{"question": "How can you concatenate two strings?", "options": ["str1 + str2", "str1.concat(str2)", "None"], "answer": "str1 + str2"},
|
| 40 |
+
{"question": "What is the output of print(bool(''))?", "options": ["False", "True", "None"], "answer": "False"},
|
| 41 |
+
{"question": "What is the output of print(type({}))?", "options": ["<class 'dict'>", "<class 'list'>", "<class 'tuple'>"], "answer": "<class 'dict'>"},
|
| 42 |
+
{"question": "What is the output of print(type(()))?", "options": ["<class 'tuple'>", "<class 'list'>", "<class 'dict'>"], "answer": "<class 'tuple'>"},
|
| 43 |
+
{"question": "What is a decorator in Python?", "options": ["A function that wraps another function", "A type of class", "None"], "answer": "A function that wraps another function"},
|
| 44 |
+
{"question": "How do you create a virtual environment?", "options": ["python -m venv env", "venv create env", "env create"], "answer": "python -m venv env"},
|
| 45 |
+
{"question": "What is the purpose of the global keyword?", "options": ["To access global variables", "To create global variables", "None"], "answer": "To access global variables"},
|
| 46 |
+
{"question": "How can you iterate through a list with index?", "options": ["for i, value in enumerate(list)", "for i in range(len(list))", "None"], "answer": "for i, value in enumerate(list)"},
|
| 47 |
+
{"question": "What is the output of print('Hello'.upper())?", "options": ["HELLO", "Hello", "hello"], "answer": "HELLO"},
|
| 48 |
+
{"question": "How do you remove an item from a list by value?", "options": ["list.remove(value)", "list.pop(value)", "None"], "answer": "list.remove(value)"},
|
| 49 |
+
{"question": "What does the zip() function do?", "options": ["Combines lists", "Filters lists", "None"], "answer": "Combines lists"},
|
| 50 |
+
{"question": "What is the purpose of the assert statement?", "options": ["To check conditions", "To display output", "None"], "answer": "To check conditions"},
|
| 51 |
+
{"question": "How do you create a set in Python?", "options": ["set()", "{}", "Both"], "answer": "Both"},
|
| 52 |
+
{"question": "What is the difference between append() and extend()?", "options": ["Adding single vs multiple items", "Type of item added", "None"], "answer": "Adding single vs multiple items"},
|
| 53 |
+
{"question": "What is a docstring?", "options": ["Documentation string", "Error message", "None"], "answer": "Documentation string"},
|
| 54 |
+
{"question": "How do you sort a dictionary by value?", "options": ["sorted(dict.items())", "dict.sort()", "None"], "answer": "sorted(dict.items())"},
|
| 55 |
+
{"question": "What is the purpose of the pass statement?", "options": ["Placeholder for future code", "To exit a loop", "None"], "answer": "Placeholder for future code"},
|
| 56 |
+
{"question": "What is the use of the in keyword?", "options": ["To check membership", "To iterate", "None"], "answer": "To check membership"},
|
| 57 |
+
{"question": "What is the output of print(bool([]))?", "options": ["False", "True", "None"], "answer": "False"},
|
| 58 |
+
{"question": "How do you copy a list in Python?", "options": ["list.copy()", "list[:] or list.copy()", "None"], "answer": "list[:] or list.copy()"},
|
| 59 |
+
{"question": "What is the output of print(3 == 3.0)?", "options": ["True", "False", "None"], "answer": "True"},
|
| 60 |
+
],
|
| 61 |
+
"Data Science": [
|
| 62 |
+
{"question": "What is the purpose of data normalization?", "options": ["To scale data", "To clean data", "None"], "answer": "To scale data"},
|
| 63 |
+
{"question": "What does EDA stand for?", "options": ["Exploratory Data Analysis", "Effective Data Analytics", "None"], "answer": "Exploratory Data Analysis"},
|
| 64 |
+
{"question": "What library is commonly used for data manipulation in Python?", "options": ["NumPy", "Pandas", "Matplotlib"], "answer": "Pandas"},
|
| 65 |
+
{"question": "What is the difference between supervised and unsupervised learning?", "options": ["Labeled vs Unlabeled data", "Type of algorithms", "None"], "answer": "Labeled vs Unlabeled data"},
|
| 66 |
+
{"question": "What is a confusion matrix used for?", "options": ["Evaluating classification models", "Data visualization", "None"], "answer": "Evaluating classification models"},
|
| 67 |
+
{"question": "What is overfitting?", "options": ["Model learns noise", "Underfitting", "None"], "answer": "Model learns noise"},
|
| 68 |
+
{"question": "How can you handle missing values in a dataset?", "options": ["Drop, fill, or interpolate", "Ignore", "None"], "answer": "Drop, fill, or interpolate"},
|
| 69 |
+
{"question": "What does PCA stand for?", "options": ["Principal Component Analysis", "Partial Correlation Analysis", "None"], "answer": "Principal Component Analysis"},
|
| 70 |
+
{"question": "What is the purpose of feature scaling?", "options": ["To normalize data", "To reduce dimensionality", "None"], "answer": "To normalize data"},
|
| 71 |
+
{"question": "What is a scatter plot used for?", "options": ["Showing relationships", "Data distribution", "None"], "answer": "Showing relationships"},
|
| 72 |
+
{"question": "What is the difference between classification and regression?", "options": ["Categorical vs Continuous", "Type of output", "None"], "answer": "Categorical vs Continuous"},
|
| 73 |
+
{"question": "What library is used for data visualization in Python?", "options": ["Matplotlib", "Pandas", "NumPy"], "answer": "Matplotlib"},
|
| 74 |
+
{"question": "What does 'AI' stand for?", "options": ["Artificial Intelligence", "Automated Interface", "Applied Informatics"], "answer": "Artificial Intelligence"},
|
| 75 |
+
{"question": "What is a hypothesis test?", "options": ["Statistical test", "Data cleaning method", "None"], "answer": "Statistical test"},
|
| 76 |
+
{"question": "What is the purpose of cross-validation?", "options": ["Model evaluation", "Data cleaning", "None"], "answer": "Model evaluation"},
|
| 77 |
+
{"question": "What is a time series analysis?", "options": ["Analyzing data over time", "Data distribution", "None"], "answer": "Analyzing data over time"},
|
| 78 |
+
{"question": "What does the term 'bias' refer to in machine learning?", "options": ["Error due to assumptions", "Data imbalance", "Both"], "answer": "Both"},
|
| 79 |
+
{"question": "What is a decision tree?", "options": ["Model for classification", "Data visualization", "None"], "answer": "Model for classification"},
|
| 80 |
+
{"question": "What is the purpose of the K-means algorithm?", "options": ["Clustering", "Classification", "None"], "answer": "Clustering"},
|
| 81 |
+
{"question": "What is A/B testing?", "options": ["Comparing two versions", "Data cleaning", "None"], "answer": "Comparing two versions"},
|
| 82 |
+
{"question": "What does the term 'outlier' mean?", "options": ["An extreme value", "Average value", "None"], "answer": "An extreme value"},
|
| 83 |
+
{"question": "How can you determine the correlation between two variables?", "options": ["Using correlation coefficient", "Visual inspection", "None"], "answer": "Using correlation coefficient"},
|
| 84 |
+
{"question": "What is the significance of the ROC curve?", "options": ["Evaluating classifiers", "Data visualization", "None"], "answer": "Evaluating classifiers"},
|
| 85 |
+
{"question": "What is a categorical variable?", "options": ["Qualitative variable", "Quantitative variable", "None"], "answer": "Qualitative variable"},
|
| 86 |
+
{"question": "What is the role of a data engineer?", "options": ["Data pipeline construction", "Data analysis", "None"], "answer": "Data pipeline construction"},
|
| 87 |
+
{"question": "How do you evaluate a machine learning model?", "options": ["Using metrics", "Visual inspection", "None"], "answer": "Using metrics"},
|
| 88 |
+
{"question": "What is the purpose of feature engineering?", "options": ["Improving model performance", "Data cleaning", "None"], "answer": "Improving model performance"},
|
| 89 |
+
{"question": "What is a linear regression model?", "options": ["Predicts continuous values", "Classifies data", "None"], "answer": "Predicts continuous values"},
|
| 90 |
+
{"question": "What are the assumptions of linear regression?", "options": ["Linearity, independence", "Normality, homoscedasticity", "Both"], "answer": "Both"},
|
| 91 |
+
{"question": "What does the term 'ensemble learning' mean?", "options": ["Combining multiple models", "Single model", "None"], "answer": "Combining multiple models"},
|
| 92 |
+
{"question": "What is a random forest?", "options": ["Ensemble of decision trees", "Single decision tree", "None"], "answer": "Ensemble of decision trees"},
|
| 93 |
+
{"question": "What is the purpose of data visualization?", "options": ["To convey information", "To clean data", "None"], "answer": "To convey information"},
|
| 94 |
+
{"question": "What is the difference between classification and clustering?", "options": ["Labeled vs Unlabeled data", "Model type", "None"], "answer": "Labeled vs Unlabeled data"},
|
| 95 |
+
{"question": "What does an F1 score measure?", "options": ["Model accuracy", "Balance between precision and recall", "None"], "answer": "Balance between precision and recall"},
|
| 96 |
+
{"question": "What is feature selection?", "options": ["Choosing important features", "Data cleaning", "None"], "answer": "Choosing important features"},
|
| 97 |
+
{"question": "What is the purpose of clustering?", "options": ["Grouping similar items", "Data cleaning", "None"], "answer": "Grouping similar items"},
|
| 98 |
+
{"question": "What is k-fold cross-validation?", "options": ["Dividing data into k subsets", "Data cleaning", "None"], "answer": "Dividing data into k subsets"},
|
| 99 |
+
{"question": "What is the output of linear regression?", "options": ["A line", "A decision tree", "None"], "answer": "A line"},
|
| 100 |
+
],
|
| 101 |
+
|
| 102 |
+
"Generative AI": [
|
| 103 |
+
{"question": "What is the primary function of Generative AI models?", "options": ["To generate new data", "To classify data", "To clean data"], "answer": "To generate new data"},
|
| 104 |
+
{"question": "What does GAN stand for in the context of Generative AI?", "options": ["Generative Adversarial Network", "Generalized Automated Network", "None"], "answer": "Generative Adversarial Network"},
|
| 105 |
+
{"question": "What is the role of a generator and discriminator in GANs?", "options": ["Generator creates data, Discriminator evaluates it", "Generator evaluates data, Discriminator creates it", "None"], "answer": "Generator creates data, Discriminator evaluates it"},
|
| 106 |
+
{"question": "How does a Variational Autoencoder (VAE) differ from a GAN?", "options": ["VAE generates data probabilistically", "GAN uses a single model", "None"], "answer": "VAE generates data probabilistically"},
|
| 107 |
+
{"question": "What is the purpose of a Latent Space in a Generative model?", "options": ["To represent data in a compressed form", "To clean data", "None"], "answer": "To represent data in a compressed form"},
|
| 108 |
+
{"question": "How does a Transformer architecture contribute to Generative AI?", "options": ["By processing sequential data", "By generating images", "None"], "answer": "By processing sequential data"},
|
| 109 |
+
{"question": "What is a Markov Chain Monte Carlo (MCMC) used for in Generative AI?", "options": ["For generating synthetic data", "For data clustering", "None"], "answer": "For generating synthetic data"},
|
| 110 |
+
{"question": "How does a text-to-image Generative model work?", "options": ["By converting textual descriptions to visual content", "By using data augmentation", "None"], "answer": "By converting textual descriptions to visual content"},
|
| 111 |
+
{"question": "What are some real-world applications of Generative AI in creative industries?", "options": ["Art generation", "Music composition", "Both"], "answer": "Both"},
|
| 112 |
+
{"question": "What is the significance of the attention mechanism in Generative AI models?", "options": ["It helps the model focus on relevant parts of data", "It improves data cleaning", "None"], "answer": "It helps the model focus on relevant parts of data"},
|
| 113 |
+
{"question": "What are the ethical concerns associated with Generative AI?", "options": ["Deepfakes", "Copyright infringement", "Both"], "answer": "Both"},
|
| 114 |
+
{"question": "How can Generative AI be used in content creation (e.g., art, music, and writing)?", "options": ["By generating new works based on patterns", "By analyzing existing content", "None"], "answer": "By generating new works based on patterns"},
|
| 115 |
+
{"question": "What is the role of reinforcement learning in Generative AI models?", "options": ["It helps the model learn from feedback", "It improves data scaling", "None"], "answer": "It helps the model learn from feedback"},
|
| 116 |
+
{"question": "What are the challenges in training large-scale Generative AI models?", "options": ["Computational resources", "Model complexity", "Both"], "answer": "Both"},
|
| 117 |
+
{"question": "How does GPT (Generative Pretrained Transformer) function in text generation?", "options": ["By using pre-trained knowledge", "By using data from the web", "None"], "answer": "By using pre-trained knowledge"},
|
| 118 |
+
{"question": "What is the significance of unsupervised learning in the context of Generative AI?", "options": ["It allows for learning without labeled data", "It requires labeled data", "None"], "answer": "It allows for learning without labeled data"},
|
| 119 |
+
{"question": "What are some risks of deepfake generation in Generative AI?", "options": ["Misinformation", "Privacy invasion", "Both"], "answer": "Both"},
|
| 120 |
+
{"question": "How does a Diffusion Model in Generative AI generate images?", "options": ["By iteratively refining images", "By using neural networks", "None"], "answer": "By iteratively refining images"},
|
| 121 |
+
{"question": "What is the difference between a Generative model and a Discriminative model?", "options": ["Generative models generate data", "Discriminative models generate data", "None"], "answer": "Generative models generate data"},
|
| 122 |
+
{"question": "What are the key differences between GANs and VAEs in generating images?", "options": ["GANs use adversarial networks, VAEs use probabilistic modeling", "GANs and VAEs are identical", "None"], "answer": "GANs use adversarial networks, VAEs use probabilistic modeling"},
|
| 123 |
+
{"question": "How do generative models contribute to data augmentation in machine learning?", "options": ["By creating new synthetic data", "By labeling data", "None"], "answer": "By creating new synthetic data"},
|
| 124 |
+
{"question": "What are some limitations of Generative AI in text generation?", "options": ["Lack of Human Contextual Understanding", "Overfitting", "None"], "answer": "Lack of Human Contextual Understanding"},
|
| 125 |
+
{"question": "How can Generative AI be applied in drug discovery and biology?", "options": ["By predicting molecular structures", "By generating new drugs", "None"], "answer": "By predicting molecular structures"},
|
| 126 |
+
{"question": "What is the concept of \"sampling\" in the context of Generative AI?", "options": ["Selecting data points to generate new samples", "Cleaning data", "None"], "answer": "Selecting data points to generate new samples"},
|
| 127 |
+
{"question": "How does reinforcement learning improve the performance of generative models?", "options": ["By encouraging exploration", "By reducing data bias", "None"], "answer": "By encouraging exploration"},
|
| 128 |
+
{"question": "What are the applications of GANs in computer vision?", "options": ["Image generation", "Image enhancement", "Both"], "answer": "Both"},
|
| 129 |
+
{"question": "How do large pre-trained models like GPT-3 enable text generation?", "options": ["By leveraging vast amounts of data", "By using unsupervised learning", "None"], "answer": "By leveraging vast amounts of data"},
|
| 130 |
+
{"question": "What role do neural networks play in Generative AI?", "options": ["They model complex data relationships", "They clean data", "None"], "answer": "They model complex data relationships"},
|
| 131 |
+
{"question": "What are some challenges in ensuring diversity in generated outputs by Generative AI?", "options": ["Mode collapse", "Lack of Human Contextual Understanding", "Both"], "answer": "Both"},
|
| 132 |
+
{"question": "How does Conditional Generative AI work in generating targeted outputs?", "options": ["By conditioning on specific inputs", "By using unsupervised learning", "None"], "answer": "By conditioning on specific inputs"},
|
| 133 |
+
{"question": "What is the difference between a Generative AI model and a regular neural network?", "options": ["Generative AI models create data", "Both are the same", "None"], "answer": "Generative AI models create data"},
|
| 134 |
+
{"question": "What is the concept of “mode collapse” in GANs?", "options": ["Generator produces limited outputs", "Discriminator fails to identify fake data", "None"], "answer": "Generator produces limited outputs"},
|
| 135 |
+
{"question": "What are some tools used to evaluate the performance of a Generative AI model?", "options": ["Inception Score", "Fréchet Inception Distance", "Both"], "answer": "Both"},
|
| 136 |
+
{"question": "How can Generative AI assist in designing new architectures or solutions?", "options": ["By proposing new designs based on data patterns", "By cleaning data", "None"], "answer": "By proposing new designs based on data patterns"},
|
| 137 |
+
{"question": "How does text-to-speech generation work in Generative AI models?", "options": ["By converting text to audible speech", "By generating text-based content", "None"], "answer": "By converting text to audible speech"},
|
| 138 |
+
{"question": "What are the implications of Generative AI for intellectual property and copyright?", "options": ["Copyright ownership of generated content", "Unclear legal framework", "Both"], "answer": "Both"},
|
| 139 |
+
{"question": "How can Generative AI models be used to create synthetic data for training?", "options": ["By generating new data similar to real data", "By cleaning existing data", "None"], "answer": "By generating new data similar to real data"},
|
| 140 |
+
{"question": "What is the role of the \"latent vector\" in Generative AI models like GANs?", "options": ["It represents the compressed input data", "It generates random noise", "None"], "answer": "It represents the compressed input data"},
|
| 141 |
+
{"question": "What is the role of fine-tuning in generative models like GPT-3?", "options": ["It helps adapt the model to specific tasks", "It increases model size", "None"], "answer": "It helps adapt the model to specific tasks"},
|
| 142 |
+
{"question": "How does transfer learning enhance the capabilities of Generative AI models?", "options": ["By leveraging pre-trained knowledge", "By increasing model complexity", "None"], "answer": "By leveraging pre-trained knowledge"}
|
| 143 |
+
],
|
| 144 |
+
|
| 145 |
+
"Agentic AI": [
|
| 146 |
+
{"question": "What does the term “Agentic AI” refer to?", "options": ["AI with autonomous decision-making capabilities", "AI for data classification", "None"], "answer": "AI with autonomous decision-making capabilities"},
|
| 147 |
+
{"question": "How do autonomous agents interact with their environment in Agentic AI?", "options": ["By perceiving and acting based on feedback", "By collecting data", "None"], "answer": "By perceiving and acting based on feedback"},
|
| 148 |
+
{"question": "What is the key difference between reactive AI and Agentic AI?", "options": ["Agentic AI makes autonomous decisions", "Reactive AI makes autonomous decisions", "None"], "answer": "Agentic AI makes autonomous decisions"},
|
| 149 |
+
{"question": "How does decision-making occur in Agentic AI systems?", "options": ["Based on feedback and goal optimization", "By following pre-defined rules", "None"], "answer": "Based on feedback and goal optimization"},
|
| 150 |
+
{"question": "What is reinforcement learning, and how is it used in Agentic AI?", "options": ["A learning method based on rewards and penalties", "A supervised learning technique", "None"], "answer": "A learning method based on rewards and penalties"},
|
| 151 |
+
{"question": "How do Agentic AI systems handle multi-agent environments?", "options": ["By collaborating or competing with other agents", "By acting independently", "None"], "answer": "By collaborating or competing with other agents"},
|
| 152 |
+
{"question": "What is the concept of a reward signal in Agentic AI?", "options": ["A feedback used to guide decision-making", "A measure of performance", "None"], "answer": "A feedback used to guide decision-making"},
|
| 153 |
+
{"question": "What is the role of exploration and exploitation in Agentic AI?", "options": ["Exploration seeks new knowledge, Exploitation maximizes reward", "Both are the same", "None"], "answer": "Exploration seeks new knowledge, Exploitation maximizes reward"},
|
| 154 |
+
{"question": "How does the concept of bounded rationality apply to Agentic AI?", "options": ["AI agents make optimal decisions within limits", "AI agents always make the best decisions", "None"], "answer": "AI agents make optimal decisions within limits"},
|
| 155 |
+
{"question": "How do Agentic AI systems optimize their actions to achieve long-term goals?", "options": ["By evaluating actions over time", "By following fixed rules", "None"], "answer": "By evaluating actions over time"},
|
| 156 |
+
{"question": "What challenges do Agentic AI systems face when dealing with ambiguity or uncertainty?", "options": ["Limited information and unpredictable outcomes", "Too much data", "None"], "answer": "Limited information and unpredictable outcomes"},
|
| 157 |
+
{"question": "How do ethics and responsibility play a role in the design of Agentic AI?", "options": ["Ensuring AI decisions align with human values", "Reducing computational resources", "None"], "answer": "Ensuring AI decisions align with human values"},
|
| 158 |
+
{"question": "What is the difference between deliberative and reactive decision-making in Agentic AI?", "options": ["Deliberative involves planning, Reactive involves immediate responses", "Both are the same", "None"], "answer": "Deliberative involves planning, Reactive involves immediate responses"},
|
| 159 |
+
{"question": "What is the concept of “autonomy” in Agentic AI systems?", "options": ["Ability to make independent decisions", "Ability to collect data", "None"], "answer": "Ability to make independent decisions"},
|
| 160 |
+
{"question": "How does reward shaping affect the behavior of Agentic AI?", "options": ["It modifies the reward signal to guide behavior", "It removes negative rewards", "None"], "answer": "It modifies the reward signal to guide behavior"},
|
| 161 |
+
{"question": "What are some key examples of Agentic AI in real-world applications?", "options": ["Autonomous vehicles", "Chatbots", "Both"], "answer": "Both"},
|
| 162 |
+
{"question": "How can Agentic AI systems learn from past experiences to improve future decisions?", "options": ["Through reinforcement learning", "By observing human actions", "None"], "answer": "Through reinforcement learning"},
|
| 163 |
+
{"question": "What are some of the safety concerns with fully autonomous Agentic AI?", "options": ["Unintended actions", "Lack of Human Oversight", "Both"], "answer": "Both"},
|
| 164 |
+
{"question": "What techniques are used to prevent agent misbehavior in Agentic AI systems?", "options": ["Constraints, monitoring, and reward adjustments", "None", "Both"], "answer": "Constraints, monitoring, and reward adjustments"}
|
| 165 |
+
]
|
| 166 |
+
}
|
| 167 |
+
def main():
|
| 168 |
+
st.set_page_config(page_title="Smart Quiz Generator", page_icon="🧠", layout="centered")
|
| 169 |
+
|
| 170 |
+
st.markdown("""
|
| 171 |
+
<style>
|
| 172 |
+
/* Main Content Area Background */
|
| 173 |
+
.stApp {
|
| 174 |
+
background-image: url('https://images.rawpixel.com/image_800/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvcm0yODEtYWRqLTA1NC1qb2I1OTguanBn.jpg');
|
| 175 |
+
background-size: cover;
|
| 176 |
+
background-position: center;
|
| 177 |
+
background-attachment: fixed;
|
| 178 |
+
min-height: 100vh;
|
| 179 |
+
color: darkred;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/* Sidebar Background */
|
| 183 |
+
section[data-testid="stSidebar"] {
|
| 184 |
+
background-image: url('https://img.freepik.com/premium-photo/hand-drawn-abstract-background-design_481527-40048.jpg');
|
| 185 |
+
background-size: cover;
|
| 186 |
+
background-position: center;
|
| 187 |
+
}
|
| 188 |
+
</style>
|
| 189 |
+
""", unsafe_allow_html=True)
|
| 190 |
+
# Sidebar Profile Links
|
| 191 |
+
st.sidebar.markdown("## 🎉Author: Maria Nadeem🌟")
|
| 192 |
+
st.sidebar.markdown("## 🔗 Connect With Me")
|
| 193 |
+
st.sidebar.markdown("""
|
| 194 |
+
<div>
|
| 195 |
+
<a href="https://github.com/marianadeem755" target="_blank">
|
| 196 |
+
<img src="https://cdn-icons-png.flaticon.com/512/25/25231.png" width="30px"> GitHub
|
| 197 |
+
</a><br><br>
|
| 198 |
+
<a href="https://www.kaggle.com/marianadeem755" target="_blank">
|
| 199 |
+
<img src="https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/189_Kaggle_logo_logos-512.png" width="30px"> Kaggle
|
| 200 |
+
</a><br><br>
|
| 201 |
+
<a href="mailto:marianadeem755@gmail.com">
|
| 202 |
+
<img src="https://cdn-icons-png.flaticon.com/512/561/561127.png" width="30px"> Email
|
| 203 |
+
</a><br><br>
|
| 204 |
+
<a href="https://huggingface.co/maria355" target="_blank">
|
| 205 |
+
<img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" width="30px"> Hugging Face
|
| 206 |
+
</a>
|
| 207 |
+
</div>
|
| 208 |
+
""", unsafe_allow_html=True)
|
| 209 |
+
|
| 210 |
+
# Sidebar domain selection
|
| 211 |
+
st.sidebar.markdown("## 🎯 Choose a Focus Area")
|
| 212 |
+
selected_domain = st.sidebar.selectbox("Select your Expertise", list(questions.keys()))
|
| 213 |
+
|
| 214 |
+
st.title("🧠 Quiz Generator")
|
| 215 |
+
|
| 216 |
+
# Initialize session state
|
| 217 |
+
if 'quiz_started' not in st.session_state:
|
| 218 |
+
st.session_state.quiz_started = False
|
| 219 |
+
if 'current_question_index' not in st.session_state:
|
| 220 |
+
st.session_state.current_question_index = 0
|
| 221 |
+
if 'score' not in st.session_state:
|
| 222 |
+
st.session_state.score = 0
|
| 223 |
+
if 'selected_category' not in st.session_state:
|
| 224 |
+
st.session_state.selected_category = None
|
| 225 |
+
if 'answered' not in st.session_state:
|
| 226 |
+
st.session_state.answered = False
|
| 227 |
+
if 'user_answer' not in st.session_state:
|
| 228 |
+
st.session_state.user_answer = None
|
| 229 |
+
if 'quiz_questions' not in st.session_state:
|
| 230 |
+
st.session_state.quiz_questions = []
|
| 231 |
+
if 'start_time' not in st.session_state:
|
| 232 |
+
st.session_state.start_time = None
|
| 233 |
+
|
| 234 |
+
if not st.session_state.quiz_started:
|
| 235 |
+
st.subheader("Get ready to test your knowledge! 🎯")
|
| 236 |
+
if st.button("Start Quiz"):
|
| 237 |
+
st.session_state.quiz_started = True
|
| 238 |
+
st.session_state.selected_category = selected_domain
|
| 239 |
+
st.session_state.quiz_questions = random.sample(
|
| 240 |
+
questions[selected_domain],
|
| 241 |
+
min(30, len(questions[selected_domain]))
|
| 242 |
+
)
|
| 243 |
+
st.session_state.current_question_index = 0
|
| 244 |
+
st.session_state.score = 0
|
| 245 |
+
st.session_state.start_time = time.time()
|
| 246 |
+
st.rerun()
|
| 247 |
+
|
| 248 |
+
else:
|
| 249 |
+
# Display current question
|
| 250 |
+
if st.session_state.current_question_index < len(st.session_state.quiz_questions):
|
| 251 |
+
current_question = st.session_state.quiz_questions[st.session_state.current_question_index]
|
| 252 |
+
|
| 253 |
+
st.subheader(f"Question {st.session_state.current_question_index + 1}")
|
| 254 |
+
st.markdown(f"### {current_question['question']}")
|
| 255 |
+
|
| 256 |
+
elapsed_time = time.time() - st.session_state.start_time
|
| 257 |
+
remaining_time = max(60 - int(elapsed_time), 0)
|
| 258 |
+
|
| 259 |
+
# Timer display
|
| 260 |
+
progress = st.progress(0)
|
| 261 |
+
progress.progress((60 - remaining_time) / 60)
|
| 262 |
+
time_display = st.empty()
|
| 263 |
+
time_display.markdown(f"⏳ **Time left: {remaining_time} seconds**")
|
| 264 |
+
|
| 265 |
+
if not st.session_state.answered:
|
| 266 |
+
user_answer = st.radio(
|
| 267 |
+
"Select your answer:",
|
| 268 |
+
current_question['options'],
|
| 269 |
+
key=f"question_{st.session_state.current_question_index}"
|
| 270 |
+
)
|
| 271 |
+
|
| 272 |
+
submit = st.button("Submit Answer ✅")
|
| 273 |
+
|
| 274 |
+
if submit:
|
| 275 |
+
st.session_state.answered = True
|
| 276 |
+
st.session_state.user_answer = user_answer
|
| 277 |
+
|
| 278 |
+
if user_answer == current_question['answer']:
|
| 279 |
+
st.session_state.score += 1
|
| 280 |
+
st.success("✅ Correct Answer!")
|
| 281 |
+
else:
|
| 282 |
+
st.error(f"❌ Wrong Answer! Correct: **{current_question['answer']}**")
|
| 283 |
+
|
| 284 |
+
# If time's up and not answered yet
|
| 285 |
+
if remaining_time == 0 and not st.session_state.answered:
|
| 286 |
+
st.warning("⏰ Time's up!")
|
| 287 |
+
st.session_state.answered = True
|
| 288 |
+
st.session_state.user_answer = None
|
| 289 |
+
|
| 290 |
+
# Only show "Next" button AFTER answered OR timeout
|
| 291 |
+
if st.session_state.answered:
|
| 292 |
+
next_question = st.button("Next Question ➡️")
|
| 293 |
+
if next_question:
|
| 294 |
+
st.session_state.current_question_index += 1
|
| 295 |
+
st.session_state.answered = False
|
| 296 |
+
st.session_state.user_answer = None
|
| 297 |
+
st.session_state.start_time = time.time() # reset timer
|
| 298 |
+
st.rerun()
|
| 299 |
+
|
| 300 |
+
# Refresh page every second ONLY if not answered yet
|
| 301 |
+
if not st.session_state.answered and remaining_time > 0:
|
| 302 |
+
time.sleep(1)
|
| 303 |
+
st.experimental_rerun()
|
| 304 |
+
|
| 305 |
+
else:
|
| 306 |
+
# Quiz completed
|
| 307 |
+
st.success(f"🏁 Quiz completed! Your final score: {st.session_state.score}/{len(st.session_state.quiz_questions)}")
|
| 308 |
+
st.balloons()
|
| 309 |
+
|
| 310 |
+
if st.button("Restart Quiz 🔄"):
|
| 311 |
+
for key in list(st.session_state.keys()):
|
| 312 |
+
del st.session_state[key]
|
| 313 |
+
st.rerun()
|
| 314 |
+
|
| 315 |
+
if __name__ == "__main__":
|
| 316 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
requests
|