first commit

This commit is contained in:
2024-03-12 00:26:54 -04:00
commit 3d476f095c
222 changed files with 26485 additions and 0 deletions

View File

@@ -0,0 +1,312 @@
---
title: Claude 3 Opus's Performance in C Language Exam
subtitle:
date: 2024-03-11T20:17:44-04:00
slug: claude-3-opus-c-exam
draft: false
author:
name: James
link: https://www.jamesflare.com
email:
avatar: /site-logo.avif
description: This blog post presents a simulated C language programming exam, featuring question types such as fill-in-the-blanks, short answer questions, and application problems. The objective is to comprehensively assess students' mastery of C language knowledge, problem-solving abilities, and skills in writing efficient and elegant code. Through such a mock test, students can identify their weaknesses and make thorough preparations for the actual exam. At the same time, it provides readers with an intuitive understanding of the key points in C language assessment.
keywords: ["C Language", "Exam", "Programming Questions"]
license:
comment: true
weight: 0
tags:
- C
- Exam
- Claude
- LLM
- Benchmark
categories:
- Review
- Programming
- LLM
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRss: false
hiddenFromRelated: false
summary: This blog post presents a simulated C language programming exam, featuring question types such as fill-in-the-blanks, short answer questions, and application problems. The objective is to comprehensively assess students' mastery of C language knowledge, problem-solving abilities, and skills in writing efficient and elegant code. Through such a mock test, students can identify their weaknesses and make thorough preparations for the actual exam. At the same time, it provides readers with an intuitive understanding of the key points in C language assessment.
resources:
- name: featured-image
src: featured-image.jpg
- name: featured-image-preview
src: featured-image-preview.jpg
toc: true
math: true
lightgallery: false
password:
message:
repost:
enable: true
url:
# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
---
<!--more-->
{{< admonition type=note title="System Prompt" open=true >}}
You are playing the role of a student learning C language. Your current task is to take an exam on C language. In this exam, you need to perform your best and answer in as much detail as possible to obtain a high score. All examinees, good luck!
{{< /admonition >}}
## Fill-in-the-Blank Questions
1. The working principle of computers is (**A**).
**A** = stored program and program control
2. Integers are represented in memory using binary (**B**) code.
**B** = two's complement
3. There are (**C**) types of relational operators.
**C** = 6 (<, <=, >, >=, ==, !=)
4. There are (**D**) forms of loop statements.
**D** = 3 (while, do-while, for)
5. Using functions requires three steps: (**E**), definition, and calling.
**E** = declaration
6. Array elements are stored (**F**) in memory.
**F** = contiguously
7. The two elements of a pointer are address and (**G**).
**G** = data type
8. To use math library functions, the header file to be included is (**H**).
**H** = <math.h>
9. Variables defined outside of functions are called (**I**) variables.
**I** = global
10. The keyword for defining structure types is (**J**).
**J** = struct
## Short Answer Questions
1. **The roles of break and continue statements**:
The break statement is used to jump out of the current loop body and terminate the loop execution. When the break statement is encountered, the program immediately exits the loop it is in and starts executing the statement following the loop.
The continue statement is used to skip the remaining statements of the current iteration and directly proceed to the next iteration. When the continue statement is encountered, the program immediately jumps to the loop control expression and begins the next iteration.
2. **Solution for returning multiple values from a function**:
Pointers can be used as function parameters to pass the addresses of multiple variables. By modifying the values of these variables inside the function, the effect of returning multiple values can be achieved.
For example, write a function to calculate the sum and difference of two integers and return the results through pointers:
```c
void calc(int a, int b, int *sum, int *diff) {
*sum = a + b;
*diff = a - b;
}
```
Calling the function in main:
```c
int main() {
int x = 10, y = 5, sum, diff;
calc(x, y, &sum, &diff);
printf("Sum: %d, Diff: %d\n", sum, diff);
return 0;
}
```
3. **Situations that require dynamic memory allocation**:
When the required memory size can only be determined at runtime, or when memory needs to be frequently allocated and released, dynamic memory allocation should be used.
For example, reading a file and storing its content in memory. Since the file size is unknown in advance, memory needs to be dynamically allocated based on the actual number of bytes read:
```c
FILE *fp = fopen("data.txt", "r");
char *buffer = NULL;
int size = 0;
int capacity = 0;
char ch;
while ((ch = fgetc(fp)) != EOF) {
if (size + 1 > capacity) {
capacity = (capacity == 0) ? 1 : capacity * 2;
buffer = (char *)realloc(buffer, capacity);
}
buffer[size++] = ch;
}
buffer[size] = '\0';
fclose(fp);
```
4. **The basic idea of the exhaustive method**:
The exhaustive method is a fundamental algorithmic approach. Its basic idea is to enumerate all possible cases, check each case one by one to determine if it satisfies the problem requirements, and thus obtain the solution to the problem.
For example, to find all prime numbers between 1 and 100. The exhaustive method can be used to traverse each number from 1 to 100 and determine whether it is a prime number:
```c
for (int i = 2; i <= 100; i++) {
int isPrime = 1;
for (int j = 2; j < i; j++) {
if (i % j == 0) {
isPrime = 0;
break;
}
}
if (isPrime) {
printf("%d ", i);
}
}
```
5. **Practical problems suitable for storing data using arrays**:
(1) Student grade management system: Arrays can be used to store each student's scores in various subjects, which is convenient for score input, query, and statistics.
(2) Image processing: An image can be regarded as a two-dimensional array, where each element represents the pixel value at the corresponding position. Using arrays facilitates image reading, modification, and display operations.
## Application Questions
1. **A three-digit decimal integer is called a "narcissistic number" if the sum of the cubes of its three digits equals the number itself (for example, $153 = 1^3 + 5^3 + 3^3$). Please define a function to determine whether an integer is a narcissistic number, and use this function to print out all narcissistic numbers.**
```c
#include <stdio.h>
#include <math.h>
int isNarcissistic(int num) {
int sum = 0;
int temp = num;
while (temp > 0) {
int digit = temp % 10;
sum += pow(digit, 3);
temp /= 10;
}
return (sum == num);
}
int main() {
printf("All narcissistic numbers:\n");
for (int i = 100; i <= 999; i++) {
if (isNarcissistic(i)) {
printf("%d ", i);
}
}
return 0;
}
```
2. **Given the iterative relation $x_{k+1} = \frac{4}{3}x_{k} - \frac{a}{3x^{2}_{k}}$, where $a \in \mathbb{R}$, and $\\{ x_k \\}$ converges. Write a program to estimate the limit value of $x_k$.**
```c
#include <stdio.h>
#include <math.h>
#define EPSILON 1e-6
double iterate(double x, double a) {
return (4.0 / 3.0) * x - a / (3 * x * x);
}
int main() {
double a;
printf("Please enter the value of parameter a: ");
scanf("%lf", &a);
double x0 = 1.0; // Initial value
double x1 = iterate(x0, a);
while (fabs(x1 - x0) > EPSILON) {
x0 = x1;
x1 = iterate(x0, a);
}
printf("The estimated limit value of the iterative sequence is: %.6f\n", x1);
return 0;
}
```
3. **There are n students, and the information of each student includes name and score. Use dynamic memory allocation to store the data and complete the following operations:**
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_NAME 20
typedef struct {
char name[MAX_NAME];
int score;
} Student;
void inputStudents(Student *students, int n) {
for (int i = 0; i < n; i++) {
printf("Please enter the name and score of student %d: ", i + 1);
scanf("%s %d", students[i].name, &students[i].score);
}
}
void printStudents(Student *students, int n) {
printf("Student information:\n");
for (int i = 0; i < n; i++) {
printf("Name: %s\tScore: %d\n", students[i].name, students[i].score);
}
}
void sortStudents(Student *students, int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (students[j].score < students[j + 1].score) {
Student temp = students[j];
students[j] = students[j + 1];
students[j + 1] = temp;
}
}
}
}
int main() {
int n;
printf("Please enter the number of students: ");
scanf("%d", &n);
Student *students = (Student *)malloc(n * sizeof(Student));
inputStudents(students, n);
printStudents(students, n);
sortStudents(students, n);
printf("Student information sorted by score in descending order:\n");
printStudents(students, n);
free(students);
return 0;
}
```
The above program implements the following functions:
1. Defined a student structure that includes name and score fields.
2. Created a student structure array of size n using dynamic memory allocation.
3. Provided functions for inputting student information, printing student information, and sorting student information by score in descending order.
4. In the main function, first input the number of students, then dynamically allocate memory to create a student array.
5. Call the corresponding functions to input student information, print student information, sort students by score in descending order, and print the sorted results.
6. Finally, free the dynamically allocated memory.

View File

@@ -0,0 +1,662 @@
---
title: Create MCQs with ChatGPT in Scales
subtitle:
date: 2023-03-04T16:45:19+08:00
slug: create-mcq-chatgpt-scales
draft: false
author:
name: James
link: https://www.jamesflare.com
email:
avatar: /site-logo.avif
description: This blog post demonstrates how to create multiple-choice question (MCQ) papers using ChatGPT, Python, and JSON files, covering the process from generating a question bank to formatting and building the final test papers, answer sheets, and marking schemes.
keywords: ["MCQ","ChatGPT","Python","JSON"]
license:
comment: true
weight: 0
tags:
- ChatGPT
- Python
categories:
- Tutorials
- LLM
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRss: false
hiddenFromRelated: false
summary: This blog post demonstrates how to create multiple-choice question (MCQ) papers using ChatGPT, Python, and JSON files, covering the process from generating a question bank to formatting and building the final test papers, answer sheets, and marking schemes.
resources:
- name: featured-image
src: featured-image.jpg
- name: featured-image-preview
src: featured-image-preview.jpg
toc: true
math: false
lightgallery: false
password:
message:
repost:
enable: true
url:
# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
---
<!--more-->
## Introduction
Hi, dear teachers!
Did you have difficulty on creating test paper for students?
In this post, I am going to show you how to create MCQs in scales and randomly pick a selected number of questions out, then make it into three formatted editable Word documents, includes test paper, answer sheet and marking scheme.
### Steps
1. Ask ChatGPT to make a .json format question bank.
2. Format the .json question bank through a Python Program.
3. Make another Python Program to create papers from the .json question bank.
## Prompt Engineering
Here is the first step. We want the MCQs fit for the topic. To do that, we need tell the ChatGPT what is should do, and where to do.
You may do your prompt like this format
> \[Instruction\] +
>
> \[Templates\] +
>
> \[Learning Objects\] +
>
> \[Topic Concepts\] +
>
> \[Additional Points\] +
>
> \[MCQ Command Words\] +
>
> \[Rules for ChatGPT\]
I made a non-perfect example on Astrophysics, which means not all objects were covered. So, the MCQs can be a bit boring under mass generation. But they will not repeat, at least in options.
Therefore, students who memorize options will be ended.
### Example
{{< admonition type=warning title="This is not The Raw Input" open=true >}}
To make it easier to read, I made the Raw Markdown input into this Web Page.
If you want check out the Raw input, check the end of this section. There is a dropdown box.
{{< /admonition >}}
> You are an AI-powered json file generator that never make mistakes, and you are going to imagine 1000 MCQs about Astrophysics first in mind, then randomly give me 15 of them in this json form:
>
> ```json
> [
> {
> "order_number": "[Order Number]",
> "question": "[Question]",
> "type": "mcq",
> "option_a": "[Option A]",
> "option_b": "[Option B]",
> "option_c": "[Option C]",
> "option_d": "[Option D]",
> "answer": "[Correct Option in ABCD]",
> "explanation": "[Explanation of Why This Answer]"
> },
> {
> "order_number": "[Order Number]",
> "question": "[Question]",
> "type": "mcq",
> "option_a": "[Option A]",
> "option_b": "[Option B]",
> "option_c": "[Option C]",
> "option_d": "[Option D]",
> "answer": "[Correct Option in ABCD]",
> "explanation": "[Explanation of Why This Answer]"
> }
> ]
> ```
>
> Please check the understanding of these Learning objectives in your generated MCQs:
>
> 1. Describe the main objects comprising the universe.
>
> 2. Describe the nature of stars.
>
> 3. Understand astronomical distances.
>
> 4. Work with the method of parallax.
>
> 5. Define luminosity and apparent brightness and solve problems with these quantities and distance.
>
> And these key concepts as well:
> |Term|Definition|
> |:----|:----|
> |Binary star|Two stars orbiting a common centre|
> |Black dwarf|The remnant of a white dwarf after it has cooled down. It has very low luminosity|
> |Black hole|A singularity in space time; the end result of the evolution of a very massive star|
> |Brown dwarf|Gas and dust that did not reach a high enough temperature to initiate fusion. These objects continue to compact and cool down|
> |Cepheid variable|A star of variable luminosity. The luminosity increases sharply and falls off gently with a well-defined period. The period is related to the absolute luminosity of the star and so can be used to estimate the distance to the star|
> |Cluster of galaxies|Galaxies close to one another and affecting one another gravitationally, behaving as one unit|
> |Comet|A small body (mainly ice and dust) orbiting the Sun in an elliptical orbit|
> |Constellation|A group of stars in a recognizable pattern that appear to be near each other in space|
> |Dark matter|Generic name for matter in galaxies and clusters of galaxies that is too cold to radiate. Its existence is inferred from techniques other than direct visual observation|
> |Galaxy|A collection of a very large number of stars mutually attracting one another through the gravitational force and staying together. The number of stars in a galaxy varies from a few million in dwarf galaxies to hundreds of billions in large galaxies. It is estimated that 100 billion galaxies exist in the observable universe|
> |Interstellar medium|Gases (mainly hydrogen and helium) and dust grains (silicates, carbon and iron) filling the space between stars. The density of the interstellar medium is very low. There is about one atom of gas for every cubic centimeter of space. The density of dust is a trillion times smaller. The temperature of the gas is about 100 K|
> |Main-sequence star|A normal star that is undergoing nuclear fusion of hydrogen into helium. Our Sun is a typical main-sequence star|
> |Nebula|Clouds of 'dust', i.e. compounds of carbon, oxygen, silicon and metals, as well as molecular hydrogen, in the space in between stars|
> |Neutron star|The end result of the explosion of a red supergiant; a very small star (a few tens of kilometers in diameter) and very dense. This is a star consisting almost entirely of neutrons. The neutrons form a superfluid around a core of immense pressure and density. A neutron star is an astonishing macroscopic example of microscopic quantum physics|
> |Planetary nebula|The ejected envelope of a red giant star|
> |Red dwarf|A very small star with low temperature, reddish in color|
> |Red giant|A main-sequence star evolves into a red giant - a very large, reddish star. There are nuclear reactions involving the fusion of helium into heavier elements|
> |Stellar cluster|A group of stars that are physically near each other in space, created by the collapse of a single gas cloud|
> |Supernova (Type la)|The explosion of a white dwarf that has accreted mass from a companion star exceeding its stability limit|
> |Supernova (Type II)|The explosion of a red supergiant star: The amount of energy emitted in a supernova explosion can be staggering - comparable to the total energy radiated by our Sun in its entire lifetime!|
> |White dwarf|The end result of the explosion of a red giant. A small, dense star (about the size of the Earth), in which no nuclear reactions take place. It is very hot but its small size gives it a very low luminosity.|
>
> in Additional of:
>
> 1. Nuclear fusion provides the energy that is needed to keep the star hot, so that the radiation pressure is high enough to oppose further gravitational contraction, and at the same time to provide the energy that the star is radiating into space.
>
> 1. The power radiated by a star is known in astrophysics as the luminosity. It is measured in watts.
>
> 1. The unit of apparent brightness is W m^{2}.
>
> You mush use a variety of multiple-choice question types:
>
> 1. \[Background\] + what is ...
>
> 2. What is true about ...
>
> 3. Which ... according ...
>
> 4. Which ... can be ...
>
> 5. What is ... from ...
>
> 6. What is ...
>
> 7. Which ... is correct
>
> 8. Which statement ...
>
> 9. Which statement justify ...
>
> 10. Which is not correct ...
>
> Do not repeat on one type of sentence.
>
> Primary Order:
>
> 1. Make all MCQs base on above information and your knowledge if needed. When there are conflict between your knowledge and the above information. You should use your knowledge to add more detail and background to produce MCQs.
>
> 2. Be creative, change the perspective of your questions randomly, not necessarily from nouns to explanations, but from explanations to nouns, or ask questions based on the relationship between nouns, or ask questions in conjunction with examples; your goal is to help students fully understand the topic from all angles.
>
> 3. Only reply the MCQs and nothing else, do not write explanations. Make sure your answer has right json grammar.
>
> 4. Use english quotation marks or any other english punctuation only.
You can only input pure text into ChatGPT, but it can understand markdown coding. This is the raw input prompt.
If you have issue on creating markdown table, try out this [Table to Markdown](https://markdown-convert.com/en/tool/table).
```text
You are an AI-powered json file generator that never make mistakes, and you are going to imagine 1000 MCQs about Astrophysics first in mind, then randomly give me 15 of them in this json form:
[
{
"order_number": "[Order Number]",
"question": "[Question]",
"type": "mcq",
"option_a": "[Option A]",
"option_b": "[Option B]",
"option_c": "[Option C]",
"option_d": "[Option D]",
"answer": "[Correct Option in ABCD]",
"explanation": "[Explanation of Why This Answer]"
},
{
"order_number": "[Order Number]",
"question": "[Question]",
"type": "mcq",
"option_a": "[Option A]",
"option_b": "[Option B]",
"option_c": "[Option C]",
"option_d": "[Option D]",
"answer": "[Correct Option in ABCD]",
"explanation": "[Explanation of Why This Answer]"
}
]
Please check the understanding of Learning objectives in your generated MCQs:
1. Describe the main objects comprising the universe.
2. Describe the nature of stars.
3. Understand astronomical distances.
4. Work with the method of parallax.
5. Define luminosity and apparent brightness and solve problems with these quantities and distance.
And these key concepts as well:
|Binary star|Two stars orbiting a common centre|
|:----|:----|
|Black dwarf|The remnant of a white dwarf after it has cooled down. It has very low luminosity|
|Black hole|A singularity in space time; the end result of the evolution of a very massive star|
|Brown dwarf|Gas and dust that did not reach a high enough temperature to initiate fusion. These objects continue to compact and cool down|
|Cepheid variable|A star of variable luminosity. The luminosity increases sharply and falls off gently with a well-defined period. The period is related to the absolute luminosity of the star and so can be used to estimate the distance to the star|
|Cluster of galaxies|Galaxies close to one another and affecting one another gravitationally, behaving as one unit|
|Comet|A small body (mainly ice and dust) orbiting the Sun in an elliptical orbit|
|Constellation|A group of stars in a recognizable pattern that appear to be near each other in space|
|Dark matter|Generic name for matter in galaxies and clusters of galaxies that is too cold to radiate. Its existence is inferred from techniques other than direct visual observation|
|Galaxy|A collection of a very large number of stars mutually attracting one another through the gravitational force and staying together. The number of stars in a galaxy varies from a few million in dwarf galaxies to hundreds of billions in large galaxies. It is estimated that 100 billion galaxies exist in the observable universe|
|Interstellar medium|Gases (mainly hydrogen and helium) and dust grains (silicates, carbon and iron) filling the space between stars. The density of the interstellar medium is very low. There is about one atom of gas for every cubic centimeter of space. The density of dust is a trillion times smaller. The temperature of the gas is about 100 K|
|Main-sequence star|A normal star that is undergoing nuclear fusion of hydrogen into helium. Our Sun is a typical main-sequence star|
|Nebula|Clouds of 'dust', i.e. compounds of carbon, oxygen, silicon and metals, as well as molecular hydrogen, in the space in between stars|
|Neutron star|The end result of the explosion of a red supergiant; a very small star (a few tens of kilometers in diameter) and very dense. This is a star consisting almost entirely of neutrons. The neutrons form a superfluid around a core of immense pressure and density. A neutron star is an astonishing macroscopic example of microscopic quantum physics|
|Planetary nebula|The ejected envelope of a red giant star|
|Red dwarf|A very small star with low temperature, reddish in color|
|Red giant|A main-sequence star evolves into a red giant - a very large, reddish star. There are nuclear reactions involving the fusion of helium into heavier elements|
|Stellar cluster|A group of stars that are physically near each other in space, created by the collapse of a single gas cloud|
|Supernova (Type la)|The explosion of a white dwarf that has accreted mass from a companion star exceeding its stability limit|
|Supernova (Type II)|The explosion of a red supergiant star: The amount of energy emitted in a supernova explosion can be staggering - comparable to the total energy radiated by our Sun in its entire lifetime!|
|White dwarf|The end result of the explosion of a red giant. A small, dense star (about the size of the Earth), in which no nuclear reactions take place. It is very hot but its small size gives it a very low luminosity]|
in Additional of:
1. Nuclear fusion provides the energy that is needed to keep the star hot, so that the radiation pressure is high enough to oppose further gravitational contraction, and at the same time to provide the energy that the star is radiating into space.
2. The power radiated by a star is known in astrophysics as the luminosity. It is measured in watts.
3. The unit of apparent brightness is W m^{2}.
You must use a variety of multiple-choice question types:
1. [Background] + what is ...
2. What is true about ...
3. Which ... according ...
4. Which ... can be ...
5. What is ... from ...
6. What is ...
7. Which ... is correct
8. Which statement ...
9. Which statement justify ...
10. Which is not correct ...
Do not repeat on one type of sentence.
Primary Order:
1. Make all MCQs base on above information and your knowledge if needed. When there are conflict between your knowledge and the above information. You should use your knowledge to add more detail and background to produce MCQs.
2. Be creative, change the perspective of your questions randomly, not necessarily from nouns to explanations, but from explanations to nouns, or ask questions based on the relationship between nouns, or ask questions in conjunction with examples; your goal is to help students fully understand the topic from all angles.
3. Only reply the MCQs and nothing else, do not write explanations. Make sure your answer has right json grammar.
4. Use english quotation marks or any other english punctuation only.
```
## Format Question Bank
Before we start, we should know some base knowledge about .json format. In our case, we want our question bank be like:
```json
[
{
"order_number": "1",
"question": "What is a galaxy?",
"type": "mcq",
"option_a": "A collection of planets",
"option_b": "A collection of stars",
"option_c": "A collection of asteroids",
"option_d": "A collection of comets",
"answer": "B",
"explanation": "A galaxy is a collection of a very large number of stars mutually attracting one another through the gravitational force and staying together."
},
{
"order_number": "2",
"question": "What is a main-sequence star?",
"type": "mcq",
"option_a": "A star that has run out of fuel",
"option_b": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_c": "A star that is about to explode",
"option_d": "A star that is very small and has low temperature",
"answer": "B",
"explanation": "A main-sequence star is a normal star that is undergoing nuclear fusion of hydrogen into helium."
}
]
```
We use the square bracket to include all curly brackets. At the same time, the curly brackets need to be separated by a comma.
```json
[
{
//Something
},
{
//Something
},
{
//Something
}
]
```
ChatGPT may give you an answer as:
```json
{
order_number: 1,
question: What is an astronomical unit (AU)?,
type: mcq,
option_a: The average distance between the Earth and the Sun.,
option_b: The radius of the Earth.,
option_c: The distance traveled by light in one year.,
option_d: The mass of the Earth.,
answer: The average distance between the Earth and the Sun.,
explanation: An astronomical unit or AU is a unit of measurement equal to the average distance between Earth and the Sun. It is commonly used to measure distances within our solar system.
},
{
order_number: 2,
question: Which of the following is not a type of galaxy?,
type: mcq,
option_a: Elliptical,
option_b: Spiral,
option_c: Irregular,
option_d: Spherical,
answer: Spherical,
explanation: The three main types of galaxies are elliptical, spiral, and irregular. There is no galaxy type called spherical.
},
```
Three main issues
1. There are non-english quotation marks.
2. An extra comma at the end
3. No square brackets
The ident is missing, but it's not a issue. You may copy the text into [JSON Formatter](https://jsonformatter.curiousconcept.com/#) just get it looks better.
To fix non-english quotation marks, just use a replacing function. Don't use Word or WPS for this job. I recommend a [Sublimetext 4](https://www.sublimetext.com/download) text editor for this job. Others, such as BBEdit is also fine.
After you copy answer parts from ChatGPT, you may find the `order_number` is mass.
Don't worry, first, in the next step of creating MCQ papers, the order number in the paper is not from the `order_number` in .json file.
Second, Here is a Python program that can fix this issue. But, If you do not care about beauty, just make sure there are not grammar mistake for your json file. To do that, you may use [JSON Formatter](https://jsonformatter.curiousconcept.com/#).
```py
import json
from collections import OrderedDict
# Open the JSON file and load the data as a list of dictionaries
with open('data.json', 'r') as f:
data = json.load(f)
# Create an ordered dictionary to store the objects by their order_number
data_dict = OrderedDict()
for obj in data:
if 'order_number' in obj:
order_number = obj['order_number']
if order_number in data_dict:
data_dict[order_number].append(obj)
else:
data_dict[order_number] = [obj]
# Create a new list of dictionaries with the objects ordered by their order_number
data_sorted = []
for order_number, objs in data_dict.items():
for i, obj in enumerate(objs):
obj['order_number'] = str(len(data_sorted) + i + 1)
data_sorted.extend(objs)
# Write the modified list of dictionaries back to the JSON file
with open('question_bank.json', 'w') as f:
json.dump(data_sorted, f, indent=2)
```
I don't want to spend too much time on how to run a Python Program. I will cover it quickly.
1. Install Python: Before running a Python program, you need to ensure that Python is installed on your computer. You can download the latest version of Python from the [official website](https://www.python.org/downloads/). Choose the appropriate version for your operating system and follow the installation instructions.
If you have Homebrew, just run `brew install python`.
2. Create a Python program: Once you have installed Python, you need to create a Python program. You can use any text editor to create a Python program. Save the file with a `.py` extension. In this case, you can rename a file into `qbReorder.py` and paste all my Python Code into it and save.
3. Open a terminal or command prompt: Open a terminal or command prompt on your computer. This is where you will run the Python program.
4. Run the Python program: To run the Python program, type the following command in the terminal or command prompt:
```shell
python qbReorder.py
```
If this doesn't work, try
```shell
python3 qbReorder.py
```
If the `qbReorder.py` is not on the current path, you can run it as,
```shell
python /path/to/the/qbReorder.py
```
But in my `qbReorder.py`. I made the un-order .json file as `data.json`. After you run, you will get a `question_bank.json` on the running path. If you want another name, you may change the code.
I highly recommend you create a folder for this job and put all files here.
- qbReorder.py
- data.json
- question_bank.json
When you are going to use terminal, you can chose "Open terminal here", or use `cd` command to switch to the working folder
```shell
cd /the/path/to/working/folder
```
To be safe, type `ls` command to see all files/folders under this folder. Then, you can do
```shell
python qbReorder.py
```
or
```shell
python3 /qbReorder.py
```
To run the re-order.
This is the end of question bank preparing.
## Make the Papers
Now, it's time to make the real MCQ Papers.
To do that, I made another Python Program
```py
import argparse
import json
import random
from docx import Document
from docx.shared import Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
# Define command-line arguments
parser = argparse.ArgumentParser(description='Generate test papers, answer sheets, and marking scheme.')
parser.add_argument('-q', '--question-bank', type=str, required=True, help='Path to JSON file containing question bank.')
parser.add_argument('-n', '--number-question', type=int, required=True, help='Number of questions to include in the test paper.')
args = parser.parse_args()
# Open JSON file and load data
with open(args.question_bank, 'r') as f:
data = json.load(f)
# Select random questions
selected_questions = random.sample(data, args.number_question)
# Create Test Paper, Answer Sheet, and Marking Scheme
test_paper_doc = Document()
answer_sheet_doc = Document()
marking_scheme_doc = Document()
# Set font
font = test_paper_doc.styles['Normal'].font
font.name = 'Arial'
font.size = Pt(12)
# Add test paper title
test_paper_title = test_paper_doc.add_paragraph('Test Paper', style='Title')
test_paper_title.alignment = WD_ALIGN_PARAGRAPH.CENTER
test_paper_doc.add_paragraph()
# Add answer sheet title
answer_sheet_title = answer_sheet_doc.add_paragraph('Answer Sheet', style='Title')
answer_sheet_title.alignment = WD_ALIGN_PARAGRAPH.CENTER
answer_sheet_doc.add_paragraph()
# Add marking scheme title
marking_scheme_title = marking_scheme_doc.add_paragraph('Marking Scheme', style='Title')
marking_scheme_title.alignment = WD_ALIGN_PARAGRAPH.CENTER
marking_scheme_doc.add_paragraph()
# Loop through selected questions and add to documents
for i, question in enumerate(selected_questions):
# Test Paper
test_paper_doc.add_paragraph(f'{i+1}. {question["question"]}')
test_paper_doc.add_paragraph(f' A. {question["option_a"]}')
test_paper_doc.add_paragraph(f' B. {question["option_b"]}')
test_paper_doc.add_paragraph(f' C. {question["option_c"]}')
test_paper_doc.add_paragraph(f' D. {question["option_d"]}')
test_paper_doc.add_paragraph()
# Answer Sheet
answer_sheet_doc.add_paragraph(f'{i+1}. {question["question"]}')
answer_sheet_doc.add_paragraph(f' A. {question["option_a"]}')
answer_sheet_doc.add_paragraph(f' B. {question["option_b"]}')
answer_sheet_doc.add_paragraph(f' C. {question["option_c"]}')
answer_sheet_doc.add_paragraph(f' D. {question["option_d"]}')
answer_sheet_doc.add_paragraph(f'Answer: {question["answer"]}')
answer_sheet_doc.add_paragraph(f'Explanation: {question["explanation"]}')
answer_sheet_doc.add_paragraph()
# Marking Scheme
marking_scheme_doc.add_paragraph(f'{i+1}. {question["question"]}')
marking_scheme_doc.add_paragraph(f'Answer: {question["answer"]}')
marking_scheme_doc.add_paragraph()
# Save documents
test_paper_doc.save('test_paper.docx')
answer_sheet_doc.save('answer_sheet.docx')
marking_scheme_doc.save('marking_scheme.docx')
```
Before, run this program, you need to use `pip` to install `python-docx` package.
If you don't have `pip`, here is the steps:
1. Check if `pip` is already installed: Before installing `pip`, you should check if it is already installed on your system. Open a terminal or command prompt and type the following command:
```shell
pip --version
```
If pip is already installed, it will display the version number. If not, you will see an error message.
2. Download `get-pip.py`: If pip is not already installed, you need to download `get-pip.py`. In the Terminal, run
```shell
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
```
3. Install `pip`: To install `pip`, type the following command in the terminal or command prompt:
```shell
python get-pip.py
```
or
```shell
python3 get-pip.py
```
Additional, if you have Homebrew, when you run `brew install python`, `pip` is included.
Now, we can continue our work. Install `python-docx` package.
```shell
pip install python-docx
```
Do the similar thing when we run `qbReorder.py`. Now, just copy the code into `qbBuilder.py` and run
```shell
python qbBuilder.py -q question_bank.json -n 30
```
It works as
```
usage: qbBuilder.py [-h] -q QUESTION_BANK -n NUMBER_QUESTION
Generate test papers, answer sheets, and marking scheme.
options:
-h, --help show this help message and exit
-q QUESTION_BANK, --question-bank QUESTION_BANK
Path to JSON file containing question bank.
-n NUMBER_QUESTION, --number-question NUMBER_QUESTION
Number of questions to include in the test paper.
```
So, `question_bank.json` is the question bank's file name, `30` is the number of question you want to include in the paper. Change them into any value you want and enjoy.
```shell
python qbBuilder.py -q [Name of Question Bank File] -n [Number of Questions You Want to Include]
```
You can find three .docx files under the running path.
## End
You can try with my example question bank.
{{< link href="question_bank.json" content="question_bank.json" title="Download question_bank.json" download="question_bank.json" card=true >}}
Also, the Python Program.
{{< link href="qbReorder.py" content="qbReorder.py" title="Download qbReorder.py" download="qbReorder.py" card=true >}}
{{< link href="qbBuilder.py" content="qbBuilder.py" title="Download qbBuilder,py" download="qbBuilder.py" card=true >}}
Example Papers.
{{< link href="test_paper.docx" content="test_paper.docx" title="Download test_paper.docx" download="test_paper.docx" card=true >}}
{{< link href="answer_sheet.docx" content="answer_sheet.docx" title="Download answer_sheet.docx" download="answer_sheet.docx" card=true >}}
{{< link href="marking_scheme.docx" content="marking_scheme.docx" title="Download marking_scheme.docx" download="marking_scheme.docx" card=true >}}
I am going to made ChatGPT to build more types of question, such as sample structure questions. And a fully auto question bank maker, like create 1000 questions with out people. Also, not only for Physic, for other subjects as well.
On the other hand, I am also working on how to improve generated question's quality, which means prompt engineering. I want to hear feedbacks about the questions that generated by ChatGPT, and let me able to improve that. Great thanks!

View File

@@ -0,0 +1,74 @@
import argparse
import json
import random
from docx import Document
from docx.shared import Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
# Define command-line arguments
parser = argparse.ArgumentParser(description='Generate test papers, answer sheets, and marking scheme.')
parser.add_argument('-q', '--question-bank', type=str, required=True, help='Path to JSON file containing question bank.')
parser.add_argument('-n', '--number-question', type=int, required=True, help='Number of questions to include in the test paper.')
args = parser.parse_args()
# Open JSON file and load data
with open(args.question_bank, 'r') as f:
data = json.load(f)
# Select random questions
selected_questions = random.sample(data, args.number_question)
# Create Test Paper, Answer Sheet, and Marking Scheme
test_paper_doc = Document()
answer_sheet_doc = Document()
marking_scheme_doc = Document()
# Set font
font = test_paper_doc.styles['Normal'].font
font.name = 'Arial'
font.size = Pt(12)
# Add test paper title
test_paper_title = test_paper_doc.add_paragraph('Test Paper', style='Title')
test_paper_title.alignment = WD_ALIGN_PARAGRAPH.CENTER
test_paper_doc.add_paragraph()
# Add answer sheet title
answer_sheet_title = answer_sheet_doc.add_paragraph('Answer Sheet', style='Title')
answer_sheet_title.alignment = WD_ALIGN_PARAGRAPH.CENTER
answer_sheet_doc.add_paragraph()
# Add marking scheme title
marking_scheme_title = marking_scheme_doc.add_paragraph('Marking Scheme', style='Title')
marking_scheme_title.alignment = WD_ALIGN_PARAGRAPH.CENTER
marking_scheme_doc.add_paragraph()
# Loop through selected questions and add to documents
for i, question in enumerate(selected_questions):
# Test Paper
test_paper_doc.add_paragraph(f'{i+1}. {question["question"]}')
test_paper_doc.add_paragraph(f' A. {question["option_a"]}')
test_paper_doc.add_paragraph(f' B. {question["option_b"]}')
test_paper_doc.add_paragraph(f' C. {question["option_c"]}')
test_paper_doc.add_paragraph(f' D. {question["option_d"]}')
test_paper_doc.add_paragraph()
# Answer Sheet
answer_sheet_doc.add_paragraph(f'{i+1}. {question["question"]}')
answer_sheet_doc.add_paragraph(f' A. {question["option_a"]}')
answer_sheet_doc.add_paragraph(f' B. {question["option_b"]}')
answer_sheet_doc.add_paragraph(f' C. {question["option_c"]}')
answer_sheet_doc.add_paragraph(f' D. {question["option_d"]}')
answer_sheet_doc.add_paragraph(f'Answer: {question["answer"]}')
answer_sheet_doc.add_paragraph(f'Explanation: {question["explanation"]}')
answer_sheet_doc.add_paragraph()
# Marking Scheme
marking_scheme_doc.add_paragraph(f'{i+1}. {question["question"]}')
marking_scheme_doc.add_paragraph(f'Answer: {question["answer"]}')
marking_scheme_doc.add_paragraph()
# Save documents
test_paper_doc.save('test_paper.docx')
answer_sheet_doc.save('answer_sheet.docx')
marking_scheme_doc.save('marking_scheme.docx')

View File

@@ -0,0 +1,27 @@
import json
from collections import OrderedDict
# Open the JSON file and load the data as a list of dictionaries
with open('data.json', 'r') as f:
data = json.load(f)
# Create an ordered dictionary to store the objects by their order_number
data_dict = OrderedDict()
for obj in data:
if 'order_number' in obj:
order_number = obj['order_number']
if order_number in data_dict:
data_dict[order_number].append(obj)
else:
data_dict[order_number] = [obj]
# Create a new list of dictionaries with the objects ordered by their order_number
data_sorted = []
for order_number, objs in data_dict.items():
for i, obj in enumerate(objs):
obj['order_number'] = str(len(data_sorted) + i + 1)
data_sorted.extend(objs)
# Write the modified list of dictionaries back to the JSON file
with open('question_bank.json', 'w') as f:
json.dump(data_sorted, f, indent=2)

View File

@@ -0,0 +1,453 @@
[
{
"order_number": "1",
"question": "What is a galaxy?",
"type": "mcq",
"option_a": "A collection of planets",
"option_b": "A collection of stars",
"option_c": "A collection of asteroids",
"option_d": "A collection of comets",
"answer": "B",
"explanation": "A galaxy is a collection of a very large number of stars mutually attracting one another through the gravitational force and staying together."
},
{
"order_number": "2",
"question": "Which of the following is the correct description of a star?",
"type": "mcq",
"option_a": "A celestial object that emits light through nuclear fusion reactions in its core",
"option_b": "A planet-like object that orbits around a star",
"option_c": "A type of planet that emits its own light",
"option_d": "A cloud of interstellar gas and dust",
"answer": "A celestial object that emits light through nuclear fusion reactions in its core",
"explanation": "A star is a massive, luminous ball of gas, primarily hydrogen and helium, that emits energy through nuclear fusion reactions in its core."
},
{
"order_number": "3",
"question": "What is a main-sequence star?",
"type": "mcq",
"option_a": "A star that has run out of fuel",
"option_b": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_c": "A star that is about to explode",
"option_d": "A star that is very small and has low temperature",
"answer": "B",
"explanation": "A main-sequence star is a normal star that is undergoing nuclear fusion of hydrogen into helium."
},
{
"order_number": "4",
"question": "What is a white dwarf?",
"type": "mcq",
"option_a": "A type of galaxy",
"option_b": "A type of star that is undergoing nuclear fusion of hydrogen into helium",
"option_c": "The remnant of a red giant star",
"option_d": "The remnant of a white dwarf after it has cooled down, resulting in very low luminosity",
"answer": "The remnant of a white dwarf after it has cooled down, resulting in very low luminosity",
"explanation": "A white dwarf is the final stage of evolution of a star similar to our Sun. After it has expended all its nuclear fuel, it will slowly cool down to become a black dwarf."
},
{
"order_number": "5",
"question": "What is a brown dwarf?",
"type": "mcq",
"option_a": "A star that has run out of fuel",
"option_b": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_c": "Gas and dust that did not reach a high enough temperature to initiate fusion",
"option_d": "A very small star with low temperature",
"answer": "C",
"explanation": "A brown dwarf is gas and dust that did not reach a high enough temperature to initiate fusion. These objects continue to compact and cool down."
},
{
"order_number": "6",
"question": "What is a cluster of galaxies?",
"type": "mcq",
"option_a": "A group of planets that are close to each other",
"option_b": "A group of stars that are close to each other",
"option_c": "Galaxies in close proximity to one another and affecting each other gravitationally, behaving as one unit",
"option_d": "A group of asteroids that have collided with each other",
"answer": "Galaxies in close proximity to one another and affecting each other gravitationally, behaving as one unit",
"explanation": "A cluster of galaxies is a group of galaxies that are bound together by gravity and move together through space."
},
{
"order_number": "7",
"question": "What is a supernova?",
"type": "mcq",
"option_a": "The explosion of a white dwarf that has accreted mass from a companion star exceeding its stability limit",
"option_b": "The explosion of a red supergiant star",
"option_c": "The end result of the explosion of a red giant",
"option_d": "A star that has run out of fuel",
"answer": "B",
"explanation": "A supernova is the explosion of a red supergiant star. The amount of energy emitted in a supernova explosion can be staggering - comparable to the total energy radiated by our Sun in its entire lifetime!"
},
{
"order_number": "8",
"question": "What is dark matter?",
"type": "mcq",
"option_a": "Matter that is too cold to radiate",
"option_b": "A type of matter that emits light in the absence of a light source",
"option_c": "The matter that makes up stars and galaxies",
"option_d": "The mass of a black hole",
"answer": "Matter that is too cold to radiate",
"explanation": "Dark matter is a form of matter that can not be seen or detected through electromagnetic radiation, but whose existence is inferred from its gravitational effects on visible matter."
},
{
"order_number": "9",
"question": "What is a white dwarf?",
"type": "mcq",
"option_a": "The end result of the explosion of a red giant",
"option_b": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_c": "The end result of the explosion of a white dwarf",
"option_d": "A very small star with low temperature",
"answer": "C",
"explanation": "A white dwarf is the end result of the explosion of a red giant. A small, dense star (about the size of the Earth), in which no nuclear reactions take place. It is very hot but its small size gives it a very low luminosity."
},
{
"order_number": "10",
"question": "What is the main source of energy in a star?",
"type": "mcq",
"option_a": "Nuclear fusion of hydrogen into helium",
"option_b": "Nuclear fission of uranium",
"option_c": "Chemical reactions",
"option_d": "Solar wind",
"answer": "Nuclear fusion of hydrogen into helium",
"explanation": "Nuclear fusion provides the energy needed to keep the star hot, oppose gravitational contraction, and provide energy that is radiated into space."
},
{
"order_number": "11",
"question": "What is a red giant?",
"type": "mcq",
"option_a": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_b": "A star that has run out of fuel",
"option_c": "A very small star with low temperature",
"option_d": "A main-sequence star",
"answer": "A",
"explanation": "A red giant is a main-sequence star that evolves into a red giant - a very large, reddish star. There are nuclear reactions involving the fusion of helium into heavier elements."
},
{
"order_number": "12",
"question": "What is luminosity?",
"type": "mcq",
"option_a": "The unit of apparent brightness",
"option_b": "The distance to a star",
"option_c": "The size of a star",
"option_d": "The power radiated by a star",
"answer": "The power radiated by a star",
"explanation": "The power radiated by a star is known in astrophysics as the luminosity. It is measured in watts."
},
{
"order_number": "13",
"question": "What is a neutron star?",
"type": "mcq",
"option_a": "The end result of the explosion of a red giant",
"option_b": "A star consisting almost entirely of neutrons",
"option_c": "A very small star with low temperature",
"option_d": "A star that is undergoing nuclear fusion of hydrogen into helium",
"answer": "B",
"explanation": "A neutron star is the end result of the explosion of a red supergiant; a very small star (a few tens of kilometres in diameter) and very dense. This is a star consisting almost entirely of neutrons. The neutrons form a superfluid around a core of immense pressure and density. A neutron star is an astonishing macroscopic example of microscopic quantum physics."
},
{
"order_number": "14",
"question": "What is a comet?",
"type": "mcq",
"option_a": "A small planet-like object that orbits around a star",
"option_b": "A cloud of interstellar gas and dust",
"option_c": "A massive ball of gas and dust held together by its own gravity",
"option_d": "A small body mainly composed of ice and dust that orbits around a star",
"answer": "A small body mainly composed of ice and dust that orbits around a star",
"explanation": "Comets are small bodies mainly composed of ice and dust that orbit around the Sun in an elliptical orbit."
},
{
"order_number": "15",
"question": "What is a black hole?",
"type": "mcq",
"option_a": "A singularity in space time; the end result of the evolution of a very massive star",
"option_b": "A very small star with low temperature",
"option_c": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_d": "A star that has run out of fuel",
"answer": "A",
"explanation": "A black hole is a singularity in space time; the end result of the evolution of a very massive star."
},
{
"order_number": "16",
"question": "What is a neutron star?",
"type": "mcq",
"option_a": "The end result of the explosion of a red supergiant star",
"option_b": "A type of cluster of galaxies",
"option_c": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_d": "A very small star (a few tens of kilometers in diameter) and very dense, consisting almost entirely of neutrons",
"answer": "A very small star (a few tens of kilometers in diameter) and very dense, consisting almost entirely of neutrons",
"explanation": "A neutron star is the end result of the explosion of a red supergiant star. It is an incredibly dense ball of neutrons that can be only a few kilometers in diameter."
},
{
"order_number": "17",
"question": "What is a planetary nebula?",
"type": "mcq",
"option_a": "Clouds of dust in the space between stars",
"option_b": "The ejected envelope of a red giant star",
"option_c": "A group of stars that are physically near each other in space",
"option_d": "Galaxies close to one another and affecting one another gravitationally, behaving as one unit",
"answer": "B",
"explanation": "A planetary nebula is the ejected envelope of a red giant star."
},
{
"order_number": "18",
"question": "What is a brown dwarf?",
"type": "mcq",
"option_a": "A very small star with low temperature, reddish in color",
"option_b": "Gas and dust that did not reach a high enough temperature to initiate fusion",
"option_c": "The ejected envelope of a red giant star",
"option_d": "A star of variable luminosity",
"answer": "Gas and dust that did not reach a high enough temperature to initiate fusion",
"explanation": "Brown dwarfs are objects that are not massive enough to sustain nuclear fusion reactions in their cores. As a result, they slowly cool down over time."
},
{
"order_number": "19",
"question": "What is dark matter?",
"type": "mcq",
"option_a": "Matter in galaxies and clusters of galaxies that is too cold to radiate",
"option_b": "Gases and dust filling the space between stars",
"option_c": "A star that is undergoing nuclear fusion of hydrogen into helium",
"option_d": "A singularity in space time",
"answer": "A",
"explanation": "Dark matter is generic name for matter in galaxies and clusters of galaxies that is too cold to radiate. Its existence is inferred from techniques other than direct visual observation."
},
{
"order_number": "20",
"question": "What is a cepheid variable?",
"type": "mcq",
"option_a": "A type of nebula",
"option_b": "A type of comet",
"option_c": "A star with variable luminosity that varies in brightness in a well-defined pattern",
"option_d": "A type of cluster of galaxies",
"answer": "A star with variable luminosity that varies in brightness in a well-defined pattern",
"explanation": "Cepheid variables are stars that pulsate in a regular pattern, with a well-defined period. This period is related to the absolute luminosity of the star, which can be used to estimate the distance to the star via parallax."
},
{
"order_number": "21",
"question": "What is the interstellar medium?",
"type": "mcq",
"option_a": "The matter that makes up stars and galaxies",
"option_b": "A cloud of interstellar gas and dust",
"option_c": "The dark matter holding galaxies and clusters of galaxies together",
"option_d": "A group of planets that are close to each other",
"answer": "A cloud of interstellar gas and dust",
"explanation": "The interstellar medium is the gas and dust that fills the space between stars in a galaxy. It is mainly composed of hydrogen and helium, along with small amounts of heavier elements and dust grains."
},
{
"order_number": "22",
"question": "What is a planetary nebula?",
"type": "mcq",
"option_a": "The end result of the explosion of a red giant star",
"option_b": "A cloud of interstellar gas and dust",
"option_c": "The ejected envelope of a red giant star",
"option_d": "A small body mainly composed of ice and dust that orbits around a star",
"answer": "The ejected envelope of a red giant star",
"explanation": "When a low-to-intermediate mass star expands into a red giant, it loses its outer layers into space, producing a planetary nebula. The core of the star that is left behind becomes a white dwarf."
},
{
"order_number": "23",
"question": "What is a main-sequence star?",
"type": "mcq",
"option_a": "The ejected envelope of a red giant star",
"option_b": "A type of star that is undergoing nuclear fusion of hydrogen into helium",
"option_c": "A very small star (a few tens of kilometers in diameter) and very dense, consisting almost entirely of neutrons",
"option_d": "A small body mainly composed of ice and dust that orbits around a star",
"answer": "A type of star that is undergoing nuclear fusion of hydrogen into helium",
"explanation": "A main-sequence star is a normal star that is undergoing nuclear fusion of hydrogen into helium in its core. This is the phase in which our Sun is currently in."
},
{
"order_number": "24",
"question": "What is a red giant?",
"type": "mcq",
"option_a": "Gas and dust that did not reach a high enough temperature to initiate fusion",
"option_b": "The end result of the explosion of a white dwarf",
"option_c": "A small body mainly composed of ice and dust that orbits around a star",
"option_d": "A normal star that has evolved into a very large, reddish star",
"answer": "A normal star that has evolved into a very large, reddish star",
"explanation": "A red giant is a normal star that has evolved past the main-sequence phase and has become a large, reddish star due to nuclear reactions that cause it to expand."
},
{
"order_number": "25",
"question": "What is a black hole?",
"type": "mcq",
"option_a": "A type of planet that emits its own light",
"option_b": "A singularity in space-time; the end result of the evolution of a very massive star",
"option_c": "The mass of a neutron star",
"option_d": "A massive ball of gas and dust held together by its own gravity",
"answer": "A singularity in space-time; the end result of the evolution of a very massive star",
"explanation": "A black hole is a region of space-time where gravity is so strong that nothing, not even light, can escape from it. It is the end result of the evolution of a very massive star."
},
{
"order_number": "26",
"question": "Which statement best describes a black dwarf?",
"type": "mcq",
"option_a": "The ejected envelope of a red giant star",
"option_b": "A small body mainly composed of ice and dust that orbits around a star",
"option_c": "A type of star that is undergoing nuclear fusion of hydrogen into helium",
"option_d": "The remnant of a white dwarf after it has cooled down, resulting in very low luminosity",
"answer": "The remnant of a white dwarf after it has cooled down, resulting in very low luminosity",
"explanation": "A black dwarf is the remnant of a white dwarf after it has cooled down to the point where it no longer emits any visible light."
},
{
"order_number": "27",
"question": "What is an astronomical unit (AU)?",
"type": "mcq",
"option_a": "The average distance between the Earth and the Sun.",
"option_b": "The radius of the Earth.",
"option_c": "The distance traveled by light in one year.",
"option_d": "The mass of the Earth.",
"answer": "The average distance between the Earth and the Sun.",
"explanation": "An astronomical unit or AU is a unit of measurement equal to the average distance between Earth and the Sun. It is commonly used to measure distances within our solar system."
},
{
"order_number": "28",
"question": "Which of the following is not a type of galaxy?",
"type": "mcq",
"option_a": "Elliptical",
"option_b": "Spiral",
"option_c": "Irregular",
"option_d": "Spherical",
"answer": "Spherical",
"explanation": "The three main types of galaxies are elliptical, spiral, and irregular. There is no galaxy type called spherical."
},
{
"order_number": "29",
"question": "What is a cepheid variable?",
"type": "mcq",
"option_a": "A type of black hole",
"option_b": "A star of variable luminosity",
"option_c": "A type of planetary nebula",
"option_d": "A cluster of galaxies",
"answer": "A star of variable luminosity",
"explanation": "A cepheid variable is a star that pulsates in a regular pattern, causing its luminosity to vary. The period of this pulsation is related to the star\u2019s absolute luminosity, allowing it to be used as a standard candle to measure distances in space."
},
{
"order_number": "30",
"question": "Which of the following objects is composed mainly of ice and dust?",
"type": "mcq",
"option_a": "A black hole",
"option_b": "A brown dwarf",
"option_c": "A comet",
"option_d": "A neutron star",
"answer": "A comet",
"explanation": "Comets are small, icy objects that orbit the Sun. When a comet gets close enough to the Sun, its ice melts and forms a brightly glowing coma around it."
},
{
"order_number": "31",
"question": "What is the difference between apparent brightness and luminosity?",
"type": "mcq",
"option_a": "Apparent brightness is a measure of how much light is emitted by a star, while luminosity is a measure of how bright the star appears from Earth.",
"option_b": "Apparent brightness is a measure of how bright a star appears from Earth, while luminosity is a measure of how much light is emitted by the star.",
"option_c": "Apparent brightness is a measure of the distance between Earth and a star, while luminosity is a measure of the star\u2019s mass.",
"option_d": "Apparent brightness is a measure of the star\u2019s mass, while luminosity is a measure of the distance between Earth and the star.",
"answer": "Apparent brightness is a measure of how bright a star appears from Earth, while luminosity is a measure of how much light is emitted by the star.",
"explanation": "Apparent brightness is a measure of how much light from a star reaches Earth, while luminosity is a measure of the total amount of energy emitted by a star in all directions. Luminosity is an intrinsic property of a star, while apparent brightness depends on the star\u2019s luminosity and its distance from Earth."
},
{
"order_number": "32",
"question": "What is a main-sequence star?",
"type": "mcq",
"option_a": "A star that is undergoing nuclear fusion of hydrogen into helium.",
"option_b": "A star that has exhausted its fuel and is in the process of burning helium.",
"option_c": "A star that has evolved off the main sequence and is fusing heavier elements.",
"option_d": "A star that has exploded as a supernova.",
"answer": "A star that is undergoing nuclear fusion of hydrogen into helium.",
"explanation": "A main-sequence star is a normal star that is fusing hydrogen into helium in its core. This is the most common type of star, and includes the Sun."
},
{
"order_number": "33",
"question": "What is a brown dwarf?",
"type": "mcq",
"option_a": "A star that has exploded as a supernova.",
"option_b": "A star that is undergoing nuclear fusion of hydrogen into helium.",
"option_c": "Gas and dust that did not reach a high enough temperature to initiate fusion.",
"option_d": "The ejected envelope of a red giant star.",
"answer": "Gas and dust that did not reach a high enough temperature to initiate fusion.",
"explanation": "A brown dwarf is an object that is too cool and small to undergo sustained nuclear fusion of hydrogen in its core, but is too hot and massive to be called a planet. They are often described as \u2018failed stars\u2019."
},
{
"order_number": "34",
"question": "What is a supernova?",
"type": "mcq",
"option_a": "The explosion of a red giant star.",
"option_b": "The end result of the evolution of a very massive star.",
"option_c": "A singularity in space-time.",
"option_d": "The ejected envelope of a red giant star.",
"answer": "The explosion of a star.",
"explanation": "A supernova is a catastrophic explosion that occurs at the end of a star\u2019s life. The explosion can outshine an entire galaxy for a brief period of time."
},
{
"order_number": "35",
"question": "What is dark matter?",
"type": "mcq",
"option_a": "Matter in galaxies that is too cold to radiate and is inferred from techniques other than direct visual observation.",
"option_b": "The ejected envelope of a red giant star.",
"option_c": "Space-time that is so warped that nothing can escape it, not even light.",
"option_d": "Matter that is made up of subatomic particles that do not interact with the electromagnetic force.",
"answer": "Matter in galaxies that is too cold to radiate and is inferred from techniques other than direct visual observation.",
"explanation": "Dark matter is matter that is inferred to exist from its gravitational effects but does not emit or absorb light, and therefore cannot be detected directly by telescopes."
},
{
"order_number": "36",
"question": "What is a black hole?",
"type": "mcq",
"option_a": "A type of galaxy in which most of the stars are very old and have mostly red colours.",
"option_b": "A singularity in space-time that is the end result of the evolution of a very massive star.",
"option_c": "A star that has exhausted its fuel and is in the process of burning helium.",
"option_d": "A star that has exploded as a supernova.",
"answer": "A singularity in space-time that is the end result of the evolution of a very massive star.",
"explanation": "A black hole is a region of space-time where gravity is so strong that nothing, not even light, can escape its pull. They are formed from the collapse of very massive stars."
},
{
"order_number": "37",
"question": "Which of the following is not a type of nebula?",
"type": "mcq",
"option_a": "Planetary Nebula",
"option_b": "Stellar Nebula",
"option_c": "Reflection Nebula",
"option_d": "Irregular Nebula",
"answer": "Stellar Nebula",
"explanation": "Stellar nebula is not a type of nebula. The three main types of nebula are emission nebula, reflection nebula, and planetary nebula."
},
{
"order_number": "38",
"question": "What is nuclear fusion?",
"type": "mcq",
"option_a": "The process by which a star burns helium into heavier elements in its core.",
"option_b": "The process by which a star burns hydrogen into helium in its core.",
"option_c": "The process by which a planet forms from a cloud of gas and dust.",
"option_d": "The process by which a star expands into a red giant.",
"answer": "The process by which a star burns hydrogen into helium in its core.",
"explanation": "Nuclear fusion is the process by which a star generates energy by fusing hydrogen atoms into helium atoms in its core. This process releases a tremendous amount of energy in the form of light and heat."
},
{
"order_number": "39",
"question": "What is a red giant?",
"type": "mcq",
"option_a": "A star that has exploded as a supernova.",
"option_b": "A star that is undergoing nuclear fusion of hydrogen into helium.",
"option_c": "A star that has exhausted its fuel and is in the process of burning helium.",
"option_d": "A star that has evolved off the main sequence and is fusing heavier elements.",
"answer": "A star that has evolved off the main sequence and is fusing heavier elements.",
"explanation": "A red giant is a star that has exhausted the supply of hydrogen in its core and is now fusing heavier elements. This causes the star to expand and become much larger and redder than before."
},
{
"order_number": "40",
"question": "What is a white dwarf?",
"type": "mcq",
"option_a": "The end result of the explosion of a red giant.",
"option_b": "A small, dense star that is fusing helium into heavier elements in its core.",
"option_c": "A small, dense star that is no longer generating energy through nuclear fusion.",
"option_d": "A star that is undergoing nuclear fusion of hydrogen into helium.",
"answer": "A small, dense star that is no longer generating energy through nuclear fusion.",
"explanation": "A white dwarf is the end result of the evolution of a low- to medium-mass star. It is a small, dense star that is no longer generating energy through nuclear fusion. White dwarfs are very hot and faint, and will eventually cool down over billions of years."
},
{
"order_number": "41",
"question": "What is a black dwarf?",
"type": "mcq",
"option_a": "The end result of the explosion of a red giant.",
"option_b": "A type of black hole with very low mass.",
"option_c": "Gas and dust that did not reach a high enough temperature to initiate fusion.",
"option_d": "The remnant of a white dwarf after it has cooled down.",
"answer": "The remnant of a white dwarf after it has cooled down.",
"explanation": "A black dwarf is a hypothetical object that would be the end result of the evolution of a white dwarf. It is essentially a cold, dark object made purely of carbon and oxygen atoms. However, the universe is not old enough for any white dwarfs to have cooled down enough to become black dwarfs yet."
}
]