Files
classroomio/src/lib/mocks/python/017_python_functions.ts
T
tunny17 91f28a345f CLASSROOMIO-T-197: Python Template Exercises
Co-authored-by: Tunji Adeyemi <tunji@digdippa.com>


Merge-request: CLASSROOMIO-MR-110
Merged-by: Best Admin <best@digdippa.com>
2023-10-20 02:06:58 +00:00

123 lines
3.9 KiB
TypeScript

import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Python Functions Quiz',
description: 'Test your knowledge of Python functions',
questionnaire: {
questions: [
{
title: 'What is the purpose of a function in Python?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'To define a variable', is_correct: false },
{ label: 'To execute code repeatedly', is_correct: false },
{ label: 'To group and reuse code', is_correct: true },
],
},
{
title: 'How do you define a function in Python?',
name: 'question2',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'function myFunction:', is_correct: false },
{ label: 'define myFunction:', is_correct: false },
{ label: 'def myFunction():', is_correct: true },
],
},
{
title: 'Which keyword is used to call a function in Python?',
name: 'question3',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'call', is_correct: false },
{ label: 'invoke', is_correct: false },
{ label: 'return', is_correct: true },
],
},
{
title: 'Explain the concept of function parameters in Python.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'What is a "default parameter" in a Python function?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'A parameter with a default value', is_correct: true },
{ label: 'A parameter that cannot be changed', is_correct: false },
{ label: 'A reserved keyword', is_correct: false },
],
},
{
title: 'How do you return a value from a function in Python?',
name: 'question6',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'use return statement', is_correct: true },
{ label: 'use print statement', is_correct: false },
{ label: 'use break statement', is_correct: false },
],
},
{
title: 'Explain the concept of "local variables" in Python functions.',
name: 'question7',
points: 2,
order: 6,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you make a Python function accept an arbitrary number of arguments?',
name: 'question8',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Use a for loop', is_correct: false },
{ label: 'Use the *args parameter', is_correct: true },
{ label: 'Use the $args parameter', is_correct: false },
],
},
{
title: 'What is a "lambda function" in Python?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'A function defined with the lambda keyword', is_correct: true },
{ label: 'A built-in Python function', is_correct: false },
{ label: 'A function with a long name', is_correct: false },
],
},
{
title: 'Explain the concept of "recursion" in Python functions.',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
],
},
};
export default template;