CLASSROOMIO-T-200: Exercise Template for NodeJs

Merge branch 'main' into CLASSROOMIO-T-200

CLASSROOMIO-T-200: Exercise Template for NodeJs


Co-authored-by: Tunji Adeyemi <[email protected]>


Merge-request: CLASSROOMIO-MR-95
Merged-by: Best Admin <[email protected]>
This commit is contained in:
tunny17
2023-10-10 06:09:39 +00:00
committed by Space Cloud
parent 1896da7ffe
commit 6ccef8f62b
22 changed files with 3932 additions and 2 deletions
+5 -2
View File
@@ -3,6 +3,7 @@ import { CSS_IDS, CSS_TEMPLATES } from './css';
import { calculateTotalPoints, shuffleOptions } from './utils';
import type { ExerciseTemplate } from '$lib/utils/types';
import { JS_IDS, JS_TEMPLATES } from './js';
import { NODE_IDS, NODE_TEMPLATES } from './node';
import { REACT_IDS, REACT_TEMPLATES } from './react';
import { TS_IDS, TS_TEMPLATES } from './typescript';
@@ -12,7 +13,8 @@ export const TAGS = {
JS: 'JS',
Typescript: 'Typescript',
ReactJS: 'ReactJS',
VueJS: 'VueJS'
VueJS: 'VueJS',
NodeJS: 'NodeJS'
};
function generateTemplateForTag(
@@ -47,5 +49,6 @@ export const TEMPLATES = {
[TAGS.JS]: generateTemplateForTag(JS_IDS, JS_TEMPLATES),
[TAGS.Typescript]: generateTemplateForTag(TS_IDS, TS_TEMPLATES),
[TAGS.ReactJS]: generateTemplateForTag(REACT_IDS, REACT_TEMPLATES),
[TAGS.VueJS]: []
[TAGS.VueJS]: [],
[TAGS.NodeJS]: generateTemplateForTag(NODE_IDS, NODE_TEMPLATES)
};
+128
View File
@@ -0,0 +1,128 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js Modules Quiz',
description: 'Test your knowledge of Node.js modules from W3Schools',
questionnaire: {
questions: [
{
title: 'What is a Node.js module?',
name: 'q1',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'A JavaScript file', is_correct: true },
{ label: 'A Node.js package', is_correct: false },
{ label: 'A built-in Node.js function', is_correct: false },
],
},
{
title: 'How do you include a module in Node.js?',
name: 'q2',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'require(\'module_name\')', is_correct: true },
{ label: 'import module_name from \'module\'', is_correct: false },
{ label: 'import \'module_name\'', is_correct: false },
],
},
{
title: 'Which of the following is a built-in Node.js module?',
name: 'q3',
points: 2,
order: 3,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'fs', is_correct: true },
{ label: 'http', is_correct: true },
{ label: 'express', is_correct: false },
{ label: 'path', is_correct: true },
],
},
{
title: 'How do you export a module in Node.js?',
name: 'q4',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'module.exports', is_correct: true },
{ label: 'export default', is_correct: false },
{ label: 'exports', is_correct: false },
],
},
{
title: 'What is the purpose of the "exports" object in a Node.js module?',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which of the following is a valid way to create a readable stream in Node.js?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'fs.createWriteStream()', is_correct: false },
{ label: 'fs.createReadStream()', is_correct: true },
{ label: 'fs.readFile()', is_correct: false },
],
},
{
title: 'What is the purpose of the "events" module in Node.js?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which method is used to handle HTTP POST requests in Node.js?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'HTTP POST requests are handled automatically', is_correct: false },
{ label: 'http.createServer()', is_correct: false },
{ label: 'req.on("data")', is_correct: false },
{ label: 'req.on("end")', is_correct: true },
],
},
{
title: 'In Node.js, what does the "path" module provide?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'File system operations', is_correct: true },
{ label: 'URL parsing', is_correct: true },
{ label: 'Event handling', is_correct: false },
],
},
{
title: 'How do you import a local module in Node.js?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'require(\'./module_name\')', is_correct: true },
{ label: 'import module_name from \'module_name\'', is_correct: false },
{ label: 'import \'./module_name\'', is_correct: false },
],
},
],
},
};
export default template;
+123
View File
@@ -0,0 +1,123 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js HTTP Quiz',
description: 'Test your knowledge of Node.js HTTP module from W3Schools',
questionnaire: {
questions: [
{
title: 'What is the primary use of the Node.js HTTP module?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Handling HTTP requests and responses', is_correct: true },
{ label: 'Creating file streams', is_correct: false },
{ label: 'Database operations', is_correct: false },
],
},
{
title: 'Which HTTP method is used to request data from a server?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'POST', is_correct: false },
{ label: 'GET', is_correct: true },
{ label: 'PUT', is_correct: false },
],
},
{
title: 'What does the HTTP response status code 404 indicate?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'OK', is_correct: false },
{ label: 'Not Found', is_correct: true },
{ label: 'Server Error', is_correct: false },
],
},
{
title: 'Which of the following is a valid HTTP request header?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'Content-Type', is_correct: true },
{ label: 'Authorization', is_correct: true },
{ label: 'User-Agent', is_correct: false },
{ label: 'Cache-Control', is_correct: true },
],
},
{
title: 'Explain the purpose of a query string in a URL.',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'What is the purpose of the "http" module in Node.js?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which method in the "http" module is used to create an HTTP server?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'http.createServer()', is_correct: true },
{ label: 'http.request()', is_correct: false },
{ label: 'http.listen()', is_correct: false },
],
},
{
title: 'What is the purpose of the "request" and "response" objects in an HTTP server callback?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which HTTP method is used to send data to the server for processing?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'POST', is_correct: true },
{ label: 'GET', is_correct: false },
{ label: 'PUT', is_correct: false },
],
},
{
title: 'What is the purpose of the "querystring" module in Node.js?',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'Parsing and formatting URL query strings', is_correct: true },
{ label: 'Handling HTTP headers', is_correct: false },
{ label: 'Creating HTML templates', is_correct: false },
],
},
],
},
};
export default template;
+124
View File
@@ -0,0 +1,124 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js File System Quiz',
description: 'Test your knowledge of Node.js File System module from W3Schools',
questionnaire: {
questions: [
{
title: 'What is the primary use of the Node.js File System module?',
name: 'q1',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Handling file operations', is_correct: true },
{ label: 'Database operations', is_correct: false },
{ label: 'Network communication', is_correct: false },
],
},
{
title: 'Which method is used to read the contents of a file in Node.js?',
name: 'q2',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'fs.read()', is_correct: false },
{ label: 'fs.readFile()', is_correct: true },
{ label: 'fs.write()', is_correct: false },
],
},
{
title: 'What is the purpose of the "fs.promises" API in Node.js File System?',
name: 'q3',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'Handling synchronous file operations', is_correct: false },
{ label: 'Handling asynchronous file operations with promises', is_correct: true },
{ label: 'Handling network requests', is_correct: false },
],
},
{
title: 'Which of the following is a valid way to create a new file using the File System module?',
name: 'q4',
points: 1,
order: 4,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'fs.createFile()', is_correct: true },
{ label: 'fs.writeFile()', is_correct: true },
{ label: 'fs.newFile()', is_correct: false },
{ label: 'fs.appendFile()', is_correct: false },
],
},
{
title: 'Explain the difference between synchronous and asynchronous file operations in Node.js.',
name: 'q5',
points: 2,
order: 5,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you check if a file exists using the File System module in Node.js?',
name: 'q6',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'fs.exists()', is_correct: false },
{ label: 'fs.access()', is_correct: true },
{ label: 'fs.checkFile()', is_correct: false },
],
},
{
title: 'Which method is used to delete a file in Node.js using the File System module?',
name: 'q7',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{ label: 'fs.remove()', is_correct: false },
{ label: 'fs.deleteFile()', is_correct: false },
{ label: 'fs.unlink()', is_correct: true },
],
},
{
title: 'What is the purpose of the "fs.createReadStream()" method in Node.js?',
name: 'q8',
points: 2,
order: 8,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which of the following is a valid use case for the File System module in Node.js?',
name: 'q9',
points: 2,
order: 9,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{ label: 'Reading and writing configuration files', is_correct: true },
{ label: 'Creating a web server', is_correct: false },
{ label: 'Sending emails', is_correct: false },
{ label: 'Database operations', is_correct: false },
],
},
{
title: 'Explain the difference between "fs.readFile()" and "fs.readFileSync()" in Node.js.',
name: 'q10',
points: 2,
order: 10,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
],
},
};
export default template;
+203
View File
@@ -0,0 +1,203 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js URL Handling Quiz',
description: 'Test your knowledge of Node.js URL handling.',
questionnaire: {
questions: [
{
title: 'What is the primary purpose of the "url" module in Node.js?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To parse and manipulate URLs.',
is_correct: true,
},
{
label: 'To make HTTP requests.',
is_correct: false,
},
{
label: 'To create dynamic web pages.',
is_correct: false,
},
],
},
{
title: 'Which method is used to parse a URL string in Node.js?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'parseURL()',
is_correct: false,
},
{
label: 'url.parse()',
is_correct: true,
},
{
label: 'decodeURI()',
is_correct: false,
},
],
},
{
title: 'What information can you extract from a parsed URL object in Node.js?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Host and port',
is_correct: true,
},
{
label: 'Query parameters',
is_correct: true,
},
{
label: 'HTTP request method',
is_correct: false,
},
],
},
{
title: 'Explain the difference between "pathname" and "path" in a URL object.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you create a URL object in Node.js?',
name: 'question5',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Using the "url.create()" method.',
is_correct: false,
},
{
label: 'By directly instantiating the URL class.',
is_correct: false,
},
{
label: 'Using the "url.parse()" method.',
is_correct: false,
},
{
label: 'By importing it from the "url" module.',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "querystring" module in Node.js URL handling?',
name: 'question6',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To parse and manipulate query strings in URLs.',
is_correct: true,
},
{
label: 'To create new URLs from scratch.',
is_correct: false,
},
{
label: 'To perform HTTP requests.',
is_correct: false,
},
],
},
{
title: 'How can you extract query parameters from a URL in Node.js using the "querystring" module?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Using the "parse()" method of the "querystring" module.',
is_correct: true,
},
{
label: 'Accessing the "query" property of the URL object.',
is_correct: false,
},
{
label: 'By splitting the URL string using a delimiter.',
is_correct: false,
},
],
},
{
title: 'What does the "format()" method of the URL object in Node.js do?',
name: 'question8',
points: 2,
order: 7,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'It serializes a URL object back to a URL string.',
is_correct: true,
},
{
label: 'It decodes a URL string.',
is_correct: false,
},
{
label: 'It parses a query string into an object.',
is_correct: false,
},
],
},
{
title: 'In Node.js, which module is commonly used for making HTTP requests?',
name: 'question9',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'fs',
is_correct: false,
},
{
label: 'http',
is_correct: true,
},
{
label: 'url',
is_correct: false,
},
],
},
{
title: 'How can you include the "http" module in your Node.js application?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
],
},
};
export default template;
+212
View File
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js NPM Quiz',
description: 'Test your knowledge of Node.js and NPM (Node Package Manager).',
questionnaire: {
questions: [
{
title: 'What is NPM?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Node Project Manager',
is_correct: false,
},
{
label: 'Node Package Manager',
is_correct: true,
},
{
label: 'Node Module Processor',
is_correct: false,
},
],
},
{
title: 'How do you initialize a new Node.js project with NPM?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'npm create-project',
is_correct: false,
},
{
label: 'npm init',
is_correct: true,
},
{
label: 'npm start-project',
is_correct: false,
},
],
},
{
title: 'What command is used to install a package locally using NPM?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'npm install',
is_correct: true,
},
{
label: 'npm add',
is_correct: false,
},
{
label: 'npm get',
is_correct: false,
},
],
},
{
title: 'Explain the purpose of the "package.json" file in a Node.js project.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How do you update a global NPM package to the latest version?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'npm update -g package-name',
is_correct: true,
},
{
label: 'npm upgrade package-name',
is_correct: false,
},
{
label: 'npm install -g package-name',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "npm start" command?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'It starts the development server.',
is_correct: true,
},
{
label: 'It installs all project dependencies.',
is_correct: false,
},
{
label: 'It updates NPM to the latest version.',
is_correct: false,
},
],
},
{
title: 'How do you remove a package from your Node.js project using NPM?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'npm remove package-name',
is_correct: true,
},
{
label: 'npm uninstall package-name',
is_correct: true,
},
{
label: 'npm delete package-name',
is_correct: false,
},
],
},
{
title: 'What is the purpose of "npm install --save"?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To install a package globally.',
is_correct: false,
},
{
label: 'To install a package and add it to the dependencies in package.json.',
is_correct: true,
},
{
label: 'To uninstall a package.',
is_correct: false,
},
],
},
{
title: 'How can you view a list of globally installed NPM packages?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'npm list -g',
is_correct: true,
},
{
label: 'npm global list',
is_correct: false,
},
{
label: 'npm show -g',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "npm audit" command?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To perform security audits on your project dependencies.',
is_correct: true,
},
{
label: 'To check the version of NPM installed globally.',
is_correct: false,
},
{
label: 'To start a new NPM project.',
is_correct: false,
},
],
},
],
},
};
export default template;
+212
View File
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js Events Quiz',
description: 'Test your knowledge of Node.js events and event handling.',
questionnaire: {
questions: [
{
title: 'What are events in Node.js?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Functions that are triggered when an HTTP request is received.',
is_correct: false,
},
{
label: 'Actions or occurrences that can be detected and responded to in Node.js.',
is_correct: true,
},
{
label: 'External JavaScript libraries for handling animations.',
is_correct: false,
},
],
},
{
title: 'How do you create a custom event emitter in Node.js?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By instantiating the "EventEmitter" class.',
is_correct: true,
},
{
label: 'By using the "event.create()" function.',
is_correct: false,
},
{
label: 'By defining a new function.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "on" method in the EventEmitter class?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To add a listener for a specific event.',
is_correct: true,
},
{
label: 'To emit an event.',
is_correct: false,
},
{
label: 'To remove a listener for an event.',
is_correct: false,
},
],
},
{
title: 'Explain the difference between "addListener" and "on" methods in the EventEmitter class.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you remove an event listener in Node.js?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Using the "removeListener" method.',
is_correct: true,
},
{
label: 'By setting the listener to "null".',
is_correct: false,
},
{
label: 'By calling the "off" method.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "once" method in the EventEmitter class?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To add a one-time listener for an event.',
is_correct: true,
},
{
label: 'To emit an event multiple times.',
is_correct: false,
},
{
label: 'To remove a listener for an event.',
is_correct: false,
},
],
},
{
title: 'How do you emit an event in Node.js?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Using the "event.emit()" method.',
is_correct: true,
},
{
label: 'By calling the event as a function.',
is_correct: false,
},
{
label: 'Using the "event.trigger()" method.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "removeAllListeners" method?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To remove all listeners for a specific event.',
is_correct: true,
},
{
label: 'To remove all listeners for all events.',
is_correct: true,
},
{
label: 'To add listeners for all events.',
is_correct: false,
},
],
},
{
title: 'How can you use the "EventEmitter" class to implement a custom event in your Node.js application?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By importing the "event" module.',
is_correct: false,
},
{
label: 'By extending the "EventEmitter" class.',
is_correct: true,
},
{
label: 'By using the "EventEmitter.create()" method.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "error" event in Node.js?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To handle errors that occur in asynchronous operations.',
is_correct: true,
},
{
label: 'To emit errors in the application.',
is_correct: false,
},
{
label: 'To trigger HTTP requests.',
is_correct: false,
},
],
},
],
},
};
export default template;
+212
View File
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js File Upload Quiz',
description: 'Test your knowledge of uploading files in Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of file uploading in Node.js applications?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To download files from the internet.',
is_correct: false,
},
{
label: 'To allow users to upload files to the server.',
is_correct: true,
},
{
label: 'To generate random files on the server.',
is_correct: false,
},
],
},
{
title: 'Which module in Node.js is commonly used for handling file uploads?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'fs',
is_correct: false,
},
{
label: 'http',
is_correct: false,
},
{
label: 'express',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "multer" middleware in Express.js?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To handle file uploads in a convenient way.',
is_correct: true,
},
{
label: 'To serve static files from a directory.',
is_correct: false,
},
{
label: 'To create and manipulate files on the server.',
is_correct: false,
},
],
},
{
title: 'Explain the difference between synchronous and asynchronous file uploads.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you restrict the types of files that users can upload in an Express.js application?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using the "fileType" option in Multer.',
is_correct: true,
},
{
label: 'By disabling file uploads altogether.',
is_correct: false,
},
{
label: 'By configuring the Express.js routes.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "single" method in Multer?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To handle multiple file uploads at once.',
is_correct: false,
},
{
label: 'To handle a single file upload.',
is_correct: true,
},
{
label: 'To handle text input fields.',
is_correct: false,
},
],
},
{
title: 'How do you access the uploaded file in your Express.js route handler?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'By using the "req.files" object provided by Multer.',
is_correct: true,
},
{
label: 'By using the "req.body" object.',
is_correct: false,
},
{
label: 'By sending a separate HTTP request to retrieve it.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "destination" option in Multer?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To specify the folder where uploaded files will be saved.',
is_correct: true,
},
{
label: 'To limit the maximum file size of uploads.',
is_correct: false,
},
{
label: 'To define custom validation rules for uploaded files.',
is_correct: false,
},
],
},
{
title: 'How can you handle errors during file uploads in an Express.js route?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using try-catch blocks.',
is_correct: false,
},
{
label: 'By passing an error-handling middleware to the route.',
is_correct: true,
},
{
label: 'By ignoring errors and continuing the upload process.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "file.fieldname" property in the uploaded file object?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To identify the original field name of the file input.',
is_correct: true,
},
{
label: 'To store the binary content of the uploaded file.',
is_correct: false,
},
{
label: 'To specify the destination folder for file storage.',
is_correct: false,
},
],
},
],
},
};
export default template;
+212
View File
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js Email Handling Quiz',
description: 'Test your knowledge of sending emails in Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of sending emails in Node.js applications?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To print messages on the server console.',
is_correct: false,
},
{
label: 'To send notifications and messages to users via email.',
is_correct: true,
},
{
label: 'To create HTML documents for the web.',
is_correct: false,
},
],
},
{
title: 'Which Node.js module is commonly used for sending emails?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'fs',
is_correct: false,
},
{
label: 'http',
is_correct: false,
},
{
label: 'nodemailer',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "nodemailer" module in Node.js?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To handle email sending and transport in Node.js.',
is_correct: true,
},
{
label: 'To create web servers in Node.js.',
is_correct: false,
},
{
label: 'To manage databases in Node.js applications.',
is_correct: false,
},
],
},
{
title: 'Explain the difference between SMTP and POP3 in email handling.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you configure nodemailer to send emails using a Gmail account?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By specifying the SMTP server and credentials.',
is_correct: true,
},
{
label: 'By using the default settings without any configuration.',
is_correct: false,
},
{
label: 'By installing additional plugins for nodemailer.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "transporter" object in nodemailer?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To receive incoming emails.',
is_correct: false,
},
{
label: 'To configure email transport options.',
is_correct: true,
},
{
label: 'To send HTTP requests.',
is_correct: false,
},
],
},
{
title: 'How do you send an email using nodemailer in Node.js?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'By calling the "sendmail" function.',
is_correct: true,
},
{
label: 'By using the "transporter.sendMail()" method.',
is_correct: true,
},
{
label: 'By making a POST request to an email API.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "attachments" option when sending emails with nodemailer?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To specify the recipient of the email.',
is_correct: false,
},
{
label: 'To include file attachments in the email.',
is_correct: true,
},
{
label: 'To set the email subject.',
is_correct: false,
},
],
},
{
title: 'How can you handle errors when sending emails with nodemailer?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using try-catch blocks.',
is_correct: false,
},
{
label: 'By providing a callback function to the "sendMail" method.',
is_correct: true,
},
{
label: 'By configuring nodemailer to automatically retry sending.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "from" field when sending emails with nodemailer?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To specify the recipient of the email.',
is_correct: false,
},
{
label: 'To set the email sender\'s address.',
is_correct: true,
},
{
label: 'To include file attachments in the email.',
is_correct: false,
},
],
},
],
},
};
export default template;
+212
View File
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL Database Creation Quiz',
description: 'Test your knowledge of creating MySQL databases in Node.js.',
questionnaire: {
questions: [
{
title: 'Why would you use a MySQL database in a Node.js application?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To store and manage data for the application.',
is_correct: true,
},
{
label: 'To display images on the website.',
is_correct: false,
},
{
label: 'To create interactive user interfaces.',
is_correct: false,
},
],
},
{
title: 'Which Node.js module is commonly used to interact with MySQL databases?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'fs',
is_correct: false,
},
{
label: 'http',
is_correct: false,
},
{
label: 'mysql',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "mysql.createConnection" method in the mysql module?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To establish a connection to a MySQL database server.',
is_correct: true,
},
{
label: 'To create a new database.',
is_correct: false,
},
{
label: 'To define a route in an Express.js application.',
is_correct: false,
},
],
},
{
title: 'Explain the purpose of the "query" method in the mysql module.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you handle errors when connecting to a MySQL database in Node.js?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using try-catch blocks.',
is_correct: false,
},
{
label: 'By providing a callback function to the connection method.',
is_correct: true,
},
{
label: 'By ignoring errors and proceeding with the connection.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "CREATE DATABASE" SQL statement?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To insert data into a database.',
is_correct: false,
},
{
label: 'To create a new MySQL database.',
is_correct: true,
},
{
label: 'To update existing records in a database.',
is_correct: false,
},
],
},
{
title: 'How can you execute SQL queries in Node.js using the mysql module?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'By calling the "execute" method.',
is_correct: false,
},
{
label: 'By using the "query" method.',
is_correct: true,
},
{
label: 'By sending HTTP requests to a database server.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "DROP DATABASE" SQL statement?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To retrieve data from a database.',
is_correct: false,
},
{
label: 'To delete an existing MySQL database.',
is_correct: true,
},
{
label: 'To modify the structure of a table.',
is_correct: false,
},
],
},
{
title: 'How can you prevent SQL injection when executing user-provided SQL queries in Node.js?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using input validation and sanitization.',
is_correct: true,
},
{
label: 'By disabling the execution of user-provided queries.',
is_correct: false,
},
{
label: 'By increasing the database security settings.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "pooling" mechanism in the mysql module?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To group multiple databases together.',
is_correct: false,
},
{
label: 'To efficiently manage and reuse database connections.',
is_correct: true,
},
{
label: 'To create backup copies of the database.',
is_correct: false,
},
],
},
],
},
};
export default template;
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL Table Creation Quiz',
description: 'Test your knowledge of creating MySQL tables in Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of creating tables in a MySQL database?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To store and organize data in a structured format.',
is_correct: true,
},
{
label: 'To display images on the website.',
is_correct: false,
},
{
label: 'To create HTML documents for the web.',
is_correct: false,
},
],
},
{
title: 'Which SQL statement is used to create a new table in a MySQL database?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'INSERT TABLE',
is_correct: false,
},
{
label: 'CREATE TABLE',
is_correct: true,
},
{
label: 'ADD TABLE',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "AUTO_INCREMENT" attribute in a MySQL table?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To automatically insert data into the table.',
is_correct: false,
},
{
label: 'To generate unique values for a column when inserting data.',
is_correct: true,
},
{
label: 'To sort data in the table in ascending order.',
is_correct: false,
},
],
},
{
title: 'Explain the purpose of primary keys in MySQL tables.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'What is the purpose of the "FOREIGN KEY" constraint in MySQL tables?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To restrict access to the table.',
is_correct: false,
},
{
label: 'To enforce referential integrity between tables.',
is_correct: true,
},
{
label: 'To define the primary key of the table.',
is_correct: false,
},
],
},
{
title: 'How do you add a new column to an existing MySQL table?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using the "ALTER TABLE" statement.',
is_correct: true,
},
{
label: 'By creating a new table and copying the data.',
is_correct: false,
},
{
label: 'By deleting and recreating the table.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "UNIQUE" constraint in MySQL columns?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To ensure that the column contains only unique values.',
is_correct: true,
},
{
label: 'To set the default value for the column.',
is_correct: false,
},
{
label: 'To specify the data type of the column.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "DROP TABLE" statement in MySQL?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To create a new table.',
is_correct: false,
},
{
label: 'To delete an existing table and its data.',
is_correct: true,
},
{
label: 'To modify the structure of an existing table.',
is_correct: false,
},
],
},
{
title: 'How can you add a foreign key constraint to a MySQL table column?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using the "ADD FOREIGN KEY" statement.',
is_correct: false,
},
{
label: 'By specifying the foreign key constraint when creating the table.',
is_correct: true,
},
{
label: 'By renaming the column to match the primary key of another table.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of indexing columns in MySQL tables?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To add graphical icons to the table.',
is_correct: false,
},
{
label: 'To improve query performance by speeding up data retrieval.',
is_correct: true,
},
{
label: 'To create a backup of the table.',
is_correct: false,
},
],
},
],
},
};
export default template;
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL Data Insertion Quiz',
description: 'Test your knowledge of inserting data into MySQL databases in Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of inserting data into a MySQL database in a Node.js application?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To display images on the website.',
is_correct: false,
},
{
label: 'To store and manage data in the database.',
is_correct: true,
},
{
label: 'To create interactive user interfaces.',
is_correct: false,
},
],
},
{
title: 'Which SQL statement is used to insert data into a MySQL table?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'UPDATE',
is_correct: false,
},
{
label: 'INSERT',
is_correct: true,
},
{
label: 'DELETE',
is_correct: false,
},
],
},
{
title: 'What is the purpose of prepared statements when inserting data into a MySQL database?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To improve code readability.',
is_correct: false,
},
{
label: 'To prevent SQL injection attacks.',
is_correct: true,
},
{
label: 'To define the table structure.',
is_correct: false,
},
],
},
{
title: 'Explain the difference between synchronous and asynchronous data insertion in Node.js.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you handle errors when inserting data into a MySQL database in Node.js?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using try-catch blocks.',
is_correct: false,
},
{
label: 'By providing a callback function to the insertion method.',
is_correct: true,
},
{
label: 'By ignoring errors and proceeding with the insertion.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "INSERT INTO" SQL statement?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To update existing records in a table.',
is_correct: false,
},
{
label: 'To insert new rows of data into a table.',
is_correct: true,
},
{
label: 'To delete data from a table.',
is_correct: false,
},
],
},
{
title: 'How do you insert data into a MySQL database in Node.js using prepared statements?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'By using the "VALUES" clause in the SQL statement.',
is_correct: true,
},
{
label: 'By directly concatenating user input into the SQL query.',
is_correct: false,
},
{
label: 'By passing placeholders and values as an array to the prepared statement.',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "LAST_INSERT_ID()" function in MySQL?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To retrieve the ID of the last inserted row in a table.',
is_correct: true,
},
{
label: 'To delete the last inserted row in a table.',
is_correct: false,
},
{
label: 'To update the last inserted row in a table.',
is_correct: false,
},
],
},
{
title: 'How can you insert multiple rows of data into a MySQL table in a single query?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By executing multiple "INSERT INTO" statements.',
is_correct: false,
},
{
label: 'By using a single "INSERT INTO" statement with multiple value sets.',
is_correct: true,
},
{
label: 'By creating multiple prepared statements.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "ON DUPLICATE KEY UPDATE" clause in an "INSERT INTO" statement?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To create a new table if the data already exists.',
is_correct: false,
},
{
label: 'To update existing rows if there is a duplicate key.',
is_correct: true,
},
{
label: 'To prevent inserting duplicate data into the table.',
is_correct: false,
},
],
},
],
},
};
export default template;
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL Data Selection Quiz',
description: 'Test your knowledge of selecting data from MySQL databases in Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of selecting data from a MySQL database in a Node.js application?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To update existing records in the database.',
is_correct: false,
},
{
label: 'To retrieve and display data from the database.',
is_correct: true,
},
{
label: 'To create new tables in the database.',
is_correct: false,
},
],
},
{
title: 'Which SQL statement is used to select data from a MySQL table?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'INSERT',
is_correct: false,
},
{
label: 'SELECT',
is_correct: true,
},
{
label: 'DELETE',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "WHERE" clause in a SQL SELECT statement?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To specify which columns to select from the table.',
is_correct: false,
},
{
label: 'To filter rows based on a specified condition.',
is_correct: true,
},
{
label: 'To order the selected rows in ascending order.',
is_correct: false,
},
],
},
{
title: 'Explain the purpose of the "LIMIT" clause in a SQL SELECT statement.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you perform a join operation between two MySQL tables in Node.js?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using the "JOIN" clause in the SQL SELECT statement.',
is_correct: true,
},
{
label: 'By creating a new table that combines the data from both tables.',
is_correct: false,
},
{
label: 'By using the "DELETE" statement to merge data.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "GROUP BY" clause in a SQL SELECT statement?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To select all columns in the table.',
is_correct: false,
},
{
label: 'To group rows with the same values in specified columns.',
is_correct: true,
},
{
label: 'To order rows in descending order.',
is_correct: false,
},
],
},
{
title: 'How do you handle asynchronous data retrieval when selecting data from a MySQL database in Node.js?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'By using synchronous functions.',
is_correct: false,
},
{
label: 'By using callbacks or promises.',
is_correct: true,
},
{
label: 'By executing SQL statements in a loop.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "ORDER BY" clause in a SQL SELECT statement?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To filter rows based on a specified condition.',
is_correct: false,
},
{
label: 'To order the selected rows based on one or more columns.',
is_correct: true,
},
{
label: 'To limit the number of rows returned by the query.',
is_correct: false,
},
],
},
{
title: 'How can you select distinct values from a column in a SQL SELECT statement?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using the "DISTINCT" keyword.',
is_correct: true,
},
{
label: 'By using the "WHERE" clause.',
is_correct: false,
},
{
label: 'By using the "LIMIT" clause.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "HAVING" clause in a SQL SELECT statement?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To specify the columns to select from the table.',
is_correct: false,
},
{
label: 'To filter groups of rows based on a condition.',
is_correct: true,
},
{
label: 'To order rows in ascending order.',
is_correct: false,
},
],
},
],
},
};
export default template;
+212
View File
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL WHERE Clause Quiz',
description: 'Test your knowledge of using the "WHERE" clause in MySQL with Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of the "WHERE" clause in a SQL statement?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To order the selected rows in ascending order.',
is_correct: false,
},
{
label: 'To filter rows based on a specified condition.',
is_correct: true,
},
{
label: 'To group rows with the same values in specified columns.',
is_correct: false,
},
],
},
{
title: 'Which SQL statement is used to filter rows in a SQL SELECT statement?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'UPDATE',
is_correct: false,
},
{
label: 'FILTER',
is_correct: false,
},
{
label: 'WHERE',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "AND" operator in a WHERE clause?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To combine multiple conditions, all of which must be true.',
is_correct: true,
},
{
label: 'To exclude rows that meet any of the specified conditions.',
is_correct: false,
},
{
label: 'To order the selected rows.',
is_correct: false,
},
],
},
{
title: 'Explain the difference between the "AND" and "OR" operators in a WHERE clause.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you filter rows based on a range of values in a WHERE clause?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'By using the "BETWEEN" operator.',
is_correct: true,
},
{
label: 'By using the "LIKE" operator.',
is_correct: false,
},
{
label: 'By using the "IN" operator.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "LIKE" operator in a WHERE clause?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To filter rows based on a range of values.',
is_correct: false,
},
{
label: 'To filter rows based on a partial match of a value.',
is_correct: true,
},
{
label: 'To filter rows based on an exact match of a value.',
is_correct: false,
},
],
},
{
title: 'How can you combine multiple conditions with different logical operators in a WHERE clause?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'By using parentheses to group conditions.',
is_correct: true,
},
{
label: 'By separating conditions with commas.',
is_correct: false,
},
{
label: 'By using the "AND" operator only.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "NOT" operator in a WHERE clause?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To negate the meaning of a condition.',
is_correct: true,
},
{
label: 'To filter rows that meet any of the specified conditions.',
is_correct: false,
},
{
label: 'To order the selected rows in descending order.',
is_correct: false,
},
],
},
{
title: 'How can you use the "IS NULL" condition in a WHERE clause?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To filter rows that have a non-null value.',
is_correct: false,
},
{
label: 'To filter rows that have a null value.',
is_correct: true,
},
{
label: 'To filter rows that have a specific value.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of using the "ORDER BY" clause in a SQL SELECT statement?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To filter rows based on a specified condition.',
is_correct: false,
},
{
label: 'To order the selected rows based on one or more columns.',
is_correct: true,
},
{
label: 'To limit the number of rows returned by the query.',
is_correct: false,
},
],
},
],
},
};
export default template;
+212
View File
@@ -0,0 +1,212 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL ORDER BY Clause Quiz',
description: 'Test your knowledge of using the "ORDER BY" clause in MySQL with Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of the "ORDER BY" clause in a SQL SELECT statement?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To filter rows based on a specified condition.',
is_correct: false,
},
{
label: 'To order the selected rows based on one or more columns.',
is_correct: true,
},
{
label: 'To limit the number of rows returned by the query.',
is_correct: false,
},
],
},
{
title: 'Which SQL keyword is used to specify the sorting order in the "ORDER BY" clause?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'ASC',
is_correct: true,
},
{
label: 'DESC',
is_correct: true,
},
{
label: 'ORDER',
is_correct: false,
},
],
},
{
title: 'What does "ASC" stand for in the context of sorting in SQL?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Ascending Sort Condition',
is_correct: false,
},
{
label: 'Alphabetical Sorting Condition',
is_correct: false,
},
{
label: 'Ascending',
is_correct: true,
},
],
},
{
title: 'Explain the purpose of the "DESC" keyword in an "ORDER BY" clause.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'How can you specify multiple columns for sorting in the "ORDER BY" clause?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Separate column names with commas.',
is_correct: true,
},
{
label: 'Use the "AND" operator between column names.',
is_correct: false,
},
{
label: 'Use the "OR" operator between column names.',
is_correct: false,
},
],
},
{
title: 'What is the default sorting order when using the "ORDER BY" clause?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Ascending (ASC)',
is_correct: true,
},
{
label: 'Descending (DESC)',
is_correct: false,
},
{
label: 'Random order',
is_correct: false,
},
],
},
{
title: 'Can you use an alias in the "ORDER BY" clause?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Yes, you can use an alias to specify sorting order.',
is_correct: false,
},
{
label: 'No, aliases are not allowed in the "ORDER BY" clause.',
is_correct: true,
},
{
label: 'Yes, but only for numeric columns.',
is_correct: false,
},
],
},
{
title: "What happens if you don't specify a sorting order (ASC or DESC) in the 'ORDER BY' clause?",
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'The query will return an error.',
is_correct: false,
},
{
label: 'The default sorting order (ASC) will be used.',
is_correct: true,
},
{
label: 'The sorting order will be random.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "LIMIT" clause in a SQL SELECT statement?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To filter rows based on a specified condition.',
is_correct: false,
},
{
label: 'To order the selected rows based on one or more columns.',
is_correct: false,
},
{
label: 'To limit the number of rows returned by the query.',
is_correct: true,
},
],
},
{
title: 'What is the purpose of using the "OFFSET" clause with the "LIMIT" clause?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To specify the columns to select from the table.',
is_correct: false,
},
{
label: 'To skip a specified number of rows before returning results.',
is_correct: true,
},
{
label: 'To order rows in descending order.',
is_correct: false,
},
],
},
],
},
};
export default template;
+199
View File
@@ -0,0 +1,199 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL DELETE Statement Quiz',
description: 'Test your knowledge of using the "DELETE" statement in MySQL with Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of the "DELETE" statement in SQL?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To update existing records in a table.',
is_correct: false,
},
{
label: 'To insert new records into a table.',
is_correct: false,
},
{
label: 'To remove existing records from a table.',
is_correct: true,
},
],
},
{
title: 'Which SQL statement is used to delete a specific record from a table?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'DELETE ALL',
is_correct: false,
},
{
label: 'DELETE',
is_correct: true,
},
{
label: 'REMOVE',
is_correct: false,
},
],
},
{
title: 'What happens if you execute a "DELETE" statement without a "WHERE" clause?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'All records in the table are deleted.',
is_correct: true,
},
{
label: 'No records are deleted, and an error is thrown.',
is_correct: false,
},
{
label: 'The first record in the table is deleted.',
is_correct: false,
},
],
},
{
title: 'Explain the purpose of the "WHERE" clause in a "DELETE" statement.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Can you use the "LIMIT" clause with a "DELETE" statement in MySQL?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Yes, you can use "LIMIT" to specify the maximum number of rows to delete.',
is_correct: true,
},
{
label: 'No, "LIMIT" is not allowed in a "DELETE" statement.',
is_correct: false,
},
{
label: 'Yes, but only with the "ORDER BY" clause.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "ORDER BY" clause in a "DELETE" statement?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To filter rows based on a specified condition.',
is_correct: false,
},
{
label: 'To order the rows before deleting them.',
is_correct: false,
},
{
label: 'To specify the columns to delete.',
is_correct: false,
},
],
},
{
title: 'How can you delete all records from a table using a "DELETE" statement?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Execute "DELETE FROM table_name".',
is_correct: true,
},
{
label: 'Execute "DELETE * FROM table_name".',
is_correct: false,
},
{
label: 'Execute "DELETE table_name".',
is_correct: false,
},
],
},
{
title: 'What is the purpose of using the "TRUNCATE" statement?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To delete specific records from a table.',
is_correct: false,
},
{
label: 'To remove all records from a table quickly.',
is_correct: true,
},
{
label: 'To update records in a table.',
is_correct: false,
},
],
},
{
title: 'What is the difference between the "DELETE" and "TRUNCATE" statements?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Can you use the "JOIN" clause in a "DELETE" statement?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Yes, you can use "JOIN" to delete records from multiple tables.',
is_correct: true,
},
{
label: 'No, "JOIN" is not allowed in a "DELETE" statement.',
is_correct: false,
},
{
label: 'Yes, but only with the "ORDER BY" clause.',
is_correct: false,
},
],
},
],
},
};
export default template;
+195
View File
@@ -0,0 +1,195 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL DROP TABLE Quiz',
description: 'Test your knowledge of dropping tables in MySQL with Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of the "DROP TABLE" statement in SQL?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To create a new table in the database.',
is_correct: false,
},
{
label: 'To delete an existing table and all its data.',
is_correct: true,
},
{
label: 'To update records in a table.',
is_correct: false,
},
],
},
{
title: 'Which SQL statement is used to delete a table in MySQL?',
name: 'question2',
points: 1,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'DELETE TABLE',
is_correct: false,
},
{
label: 'DROP TABLE',
is_correct: true,
},
{
label: 'REMOVE TABLE',
is_correct: false,
},
],
},
{
title: 'What happens if you execute a "DROP TABLE" statement without a table name?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'All tables in the database are deleted.',
is_correct: false,
},
{
label: 'The first table in the database is deleted.',
is_correct: false,
},
{
label: 'An error is thrown, and no table is deleted.',
is_correct: true,
},
],
},
{
title: 'Explain the purpose of the "IF EXISTS" clause in a "DROP TABLE" statement.',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Can you drop multiple tables in a single "DROP TABLE" statement?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Yes, you can specify multiple table names separated by commas.',
is_correct: true,
},
{
label: 'No, you can only drop one table at a time.',
is_correct: false,
},
{
label: 'Yes, but you need to use a separate "DROP TABLE" statement for each table.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "CASCADE" option in a "DROP TABLE" statement?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To drop the table and all dependent objects.',
is_correct: true,
},
{
label: 'To drop the table without affecting dependent objects.',
is_correct: false,
},
{
label: 'To rename the table instead of dropping it.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of using the "RESTRICT" option in a "DROP TABLE" statement?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To drop the table without affecting dependent objects.',
is_correct: true,
},
{
label: 'To drop the table and all dependent objects.',
is_correct: false,
},
{
label: 'To rename the table instead of dropping it.',
is_correct: false,
},
],
},
{
title: 'What is the difference between "DROP TABLE" and "DELETE FROM" in SQL?',
name: 'question8',
points: 2,
order: 7,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Can you use the "IF NOT EXISTS" option with "DROP TABLE"?',
name: 'question9',
points: 1,
order: 8,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Yes, it prevents an error if the table does not exist.',
is_correct: true,
},
{
label: 'No, "IF NOT EXISTS" is not allowed with "DROP TABLE".',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "RENAME" option in a "DROP TABLE" statement?',
name: 'question10',
points: 1,
order: 9,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To rename the table instead of dropping it.',
is_correct: true,
},
{
label: 'To drop the table and all dependent objects.',
is_correct: false,
},
{
label: 'To drop the table without affecting dependent objects.',
is_correct: false,
},
],
},
],
},
};
export default template;
+182
View File
@@ -0,0 +1,182 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL UPDATE Quiz',
description: 'Test your knowledge of updating data in MySQL with Node.js.',
questionnaire: {
questions: [
{
title: 'What SQL statement is used to update data in a MySQL database?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'UPDATE',
is_correct: true,
},
{
label: 'INSERT',
is_correct: false,
},
{
label: 'SELECT',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "SET" clause in an "UPDATE" statement?',
name: 'question2',
points: 2,
order: 1,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To specify which table to update.',
is_correct: false,
},
{
label: 'To set a new value for a column.',
is_correct: true,
},
{
label: 'To specify the condition for updating rows.',
is_correct: false,
},
],
},
{
title: 'Which SQL statement is used to update a specific row in a table?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'UPDATE',
is_correct: false,
},
{
label: 'UPDATE ROW',
is_correct: false,
},
{
label: 'UPDATE ... WHERE',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "WHERE" clause in an "UPDATE" statement?',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which SQL statement is used to update multiple rows in a table?',
name: 'question5',
points: 1,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'UPDATE ROW',
is_correct: false,
},
{
label: 'UPDATE ALL',
is_correct: false,
},
{
label: 'UPDATE ... WHERE',
is_correct: true,
},
],
},
{
title: 'What is the purpose of the "LIMIT" clause in an "UPDATE" statement?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To specify the maximum number of columns to update.',
is_correct: false,
},
{
label: 'To limit the number of rows to update.',
is_correct: true,
},
{
label: 'To set a new value for a column.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "ORDER BY" clause in an "UPDATE" statement?',
name: 'question7',
points: 2,
order: 6,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Can you use a subquery in an "UPDATE" statement?',
name: 'question8',
points: 1,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'Yes, to update rows based on the result of a subquery.',
is_correct: true,
},
{
label: 'No, subqueries are not allowed in "UPDATE" statements.',
is_correct: false,
},
],
},
{
title: 'What happens if you omit the "WHERE" clause in an "UPDATE" statement?',
name: 'question9',
points: 1,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'All rows in the table are updated.',
is_correct: true,
},
{
label: 'An error is thrown, and no rows are updated.',
is_correct: false,
},
{
label: 'The first row in the table is updated.',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "RETURNING" clause in an "UPDATE" statement?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
],
},
};
export default template;
+182
View File
@@ -0,0 +1,182 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL LIMIT Quiz',
description: 'Test your knowledge of limiting results in MySQL with Node.js.',
questionnaire: {
questions: [
{
title: 'What SQL statement is used to limit the number of rows returned in a MySQL query?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'LIMIT',
is_correct: true,
},
{
label: 'SELECT',
is_correct: false,
},
{
label: 'WHERE',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "LIMIT" clause in a MySQL query?',
name: 'question2',
points: 2,
order: 1,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To specify the maximum number of columns to return.',
is_correct: false,
},
{
label: 'To limit the number of rows returned by the query.',
is_correct: true,
},
{
label: 'To filter the results based on a condition.',
is_correct: false,
},
],
},
{
title: 'What is the default value for the "LIMIT" clause if not specified?',
name: 'question3',
points: 1,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: '0',
is_correct: false,
},
{
label: '1',
is_correct: false,
},
{
label: 'No limit (all rows)',
is_correct: true,
},
],
},
{
title: 'Which SQL statement is used to skip a specific number of rows in a query result?',
name: 'question4',
points: 1,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'LIMIT',
is_correct: false,
},
{
label: 'OFFSET',
is_correct: true,
},
{
label: 'SKIP',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "OFFSET" clause in a MySQL query?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Can you use both "LIMIT" and "OFFSET" clauses in a single query?',
name: 'question6',
points: 1,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'Yes, to limit the number of rows and skip a specific number of rows.',
is_correct: true,
},
{
label: 'No, "LIMIT" and "OFFSET" cannot be used together.',
is_correct: false,
},
],
},
{
title: 'What happens if the "LIMIT" value is greater than the total number of rows in the result set?',
name: 'question7',
points: 1,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'An error is thrown.',
is_correct: false,
},
{
label: 'All rows in the result set are returned.',
is_correct: true,
},
{
label: 'No rows are returned.',
is_correct: false,
},
],
},
{
title: 'Which SQL statement is used to limit the number of rows returned from the beginning of a result set?',
name: 'question8',
points: 2,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'LIMIT',
is_correct: false,
},
{
label: 'TOP',
is_correct: true,
},
{
label: 'OFFSET',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "FETCH FIRST" clause in a MySQL query?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'What is the purpose of the "FETCH NEXT" clause in a MySQL query?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
],
},
};
export default template;
+202
View File
@@ -0,0 +1,202 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MySQL JOIN Quiz',
description: 'Test your knowledge of performing JOIN operations in MySQL with Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of a JOIN operation in a MySQL query?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To create a new table.',
is_correct: false,
},
{
label: 'To combine rows from two or more tables based on a related column between them.',
is_correct: true,
},
{
label: 'To delete data from a table.',
is_correct: false,
},
],
},
{
title: 'Which JOIN type returns all rows when there is a match in either table?',
name: 'question2',
points: 2,
order: 1,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'INNER JOIN',
is_correct: false,
},
{
label: 'LEFT JOIN (or LEFT OUTER JOIN)',
is_correct: true,
},
{
label: 'RIGHT JOIN (or RIGHT OUTER JOIN)',
is_correct: true,
},
{
label: 'FULL JOIN (or FULL OUTER JOIN)',
is_correct: true,
},
],
},
{
title: 'Which JOIN type returns only the rows that have matching values in both tables?',
name: 'question3',
points: 2,
order: 2,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'INNER JOIN',
is_correct: true,
},
{
label: 'LEFT JOIN (or LEFT OUTER JOIN)',
is_correct: false,
},
{
label: 'RIGHT JOIN (or RIGHT OUTER JOIN)',
is_correct: false,
},
{
label: 'FULL JOIN (or FULL OUTER JOIN)',
is_correct: false,
},
],
},
{
title: 'What is the purpose of the "ON" clause in a JOIN operation?',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which JOIN type returns all rows from both tables with NULL records where there is no match?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'INNER JOIN',
is_correct: false,
},
{
label: 'LEFT JOIN (or LEFT OUTER JOIN)',
is_correct: false,
},
{
label: 'RIGHT JOIN (or RIGHT OUTER JOIN)',
is_correct: false,
},
{
label: 'FULL JOIN (or FULL OUTER JOIN)',
is_correct: true,
},
],
},
{
title: 'Which SQL statement is used to perform an INNER JOIN in MySQL?',
name: 'question6',
points: 2,
order: 5,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'JOIN',
is_correct: true,
},
{
label: 'INNER',
is_correct: false,
},
{
label: 'ON',
is_correct: false,
},
],
},
{
title: 'Which JOIN type returns all rows from the left table and the matching rows from the right table?',
name: 'question7',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'INNER JOIN',
is_correct: false,
},
{
label: 'LEFT JOIN (or LEFT OUTER JOIN)',
is_correct: true,
},
{
label: 'RIGHT JOIN (or RIGHT OUTER JOIN)',
is_correct: false,
},
{
label: 'FULL JOIN (or FULL OUTER JOIN)',
is_correct: false,
},
],
},
{
title: 'What is the difference between INNER JOIN and LEFT JOIN?',
name: 'question8',
points: 2,
order: 7,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which SQL statement is used to perform a LEFT JOIN in MySQL?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'JOIN',
is_correct: false,
},
{
label: 'LEFT JOIN (or LEFT OUTER JOIN)',
is_correct: true,
},
{
label: 'OUTER JOIN',
is_correct: false,
},
],
},
{
title: 'What happens if there are duplicate column names in the tables being joined?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
],
},
};
export default template;
@@ -0,0 +1,202 @@
import { QuestionTypes } from '../utils';
import type { ExerciseTemplate } from '$lib/utils/types';
const template: ExerciseTemplate = {
title: 'Node.js MongoDB Database Creation Quiz',
description: 'Test your knowledge of creating MongoDB databases with Node.js.',
questionnaire: {
questions: [
{
title: 'What is the purpose of MongoDB in a Node.js application?',
name: 'question1',
points: 2,
order: 0,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'To create a new Node.js application.',
is_correct: false,
},
{
label: 'To store and manage data in a NoSQL database.',
is_correct: true,
},
{
label: 'To create a front-end interface for a website.',
is_correct: false,
},
],
},
{
title: 'Which MongoDB driver is commonly used to connect to MongoDB from a Node.js application?',
name: 'question2',
points: 2,
order: 1,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'MySQL',
is_correct: false,
},
{
label: 'SQLite',
is_correct: false,
},
{
label: 'Mongoose',
is_correct: true,
},
{
label: 'Express.js',
is_correct: false,
},
],
},
{
title: 'What is the role of the "mongodb://localhost/mydb" connection string?',
name: 'question3',
points: 2,
order: 2,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which command is used to create a new MongoDB database?',
name: 'question4',
points: 2,
order: 3,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'CREATE DATABASE',
is_correct: false,
},
{
label: 'USE DATABASE',
is_correct: false,
},
{
label: 'db.createDatabase()',
is_correct: true,
},
{
label: 'db.create()',
is_correct: false,
},
],
},
{
title: 'What is a "collection" in MongoDB?',
name: 'question5',
points: 2,
order: 4,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'A group of related Node.js modules.',
is_correct: false,
},
{
label: 'A set of documents in a MongoDB database.',
is_correct: true,
},
{
label: 'A JavaScript function in a Node.js application.',
is_correct: false,
},
],
},
{
title: 'How can you insert a document into a MongoDB collection using Node.js?',
name: 'question6',
points: 2,
order: 5,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
{
title: 'Which method is used to find documents in a MongoDB collection with specific criteria?',
name: 'question7',
points: 2,
order: 6,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'findOne()',
is_correct: false,
},
{
label: 'find()',
is_correct: true,
},
{
label: 'search()',
is_correct: false,
},
{
label: 'get()',
is_correct: false,
},
],
},
{
title: 'What is the purpose of an ObjectId in MongoDB?',
name: 'question8',
points: 2,
order: 7,
question_type: QuestionTypes[1], // CHECKBOX
options: [
{
label: 'To uniquely identify a document within a collection.',
is_correct: true,
},
{
label: 'To define the structure of a collection.',
is_correct: false,
},
{
label: 'To store binary data.',
is_correct: false,
},
],
},
{
title: 'Which method is used to update documents in a MongoDB collection?',
name: 'question9',
points: 2,
order: 8,
question_type: QuestionTypes[0], // RADIO
options: [
{
label: 'modify()',
is_correct: false,
},
{
label: 'updateOne()',
is_correct: true,
},
{
label: 'change()',
is_correct: false,
},
{
label: 'patch()',
is_correct: false,
},
],
},
{
title: 'How can you delete a document from a MongoDB collection using Node.js?',
name: 'question10',
points: 2,
order: 9,
question_type: QuestionTypes[2], // TEXTAREA
options: [],
},
],
},
};
export default template;
+67
View File
@@ -0,0 +1,67 @@
import nodeModule from './001_node_module';
import nodeHttpModule from './002_node_httpModule';
import nodeFileSystem from './003_node_fileSystem';
import nodeUrlModule from './004_node_urlModule';
import nodeNpm from './005_node_npm';
import nodeEvents from './006_node_events';
import nodeUploadFiles from './007_node_uploadFiles';
import nodeEmail from './008_node_email';
import nodeSqlDatabase from './009_node_sqlDatabase';
import nodeSqlCreateTable from './010_node_sqlCreateTable';
import nodeSqlInertInto from './011_node_sqlInsertInto';
import nodeSqlSelectForm from './012_node_sqlSelectForm';
import nodeSqlWhere from './013_node_sqlWhere';
import nodeSqlOrderBy from './014_node_sqlOrderBy';
import nodeSqlDelete from './015_node_sqlDelete';
import nodeSqlDropTable from './016_node_sqlDropTable';
import nodeSqlUpdate from './017_node_sqlUpdate';
import nodeSqlLimit from './018_node_sqlLimit';
import nodeSqlJoin from './019_node_sqlJoin';
import nodeMongoDBDatabase from './020_node_mongodbDatabase';
export const NODE_IDS: { [key: string]: string } = {
NODE_MODULE: 'NODE_MODULE',
NODE_HTTPMODULE: 'NODE_HTTPMODULE',
NODE_FILESYSTEM: 'NODE_FILESYSTEM',
NODE_URLMODULE: 'NODE_URLMODULE',
NODE_NPM: 'NODE_NPM',
NODE_EVENTS: 'NODE_EVENTS',
NODE_UPLOADFILES: 'NODE_UPLOADFILES',
NODE_EMAIL: 'NODE_EMAIL',
NODE_SQLDATABASE: 'NODE_SQLDATABASE',
NODE_SQLCREATETABLE: 'NODE_SQLCREATETABLE',
NODE_SQLINSERTINTO: 'NODE_SQLINSERTINTO',
NODE_SQLSELECTFORM: 'NODE_SQLSELECTFORM',
NODE_SQLWHERE: 'NODE_SQLWHERE',
NODE_SQLORDERBY: 'NODE_SQLORDERBY',
NODE_SQLDELETE: 'NODE_SQLDELETE',
NODE_SQLDROPTABLE: 'NODE_SQLDROPTABLE',
NODE_SQLUPDATE: 'NODE_SQLUPDATE',
NODE_SQLLIMIT: 'NODE_SQLLIMIT',
NODE_SQLJOIN: 'NODE_SQLJOIN',
NODE_MONGODBDATABASE: 'NODE_MONGODBDATABASE',
};
export const NODE_TEMPLATES = {
[NODE_IDS.NODE_MODULE]: nodeModule,
[NODE_IDS.NODE_HTTPMODULE]: nodeHttpModule,
[NODE_IDS.NODE_FILESYSTEM]: nodeFileSystem,
[NODE_IDS.NODE_URLMODULE]: nodeUrlModule,
[NODE_IDS.NODE_NPM]: nodeNpm,
[NODE_IDS.NODE_EVENTS]: nodeEvents,
[NODE_IDS.NODE_UPLOADFILES]: nodeUploadFiles,
[NODE_IDS.NODE_EMAIL]: nodeEmail,
[NODE_IDS.NODE_SQLDATABASE]: nodeSqlDatabase,
[NODE_IDS.NODE_SQLCREATETABLE]: nodeSqlCreateTable,
[NODE_IDS.NODE_SQLINSERTINTO]: nodeSqlInertInto,
[NODE_IDS.NODE_SQLSELECTFORM]: nodeSqlSelectForm,
[NODE_IDS.NODE_SQLWHERE]: nodeSqlWhere,
[NODE_IDS.NODE_SQLORDERBY]: nodeSqlOrderBy,
[NODE_IDS.NODE_SQLDELETE]: nodeSqlDelete,
[NODE_IDS.NODE_SQLDROPTABLE]: nodeSqlDropTable,
[NODE_IDS.NODE_SQLUPDATE]: nodeSqlUpdate,
[NODE_IDS.NODE_SQLLIMIT]: nodeSqlLimit,
[NODE_IDS.NODE_SQLJOIN]: nodeSqlJoin,
[NODE_IDS.NODE_MONGODBDATABASE]: nodeMongoDBDatabase,
};