Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions archetypes/final-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ questions:
# Multiple Choice Question (Single Answer)
- id: "q1"
text: "What keyword is used to define a function in Go?"
type: "mcq"
type: "single-answer"
marks: 2
explanation: "The 'func' keyword is used to declare functions in Go, similar to how 'function' is used in JavaScript."
options:
Expand All @@ -32,7 +32,7 @@ questions:
# Short Answer Question
- id: "q2"
text: "Go is a statically typed language. (true/false)"
type: "short_answer"
type: "short-answer"
marks: 2
correct_answer: "true"
case_sensitive: false
Expand All @@ -41,16 +41,15 @@ questions:
# Short Answer Question (Numeric)
- id: "q3"
text: "What is the zero value of an uninitialized int in Go?"
type: "short_answer"
type: "short-answer"
marks: 2
correct_answer: "0"
explanation: "In Go, the zero value for numeric types like int is 0."

# Multiple Choice Question (Multiple Answers)
- id: "q4"
text: "What are the purposes of the 'defer' keyword in Go? (Select all that apply)"
type: "mcq"
multiple_answers: true
type: "multiple-answers"
marks: 2
explanation: "The defer keyword is commonly used to delay function execution until the surrounding function returns, often used for cleanup tasks like closing files."
options:
Expand All @@ -66,4 +65,11 @@ questions:
- id: "d"
text: "To handle errors in a function"
is_correct: false

# True/False Question
- id: "q5"
text: "True or False: Go supports concurrency through goroutines."
type: "true-false"
answer: true
marks: 2
---
16 changes: 11 additions & 5 deletions archetypes/optional-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ questions:
# Multiple Choice Question (Single Answer)
- id: "q1"
text: "What keyword is used to define a function in Go?"
type: "mcq"
type: "single-answer"
marks: 2
explanation: "The 'func' keyword is used to declare functions in Go, similar to how 'function' is used in JavaScript."
options:
Expand All @@ -32,7 +32,7 @@ questions:
# Short Answer Question
- id: "q2"
text: "Go is a statically typed language. (true/false)"
type: "short_answer"
type: "short-answer"
marks: 2
correct_answer: "true"
case_sensitive: false
Expand All @@ -41,16 +41,15 @@ questions:
# Short Answer Question (Numeric)
- id: "q3"
text: "What is the zero value of an uninitialized int in Go?"
type: "short_answer"
type: "short-answer"
marks: 2
correct_answer: "0"
explanation: "In Go, the zero value for numeric types like int is 0."

# Multiple Choice Question (Multiple Answers)
- id: "q4"
text: "What are the purposes of the 'defer' keyword in Go? (Select all that apply)"
type: "mcq"
multiple_answers: true
type: "multiple-answers"
marks: 2
explanation: "The defer keyword is commonly used to delay function execution until the surrounding function returns, often used for cleanup tasks like closing files."
options:
Expand All @@ -66,4 +65,11 @@ questions:
- id: "d"
text: "To handle errors in a function"
is_correct: false

# True/False Question (Dedicated type)
- id: "q5"
text: "True or False: Go supports concurrency through goroutines."
type: "true-false"
answer: true
marks: 2
---
16 changes: 11 additions & 5 deletions archetypes/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ questions:
# Multiple Choice Question (Single Answer)
- id: "q1"
text: "What keyword is used to define a function in Go?"
type: "mcq"
type: "single-answer"
marks: 2
explanation: "The 'func' keyword is used to declare functions in Go, similar to how 'function' is used in JavaScript."
options:
Expand All @@ -32,7 +32,7 @@ questions:
# Short Answer Question
- id: "q2"
text: "Go is a statically typed language. (true/false)"
type: "short_answer"
type: "short-answer"
marks: 2
correct_answer: "true"
case_sensitive: false
Expand All @@ -41,16 +41,15 @@ questions:
# Short Answer Question (Numeric)
- id: "q3"
text: "What is the zero value of an uninitialized int in Go?"
type: "short_answer"
type: "short-answer"
marks: 2
correct_answer: "0"
explanation: "In Go, the zero value for numeric types like int is 0."

# Multiple Choice Question (Multiple Answers)
- id: "q4"
text: "What are the purposes of the 'defer' keyword in Go? (Select all that apply)"
type: "mcq"
multiple_answers: true
type: "multiple-answers"
marks: 2
explanation: "The defer keyword is commonly used to delay function execution until the surrounding function returns, often used for cleanup tasks like closing files."
options:
Expand All @@ -66,4 +65,11 @@ questions:
- id: "d"
text: "To handle errors in a function"
is_correct: false

# True/False Question
- id: "q5"
text: "True or False: Go supports concurrency through goroutines."
type: "true-false"
answer: true
marks: 2
---
16 changes: 16 additions & 0 deletions layouts/test/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ <h1>{{ $title }}</h1>
<div class="question-instructions">Select all that apply</div>
{{ else if eq $question.type "single-answer" }}
<div class="question-instructions">Select one answer</div>
{{ else if eq $question.type "true-false" }}
<div class="question-instructions">Select true or false</div>
{{ else if eq $question.type "short-answer" }}
<div class="question-instructions">Type your answer below</div>
{{ end }}
Expand All @@ -290,6 +292,20 @@ <h1>{{ $title }}</h1>
</div>
{{ end }}

{{ else if (eq $question.type "true-false") }}
<div class="option">
<label>
<input type="radio" name="answer_bool_{{ $question.id }}" value="true">
<span>True</span>
</label>
</div>
<div class="option">
<label>
<input type="radio" name="answer_bool_{{ $question.id }}" value="false">
<span>False</span>
</label>
</div>

{{ else if (eq $question.type "short-answer") }}
<input type="text" name="answer_text_{{ $question.id }}" class="text-input"
placeholder="Type your answer here">
Expand Down