Skip to content

feat: Dean's changes to answer choices for the quiz in lesson02 #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
22 changes: 11 additions & 11 deletions lesson_02/quiz/src/lesson2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Lesson2 {
[AnswerChoice.C, "To delete unnecessary files"],
[AnswerChoice.D, "To run code more efficiently"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -56,7 +56,7 @@ export class Lesson2 {
[AnswerChoice.C, "A tool for merging branches"],
[AnswerChoice.D, "A way to delete a repository"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.A, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -70,7 +70,7 @@ export class Lesson2 {
[AnswerChoice.C, "Push changes to the server"],
[AnswerChoice.D, "Write code directly in GitHub"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.D, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -84,7 +84,7 @@ export class Lesson2 {
[AnswerChoice.C, "git branch"],
[AnswerChoice.D, "git pull"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -98,7 +98,7 @@ export class Lesson2 {
[AnswerChoice.C, "NetBeans"],
[AnswerChoice.D, "VS Code"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.D, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -112,7 +112,7 @@ export class Lesson2 {
[AnswerChoice.C, "Dev Containers"],
[AnswerChoice.D, "Source Control"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -126,7 +126,7 @@ export class Lesson2 {
[AnswerChoice.C, "Playing music"],
[AnswerChoice.D, "Managing source control"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -140,7 +140,7 @@ export class Lesson2 {
[AnswerChoice.C, "cd"],
[AnswerChoice.D, "mkdir"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -154,7 +154,7 @@ export class Lesson2 {
[AnswerChoice.C, "cd"],
[AnswerChoice.D, "mkdir"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -168,7 +168,7 @@ export class Lesson2 {
[AnswerChoice.C, "Remove a file or directory"],
[AnswerChoice.D, "Copy a file or directory"],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.A, // Replace `UNANSWERED` with the correct answer.
);
}

Expand All @@ -182,7 +182,7 @@ export class Lesson2 {
[AnswerChoice.C, "⌘ + Q"],
[AnswerChoice.D, '⌘ + S, then type "terminal"'],
]),
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
);
}
}
Expand Down
9 changes: 9 additions & 0 deletions lesson_02/quiz_java/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

5 changes: 5 additions & 0 deletions lesson_02/quiz_java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
45 changes: 45 additions & 0 deletions lesson_02/quiz_java/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java application project to get you started.
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/9.0.0/userguide/building_java_projects.html in the Gradle documentation.
*/
plugins {
java
id("org.springframework.boot") version "3.1.0"
id("io.spring.dependency-management") version "1.1.0"
application
}


java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.apache.commons:commons-text:1.10.0")
implementation(project(":instructional-lib"))
implementation("org.springframework.boot:spring-boot-starter")
testImplementation("org.springframework.boot:spring-boot-starter-test")

}



application {
/*
* Define the main class for the application.
*/
mainClass.set("org.example.Lesson2")
}

tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
205 changes: 205 additions & 0 deletions lesson_02/quiz_java/app/src/main/java/quiz_java/Lesson2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
/*
* This source file was generated by the Gradle 'init' task
*/

package org.example;


import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import com.codedifferently.instructional.quiz.AnswerChoice;
import com.codedifferently.instructional.quiz.MultipleChoiceQuizQuestion;
import com.codedifferently.instructional.quiz.QuizPrinter;
import com.codedifferently.instructional.quiz.QuizQuestion;

@SpringBootApplication

public class Lesson2 {
public static void main(String[] args) {
if (System.getenv("JEST_WORKER_ID") == null) {
new Lesson2().run();
}
}

public void run() {
List<QuizQuestion> quizQuestions = Lesson2.makeQuizQuestions();
if (quizQuestions == null) throw new RuntimeException("Quiz questions cannot be null");
QuizPrinter printer = new QuizPrinter();
printer.printQuiz(quizQuestions);
}

public static List<QuizQuestion> makeQuizQuestions() {
return Arrays.asList(
makeQuestion0(),
makeQuestion1(),
makeQuestion2(),
makeQuestion3(),
makeQuestion4(),
makeQuestion5(),
makeQuestion6(),
makeQuestion7(),
makeQuestion8(),
makeQuestion9(),
makeQuestion10()
);
}

private static QuizQuestion makeQuestion0() {
return new MultipleChoiceQuizQuestion(
0,
"What is the main purpose of version control?",
Map.of(
AnswerChoice.A, "To make backups of files",
AnswerChoice.B, "To keep a record of changes over time",
AnswerChoice.C, "To delete unnecessary files",
AnswerChoice.D, "To run code more efficiently"
),
AnswerChoice.B
);
}

private static QuizQuestion makeQuestion1() {
return new MultipleChoiceQuizQuestion(
1,
"What is a fork in Git?",
Map.of(
AnswerChoice.A, "A duplicate copy of a repository that you own and modify",
AnswerChoice.B, "A temporary backup of the code",
AnswerChoice.C, "A tool for merging branches",
AnswerChoice.D, "A way to delete a repository"
),
AnswerChoice.A
);
}

private static QuizQuestion makeQuestion2() {
return new MultipleChoiceQuizQuestion(
2,
"Which of the following is NOT part of the basic Git workflow?",
Map.of(
AnswerChoice.A, "Pull the latest changes",
AnswerChoice.B, "Commit changes locally",
AnswerChoice.C, "Push changes to the server",
AnswerChoice.D, "Write code directly in GitHub"
),
AnswerChoice.D
);
}

private static QuizQuestion makeQuestion3() {
return new MultipleChoiceQuizQuestion(
3,
"What command is used to combine changes from different branches?",
Map.of(
AnswerChoice.A, "git commit",
AnswerChoice.B, "git merge",
AnswerChoice.C, "git branch",
AnswerChoice.D, "git pull"
),
AnswerChoice.B
);
}

private static QuizQuestion makeQuestion4() {
return new MultipleChoiceQuizQuestion(
4,
"Which IDE is being used in the class?",
Map.of(
AnswerChoice.A, "Eclipse",
AnswerChoice.B, "IntelliJ IDEA",
AnswerChoice.C, "NetBeans",
AnswerChoice.D, "VS Code"
),
AnswerChoice.D
);
}

private static QuizQuestion makeQuestion5() {
return new MultipleChoiceQuizQuestion(
5,
"What feature allows developers to work from the same pre-configured environment in VS Code?",
Map.of(
AnswerChoice.A, "Extensions",
AnswerChoice.B, "Debugger",
AnswerChoice.C, "Dev Containers",
AnswerChoice.D, "Source Control"
),
AnswerChoice.C
);
}

private static QuizQuestion makeQuestion6() {
return new MultipleChoiceQuizQuestion(
6,
"What is NOT a reason for using an IDE?",
Map.of(
AnswerChoice.A, "Editing and refactoring code",
AnswerChoice.B, "Browsing code",
AnswerChoice.C, "Playing music",
AnswerChoice.D, "Managing source control"
),
AnswerChoice.C
);
}

private static QuizQuestion makeQuestion7() {
return new MultipleChoiceQuizQuestion(
7,
"What is the command to list files in the current directory?",
Map.of(
AnswerChoice.A, "pwd",
AnswerChoice.B, "ls",
AnswerChoice.C, "cd",
AnswerChoice.D, "mkdir"
),
AnswerChoice.B
);
}

private static QuizQuestion makeQuestion8() {
return new MultipleChoiceQuizQuestion(
8,
"Which command is used to change directories in the terminal?",
Map.of(
AnswerChoice.A, "pwd",
AnswerChoice.B, "ls",
AnswerChoice.C, "cd",
AnswerChoice.D, "mkdir"
),
AnswerChoice.C
);
}

private static QuizQuestion makeQuestion9() {
return new MultipleChoiceQuizQuestion(
9,
"What does the command `chmod` do?",
Map.of(
AnswerChoice.A, "Change file or directory permissions",
AnswerChoice.B, "List files in a directory",
AnswerChoice.C, "Remove a file or directory",
AnswerChoice.D, "Copy a file or directory"
),
AnswerChoice.A
);
}

private static QuizQuestion makeQuestion10() {
return new MultipleChoiceQuizQuestion(
10,
"What is the shortcut for getting to the Mac terminal?",
Map.of(
AnswerChoice.A, "⌘ + Shift + T",
AnswerChoice.B, "⌘ + Spacebar, then type \"terminal\"",
AnswerChoice.C, "⌘ + Q",
AnswerChoice.D, "⌘ + S, then type \"terminal\""
),
AnswerChoice.B
);
}

}
Loading