ozayezerceli's picture
Upload 10 files
7e8b8ca verified
raw
history blame
4.6 kB
import streamlit as st
import random
def coupling_quiz():
questions = [
{
"question": "What is coupling in software architecture?",
"options": [
"The degree of interdependence between software modules",
"The organization of code within a module",
"The number of classes in a project",
"The speed of code execution"
],
"correct": 0
},
{
"question": "Which of the following is a characteristic of loose coupling?",
"options": [
"High dependence between modules",
"Difficulty in maintaining the system",
"Modules can be easily replaced or upgraded",
"Increased complexity in the system"
],
"correct": 2
},
{
"question": "What is a common technique to achieve loose coupling?",
"options": [
"Using global variables",
"Implementing tight integration between modules",
"Dependency injection",
"Avoiding interfaces"
],
"correct": 2
}
]
score = 0
for q in questions:
st.write(q["question"])
user_answer = st.radio("Select your answer:", q["options"], key=q["question"])
if user_answer == q["options"][q["correct"]]:
score += 1
st.write(f"Your score: {score}/{len(questions)}")
def cohesion_quiz():
questions = [
{
"question": "What is cohesion in software architecture?",
"options": [
"The degree to which elements of a module belong together",
"The number of connections between different modules",
"The size of individual functions in a module",
"The speed of code execution within a module"
],
"correct": 0
},
{
"question": "Which type of cohesion is considered the strongest?",
"options": [
"Logical cohesion",
"Temporal cohesion",
"Functional cohesion",
"Coincidental cohesion"
],
"correct": 2
},
{
"question": "What characterizes a module with high cohesion?",
"options": [
"It performs a wide variety of unrelated tasks",
"It has a single, well-defined purpose",
"It depends heavily on other modules",
"It contains as many functions as possible"
],
"correct": 1
}
]
score = 0
for q in questions:
st.write(q["question"])
user_answer = st.radio("Select your answer:", q["options"], key=q["question"])
if user_answer == q["options"][q["correct"]]:
score += 1
st.write(f"Your score: {score}/{len(questions)}")
def monolithic_quiz():
questions = [
{
"question": "What is a key characteristic of monolithic architecture?",
"options": [
"Components are distributed across multiple servers",
"Each component has its own database",
"All components are part of a single, indivisible unit",
"Components communicate via APIs"
],
"correct": 2
},
{
"question": "Which of the following is an advantage of monolithic architecture?",
"options": [
"Easy to scale individual components",
"Simple to develop and deploy",
"Technology stack can be different for each component",
"Changes only affect a single component"
],
"correct": 1
},
{
"question": "What is a challenge when working with large monolithic applications?",
"options": [
"High network latency between components",
"Difficulty in understanding and modifying the codebase",
"Increased deployment time for small changes",
"All of the above"
],
"correct": 3
}
]
score = 0
for q in questions:
st.write(q["question"])
user_answer = st.radio("Select your answer:", q["options"], key=q["question"])
if user_answer == q["options"][q["correct"]]:
score += 1
st.write(f"Your score: {score}/{len(questions)}")