File size: 4,595 Bytes
7e8b8ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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)}")