Fixed quiz buttons

Signed-off-by: Ioan Chelaru Cristian <iccjoc@localhost.localdomain>

fixed merge conflicts
This commit is contained in:
Ioan Chelaru Cristian 2024-06-02 00:59:08 +03:00
parent af2c5afa95
commit b4fed6e3c9
5 changed files with 725 additions and 184 deletions

View file

@ -1,180 +1,703 @@
{ [
"questions": [ {
{ "id": 1,
"id": 1, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What is the output of the expression 3 + 2 * 5 in C++?",
"text": "What is the purpose of the 'std' namespace in C++?", "answer": "13"
"answer": "The 'std' namespace in C++ is used to define the standard C++ library functions and objects." },
}, {
{ "id": 2,
"id": 2, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What is the default access specifier for class members in C++?",
"text": "What does the 'cout' object in C++ do?", "answer": "private"
"answer": "'cout' is used to output data to the standard output, typically the screen." },
}, {
{ "id": 3,
"id": 3, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What is the name of the process that automatically converts a primitive type to its corresponding wrapper class object in C++?",
"text": "How do you declare an integer variable in C++?", "answer": "Boxing"
"answer": "You declare an integer variable in C++ using the 'int' keyword followed by the variable name, e.g., 'int myVar;'." },
}, {
{ "id": 4,
"id": 4, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "Which C++ feature allows the creation of a function or an operator with more than one form?",
"text": "What is a pointer in C++?", "answer": "Polymorphism"
"answer": "A pointer is a variable that holds the memory address of another variable." },
}, {
{ "id": 5,
"id": 5, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What is the main purpose of a constructor in C++?",
"text": "What is the use of the 'new' operator in C++?", "answer": "To initialize an object"
"answer": "The 'new' operator is used to dynamically allocate memory on the heap." },
}, {
{ "id": 6,
"id": 6, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What does STL stand for in C++?",
"text": "What is a class in C++?", "answer": "Standard Template Library"
"answer": "A class in C++ is a user-defined type that contains data members and member functions to operate on the data." },
}, {
{ "id": 7,
"id": 7, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "Which operator is used to access the members of a structure through a pointer in C++?",
"text": "What is inheritance in C++?", "answer": "->"
"answer": "Inheritance is a feature in C++ where one class can inherit the properties and methods of another class." },
}, {
{ "id": 8,
"id": 8, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What is the keyword used to define a constant in C++?",
"text": "How do you define a function in C++?", "answer": "const"
"answer": "A function in C++ is defined by specifying the return type, function name, and parameters, followed by the function body enclosed in curly braces." },
}, {
{ "id": 9,
"id": 9, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What is the primary purpose of the 'new' operator in C++?",
"text": "What is a constructor in C++?", "answer": "To allocate memory dynamically"
"answer": "A constructor is a special member function of a class that is executed whenever an object of that class is created." },
}, {
{ "id": 10,
"id": 10, "category": "cpp",
"category": "cpp", "type": "none",
"type": "none", "text": "What does RTTI stand for in C++?",
"text": "What is polymorphism in C++?", "answer": "Run-Time Type Information"
"answer": "Polymorphism in C++ allows for functions or methods to be used in different contexts, typically through inheritance and function overriding." },
}, {
{ "id": 11,
"id": 11, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is a pure virtual function in C++?",
"text": "What is a firewall in cybersecurity?", "answer": "A function with no definition that must be overridden in derived classes"
"answer": "A firewall is a network security device that monitors and filters incoming and outgoing network traffic based on an organization's previously established security policies." },
}, {
{ "id": 12,
"id": 12, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is the name of the feature that allows the same function name to be used for different types in C++?",
"text": "What is phishing?", "answer": "Function Overloading"
"answer": "Phishing is a cyber attack that uses disguised email as a weapon to trick the email recipient into believing that the message is something they want or need." },
}, {
{ "id": 13,
"id": 13, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is a 'namespace' in C++?",
"text": "What is malware?", "answer": "A declarative region that provides a scope to the identifiers inside it"
"answer": "Malware is malicious software designed to harm, exploit, or otherwise compromise the operation of a computer system." },
}, {
{ "id": 14,
"id": 14, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "Which C++ keyword is used to prevent a variable from being modified?",
"text": "What is encryption?", "answer": "const"
"answer": "Encryption is the process of converting data into a code to prevent unauthorized access." },
}, {
{ "id": 15,
"id": 15, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is the function of the 'friend' keyword in C++?",
"text": "What is a VPN?", "answer": "To allow a function or another class access to the private and protected members of a class"
"answer": "A VPN (Virtual Private Network) extends a private network across a public network and enables users to send and receive data across shared or public networks as if their computing devices were directly connected to the private network." },
}, {
{ "id": 16,
"id": 16, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is 'inheritance' in C++?",
"text": "What is two-factor authentication?", "answer": "The process by which one class acquires the properties and functionalities of another class"
"answer": "Two-factor authentication is a security process in which the user provides two different authentication factors to verify themselves." },
}, {
{ "id": 17,
"id": 17, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "Which operator is used for scope resolution in C++?",
"text": "What is a DDoS attack?", "answer": "::"
"answer": "A DDoS (Distributed Denial of Service) attack is an attempt to make an online service unavailable by overwhelming it with traffic from multiple sources." },
}, {
{ "id": 18,
"id": 18, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is a 'destructor' in C++?",
"text": "What is social engineering?", "answer": "A special member function that is executed when an object of its class is destroyed"
"answer": "Social engineering is the psychological manipulation of people into performing actions or divulging confidential information." },
}, {
{ "id": 19,
"id": 19, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is the primary use of the 'this' pointer in C++?",
"text": "What is a zero-day vulnerability?", "answer": "To refer to the calling object itself"
"answer": "A zero-day vulnerability is a software security flaw that is known to the software vendor but does not have a patch in place to fix the flaw." },
}, {
{ "id": 20,
"id": 20, "category": "cpp",
"category": "cybersec", "type": "none",
"type": "none", "text": "What is the return type of the main function in C++?",
"text": "What is ransomware?", "answer": "int"
"answer": "Ransomware is a type of malicious software designed to block access to a computer system until a sum of money is paid." },
}, {
{ "id": 21,
"id": 21, "category": "cybersec",
"category": "geography", "type": "none",
"type": "none", "text": "What does 'phishing' mean in cybersecurity?",
"text": "What is the capital of France?", "answer": "A technique used to trick users into providing sensitive information by pretending to be a trustworthy entity"
"answer": "The capital of France is Paris." },
}, {
{ "id": 22,
"id": 22, "category": "cybersec",
"category": "geography", "type": "none",
"type": "none", "text": "What is the purpose of a firewall in network security?",
"text": "Which river is the longest in the world?", "answer": "To monitor and control incoming and outgoing network traffic based on predetermined security rules"
"answer": "The Nile River is considered the longest river in the world." },
}, {
{ "id": 23,
"id": 23, "category": "cybersec",
"category": "geography", "type": "none",
"type": "none", "text": "What does 'DDoS' stand for?",
"text": "What is the largest desert in the world?", "answer": "Distributed Denial of Service"
"answer": "The Sahara Desert is the largest hot desert in the world." },
}, {
{ "id": 24,
"id": 24, "category": "cybersec",
"category": "geography", "type": "none",
"type": "none", "text": "What is a 'zero-day' exploit?",
"text": "Which country has the largest population?", "answer": "A cyber attack that occurs on the same day a vulnerability is discovered and before a fix is implemented"
"answer": "China has the largest population in the world." },
}, {
{ "id": 25,
"id": 25, "category": "cybersec",
"category": "geography", "type": "none",
"type": "none", "text": "What is 'encryption' in the context of cybersecurity?",
"text": "What is the smallest country in the world by area?", "answer": "The process of converting information or data into a code to prevent unauthorized access"
"answer": "Vatican City is the smallest country in the world by area." },
} {
] "id": 26,
} "category": "cybersec",
"type": "none",
"text": "What does 'VPN' stand for in cybersecurity?",
"answer": "Virtual Private Network"
},
{
"id": 27,
"category": "cybersec",
"type": "none",
"text": "What is a 'trojan horse' in cybersecurity?",
"answer": "A type of malware that disguises itself as legitimate software"
},
{
"id": 28,
"category": "cybersec",
"type": "none",
"text": "What is the primary goal of social engineering attacks?",
"answer": "To manipulate individuals into divulging confidential information"
},
{
"id": 29,
"category": "cybersec",
"type": "none",
"text": "What is 'ransomware'?",
"answer": "A type of malware that encrypts a user's data and demands payment to restore access"
},
{
"id": 30,
"category": "cybersec",
"type": "none",
"text": "What does 'SQL injection' exploit?",
"answer": "Vulnerabilities in an application's software by inserting malicious SQL code"
},
{
"id": 31,
"category": "cybersec",
"type": "none",
"text": "What is 'two-factor authentication'?",
"answer": "A security process that requires two different forms of identification to access an account"
},
{
"id": 32,
"category": "cybersec",
"type": "none",
"text": "What is 'malware'?",
"answer": "Software designed to disrupt, damage, or gain unauthorized access to computer systems"
},
{
"id": 33,
"category": "cybersec",
"type": "none",
"text": "What does 'TLS' stand for in cybersecurity?",
"answer": "Transport Layer Security"
},
{
"id": 34,
"category": "cybersec",
"type": "none",
"text": "What is 'brute force attack' in cybersecurity?",
"answer": "A method to find passwords or encryption keys by trying every possible combination"
},
{
"id": 35,
"category": "cybersec",
"type": "none",
"text": "What is the primary function of an Intrusion Detection System (IDS)?",
"answer": "To monitor network traffic for suspicious activity and potential threats"
},
{
"id": 36,
"category": "cybersec",
"type": "none",
"text": "What is 'spoofing' in cybersecurity?",
"answer": "The act of disguising a communication from an unknown source as being from a known, trusted source"
},
{
"id": 37,
"category": "cybersec",
"type": "none",
"text": "What is 'rootkit'?",
"answer": "A type of malicious software designed to hide the existence of certain processes or programs from normal methods of detection"
},
{
"id": 38,
"category": "cybersec",
"type": "none",
"text": "What does 'CVE' stand for in cybersecurity?",
"answer": "Common Vulnerabilities and Exposures"
},
{
"id": 39,
"category": "cybersec",
"type": "none",
"text": "What is 'pharming' in cybersecurity?",
"answer": "A cyber attack intended to redirect a website's traffic to another, fake site"
},
{
"id": 40,
"category": "cybersec",
"type": "none",
"text": "What does 'APT' stand for in cybersecurity?",
"answer": "Advanced Persistent Threat"
},
{
"id": 41,
"category": "cybersec",
"type": "none",
"text": "What is 'cross-site scripting' (XSS)?",
"answer": "A vulnerability that allows attackers to inject malicious scripts into webpages viewed by users"
},
{
"id": 42,
"category": "cybersec",
"type": "none",
"text": "What does 'BYOD' stand for in cybersecurity?",
"answer": "Bring Your Own Device"
},
{
"id": 43,
"category": "cybersec",
"type": "none",
"text": "What is 'penetration testing'?",
"answer": "A method of evaluating the security of a computer system by simulating an attack"
},
{
"id": 44,
"category": "cybersec",
"type": "none",
"text": "What does 'CIA' stand for in cybersecurity?",
"answer": "Confidentiality, Integrity, and Availability"
},
{
"id": 45,
"category": "cybersec",
"type": "none",
"text": "What is 'smishing'?",
"answer": "A type of phishing attack that uses SMS messages to lure victims"
},
{
"id": 46,
"category": "cybersec",
"type": "none",
"text": "What is a 'honeypot' in cybersecurity?",
"answer": "A security system set up to attract and detect hackers"
},
{
"id": 47,
"category": "cybersec",
"type": "none",
"text": "What is the purpose of 'endpoint protection'?",
"answer": "To secure endpoints or entry points of end-user devices such as desktops, laptops, and mobile devices"
},
{
"id": 48,
"category": "cybersec",
"type": "none",
"text": "What does 'SIEM' stand for in cybersecurity?",
"answer": "Security Information and Event Management"
},
{
"id": 49,
"category": "cybersec",
"type": "none",
"text": "What is a 'man-in-the-middle' attack?",
"answer": "A cyber attack where the attacker secretly intercepts and relays messages between two parties"
},
{
"id": 50,
"category": "cybersec",
"type": "none",
"text": "What is 'data exfiltration'?",
"answer": "The unauthorized transfer of data from a computer"
},
{
"id": 51,
"category": "geography",
"type": "none",
"text": "What is the longest river in the world?",
"answer": "The Nile River"
},
{
"id": 52,
"category": "geography",
"type": "none",
"text": "What is the capital city of Australia?",
"answer": "Canberra"
},
{
"id": 53,
"category": "geography",
"type": "none",
"text": "Which desert is the largest in the world?",
"answer": "The Sahara Desert"
},
{
"id": 54,
"category": "geography",
"type": "none",
"text": "What is the smallest country in the world by land area?",
"answer": "Vatican City"
},
{
"id": 55,
"category": "geography",
"type": "none",
"text": "What mountain range forms the natural border between France and Spain?",
"answer": "The Pyrenees"
},
{
"id": 56,
"category": "geography",
"type": "none",
"text": "Which country has the most natural lakes?",
"answer": "Canada"
},
{
"id": 57,
"category": "geography",
"type": "none",
"text": "What is the highest mountain in Africa?",
"answer": "Mount Kilimanjaro"
},
{
"id": 58,
"category": "geography",
"type": "none",
"text": "What is the capital of Japan?",
"answer": "Tokyo"
},
{
"id": 59,
"category": "geography",
"type": "none",
"text": "What river runs through the Grand Canyon?",
"answer": "The Colorado River"
},
{
"id": 60,
"category": "geography",
"type": "none",
"text": "Which country is known as the Land of the Rising Sun?",
"answer": "Japan"
},
{
"id": 61,
"category": "geography",
"type": "none",
"text": "What is the largest island in the world?",
"answer": "Greenland"
},
{
"id": 62,
"category": "geography",
"type": "none",
"text": "Which European country shares borders with the most neighbors?",
"answer": "Germany"
},
{
"id": 63,
"category": "geography",
"type": "none",
"text": "What is the deepest ocean trench in the world?",
"answer": "The Mariana Trench"
},
{
"id": 64,
"category": "geography",
"type": "none",
"text": "Which U.S. state is the largest by area?",
"answer": "Alaska"
},
{
"id": 65,
"category": "geography",
"type": "none",
"text": "What is the capital city of Canada?",
"answer": "Ottawa"
},
{
"id": 66,
"category": "geography",
"type": "none",
"text": "Which river is the longest in Europe?",
"answer": "The Volga River"
},
{
"id": 67,
"category": "geography",
"type": "none",
"text": "Which continent has the most countries?",
"answer": "Africa"
},
{
"id": 68,
"category": "geography",
"type": "none",
"text": "What is the capital of Brazil?",
"answer": "Brasília"
},
{
"id": 69,
"category": "geography",
"type": "none",
"text": "What is the official language of Egypt?",
"answer": "Arabic"
},
{
"id": 70,
"category": "geography",
"type": "none",
"text": "Which ocean is the largest by surface area?",
"answer": "The Pacific Ocean"
},
{
"id": 71,
"category": "geography",
"type": "none",
"text": "What is the name of the sea bordered by Europe to the north and Africa to the south?",
"answer": "The Mediterranean Sea"
},
{
"id": 72,
"category": "geography",
"type": "none",
"text": "Which country has the most islands?",
"answer": "Sweden"
},
{
"id": 73,
"category": "geography",
"type": "none",
"text": "What is the largest country in South America?",
"answer": "Brazil"
},
{
"id": 74,
"category": "geography",
"type": "none",
"text": "What is the longest mountain range in the world?",
"answer": "The Andes"
},
{
"id": 75,
"category": "geography",
"type": "none",
"text": "What is the capital city of Russia?",
"answer": "Moscow"
},
{
"id": 76,
"category": "geography",
"type": "none",
"text": "What is the largest desert in Asia?",
"answer": "The Gobi Desert"
},
{
"id": 77,
"category": "geography",
"type": "none",
"text": "What is the capital of Kenya?",
"answer": "Nairobi"
},
{
"id": 78,
"category": "geography",
"type": "none",
"text": "Which country is the smallest in Europe by land area?",
"answer": "Vatican City"
},
{
"id": 79,
"category": "geography",
"type": "none",
"text": "Which river forms part of the border between Mexico and the United States?",
"answer": "The Rio Grande"
},
{
"id": 80,
"category": "geography",
"type": "none",
"text": "What is the capital city of South Korea?",
"answer": "Seoul"
},
{
"id": 81,
"category": "geography",
"type": "none",
"text": "What is the largest country in Africa by land area?",
"answer": "Algeria"
},
{
"id": 82,
"category": "geography",
"type": "none",
"text": "Which country is known as the Land of the Maple Leaf?",
"answer": "Canada"
},
{
"id": 83,
"category": "geography",
"type": "none",
"text": "Which river is the longest in Asia?",
"answer": "The Yangtze River"
},
{
"id": 84,
"category": "geography",
"type": "none",
"text": "What is the capital city of India?",
"answer": "New Delhi"
},
{
"id": 85,
"category": "geography",
"type": "none",
"text": "Which ocean lies on the east coast of the United States?",
"answer": "The Atlantic Ocean"
},
{
"id": 86,
"category": "geography",
"type": "none",
"text": "What is the capital city of Italy?",
"answer": "Rome"
},
{
"id": 87,
"category": "geography",
"type": "none",
"text": "Which river is the main river that flows through Paris?",
"answer": "The Seine"
},
{
"id": 88,
"category": "geography",
"type": "none",
"text": "What is the smallest ocean in the world?",
"answer": "The Arctic Ocean"
},
{
"id": 89,
"category": "geography",
"type": "none",
"text": "What is the capital city of Mexico?",
"answer": "Mexico City"
},
{
"id": 90,
"category": "geography",
"type": "none",
"text": "Which country is known for its unique wildlife and has the Great Barrier Reef?",
"answer": "Australia"
},
{
"id": 91,
"category": "geography",
"type": "none",
"text": "What is the capital of Argentina?",
"answer": "Buenos Aires"
},
{
"id": 92,
"category": "geography",
"type": "none",
"text": "Which country has the largest population in the world?",
"answer": "China"
},
{
"id": 93,
"category": "geography",
"type": "none",
"text": "What is the capital city of the United Kingdom?",
"answer": "London"
},
{
"id": 94,
"category": "geography",
"type": "none",
"text": "Which continent is known as the birthplace of humanity?",
"answer": "Africa"
},
{
"id": 95,
"category": "geography",
"type": "none",
"text": "What is the capital city of Thailand?",
"answer": "Bangkok"
},
{
"id": 96,
"category": "geography",
"type": "none",
"text": "What is the capital of Egypt?",
"answer": "Cairo"
},
{
"id": 97,
"category": "geography",
"type": "none",
"text": "Which country is home to the Amazon Rainforest?",
"answer": "Brazil"
},
{
"id": 98,
"category": "geography",
"type": "none",
"text": "What is the capital city of Spain?",
"answer": "Madrid"
},
{
"id": 99,
"category": "geography",
"type": "none",
"text": "What is the currency of Japan?",
"answer": "Yen"
},
{
"id": 100,
"category": "geography",
"type": "none",
"text": "Which country is known as the Land of Fire and Ice?",
"answer": "Iceland"
}
]

View file

@ -1,6 +1,7 @@
import { ReactComponentElement, ReactNode } from "react"; import { ReactComponentElement, ReactNode } from "react";
import { AnswerType, Question } from "../lib/question"; import { AnswerType, Question } from "../lib/question";
import { SessionState } from "../lib/session"; import { SessionState } from "../lib/session";
import { CheckCircleIcon, XCircleIcon } from "@heroicons/react/24/outline";
const QuestionView = ({ question, setState, state }: { question: Question, setState: any, state: SessionState }) => { const QuestionView = ({ question, setState, state }: { question: Question, setState: any, state: SessionState }) => {
@ -54,7 +55,25 @@ const QuestionView = ({ question, setState, state }: { question: Question, setSt
</div> </div>
</div>) : (<button className="text-sm font-semibold leading-6 text-gray-200" onClick={handleOpenClick}> </div>) : (<button className="text-sm font-semibold leading-6 text-gray-200" onClick={handleOpenClick}>
Show answer Show answer
</button>)} </button>
<div className="mt-10 flex items-center justify-center gap-x-6">
<button
onClick={() => { handleAnswerClick( true )}}
className="rounded-md bg-green-600 px-3.5 py-2.5 text-xs font-semibold text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
style={{width:'30%', height:'30%'}}
>
<CheckCircleIcon></CheckCircleIcon>
I knew that!
</button>
<button
onClick={() => {handleAnswerClick( false )}}
className="rounded-md bg-red-600 px-3.5 py-2.5 text-xs font-semibold text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
style={{width:'30%', height:'30%'}}
>
<XCircleIcon></XCircleIcon>
I didn't know that!
</button>
</div>
</div> </div>
</div> </div>
) )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 258 KiB

View file

@ -18,8 +18,7 @@ const Page = ({ params }: { params: { category: string }}) => {
right: 0, right: 0,
category: '', category: '',
opened: [], opened: [],
answer: [], answer: []
index: 0
} ); } );
// const category = params.category; // const category = params.category;

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB