// Initialize dark mode
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.classList.add('dark');
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
if (event.matches) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
});
// Fetch the test data
async function fetchTestData() {
try {
// Show loading indicator
document.getElementById('passageContent').innerHTML = `
`;
let result = await window.Poe.sendUserMessage(
"@Claude-3.7-Sonnet Generate three IELTS Academic Reading passages with questions in JSON format. Each passage should have questions for a total of 40 questions across all three passages. Include various question types (multiple choice, matching, completion, etc.). Your response should ONLY contain valid JSON in this format: { \"tests\": [ { \"title\": \"Test 1\", \"passages\": [ { \"title\": \"Passage 1 Title\", \"text\": \"The text of the passage...\", \"questions\": [ { \"id\": 1, \"type\": \"multiple_choice\", \"question\": \"Question text\", \"options\": [\"A\", \"B\", \"C\", \"D\"], \"answer\": \"A\", \"explanation\": \"Why this is the answer\" } ] } ] } ] }",
{
stream: false,
openChat: false
}
);
// Parse the result from the Claude response
// For now, we'll use placeholder data until we implement the integration
initializeApp(testData);
} catch (error) {
console.error("Error fetching test data:", error);
document.getElementById('passageContent').innerHTML = `
Error loading test data. Please try again.
`;
// Initialize with placeholder data
initializeApp(testData);
}
}
// Test data placeholder
const testData = {
"tests": [
{
"title": "Academic Test 1",
"passages": [
{
"title": "The Enigma of Sleep",
"text": "Sleep remains one of the most mysterious aspects of human biology, despite decades of intensive research. Scientists have made considerable progress in understanding the mechanisms of sleep, but fundamental questions about its purpose and function continue to puzzle researchers.\n\nFor many years, sleep was viewed as a passive state, a simple shutting down of the conscious mind to allow the body to rest. However, modern research has revealed that sleep is a complex, active process vital for physical health, cognitive function, and emotional well-being. The brain undergoes distinct patterns of activity during sleep, cycling through several stages with different characteristics.\n\nSleep is broadly divided into two main types: Rapid Eye Movement (REM) sleep and Non-REM sleep. During REM sleep, the brain becomes highly active, similar to its state during wakefulness, while the body experiences temporary paralysis. This is when most dreaming occurs. Non-REM sleep is further divided into three stages, with the deepest stage (slow-wave sleep) believed to be crucial for physical restoration.\n\nOne of the most compelling theories about sleep's purpose is that it allows the brain to consolidate memories. During sleep, the brain appears to process information acquired during the day, strengthening important neural connections while pruning away less useful ones. This is supported by studies showing that people perform better on memory tasks after a good night's sleep.\n\nAnother theory suggests that sleep serves a metabolic function, allowing the body to conserve energy. When asleep, the body's metabolism slows, reducing calorie consumption. Sleep also appears to be important for immune function, with studies showing that sleep-deprived individuals are more susceptible to infectious diseases.\n\nSleep may also provide an opportunity for the brain to clear waste products that accumulate during wakefulness. Research has identified a 'glymphatic system' that becomes more active during sleep, flushing away proteins that might otherwise build up and cause neurodegenerative diseases.\n\nDespite these advances in understanding, the question of why sleep evolved remains controversial. All animals appear to require some form of sleep, suggesting it serves a fundamental biological need. However, sleep also represents a period of vulnerability, when animals are less aware of their surroundings and potentially more susceptible to predators. This evolutionary paradox has led some researchers to suggest that sleep must serve functions so important that they outweigh this considerable risk.\n\nThe amount of sleep required varies significantly between species. Large mammals like elephants may sleep as little as 3-4 hours per day, while bats can sleep for up to 20 hours. Humans generally need between 7-9 hours of sleep, though individual requirements vary. Interestingly, some marine mammals can sleep with only one half of their brain at a time, allowing them to continue swimming and surfacing to breathe.\n\nSleep patterns also change throughout an individual's lifetime. Newborns spend up to 17 hours asleep each day, with about half of that time in REM sleep. As people age, they typically need less sleep, and the proportion of time spent in deep sleep decreases. Elderly people often experience fragmented sleep, with more frequent awakenings during the night.\n\nModern society has created unprecedented challenges to healthy sleep patterns. Artificial lighting, electronic devices, irregular work schedules, and increased stress levels have all contributed to widespread sleep problems. It's estimated that about one-third of adults regularly get less than the recommended amount of sleep, leading some researchers to suggest we are experiencing a 'global sleep crisis.'\n\nThe consequences of chronic sleep deprivation are serious and wide-ranging. Short-term effects include impaired attention, memory, and decision-making. Long-term sleep deprivation is associated with increased risk of numerous health problems, including obesity, diabetes, cardiovascular disease, and depression. Some studies even suggest that severe sleep deprivation can be fatal.\n\nAs our understanding of sleep grows, so too does the recognition of its fundamental importance to health. Sleep is increasingly viewed not as a luxury or a sign of laziness, but as a biological necessity on par with proper nutrition and regular exercise. Future research may uncover even more about this enigmatic but essential aspect of human biology.",
"questions": [
{
"id": 1,
"type": "multiple_choice",
"question": "According to the passage, what was the traditional view of sleep?",
"options": [
"A complex neurological process",
"A passive state where the body rests",
"A time when memories are consolidated",
"A period of brain hyperactivity"
],
"answer": "A passive state where the body rests",
"explanation": "The passage states that 'For many years, sleep was viewed as a passive state, a simple shutting down of the conscious mind to allow the body to rest.'"
},
{
"id": 2,
"type": "multiple_choice",
"question": "Which of the following is NOT mentioned as a theory about the purpose of sleep?",
"options": [
"Memory consolidation",
"Energy conservation",
"Waste product clearance",
"Hormone regulation"
],
"answer": "Hormone regulation",
"explanation": "The passage mentions memory consolidation, energy conservation, and waste product clearance as theories about sleep's purpose, but does not specifically mention hormone regulation."
},
{
"id": 3,
"type": "true_false_notgiven",
"question": "Some marine mammals can sleep with only half their brain at a time.",
"options": ["TRUE", "FALSE", "NOT GIVEN"],
"answer": "TRUE",
"explanation": "The passage states that 'some marine mammals can sleep with only one half of their brain at a time, allowing them to continue swimming and surfacing to breathe.'"
},
{
"id": 4,
"type": "matching",
"question": "Match the following sleep types with their characteristics.",
"items": [
"REM sleep",
"Non-REM sleep",
"Slow-wave sleep"
],
"options": [
"A. When most dreaming occurs",
"B. Divided into three different stages",
"C. Considered crucial for physical restoration",
"D. Characterized by decreased brain activity",
"E. Accompanied by temporary body paralysis"
],
"answers": {
"REM sleep": ["A", "E"],
"Non-REM sleep": ["B"],
"Slow-wave sleep": ["C"]
},
"explanation": "The passage states that REM sleep is when most dreaming occurs and involves temporary paralysis. Non-REM sleep is divided into three stages, and slow-wave sleep (the deepest stage of Non-REM) is crucial for physical restoration."
},
{
"id": 5,
"type": "completion",
"question": "According to the passage, newborns spend approximately _______ hours sleeping each day.",
"answer": "17",
"explanation": "The passage states that 'Newborns spend up to 17 hours asleep each day.'"
},
{
"id": 6,
"type": "completion",
"question": "The 'glymphatic system' becomes more active during sleep to _______ from the brain.",
"answer": "clear waste products",
"explanation": "The passage mentions that 'Research has identified a 'glymphatic system' that becomes more active during sleep, flushing away proteins that might otherwise build up and cause neurodegenerative diseases.'"
},
{
"id": 7,
"type": "multiple_choice",
"question": "What is described as an 'evolutionary paradox' regarding sleep?",
"options": [
"Different species require different amounts of sleep",
"Sleep has evolved despite making animals more vulnerable to predators",
"Some marine mammals can sleep with half their brain",
"Humans need more sleep than larger mammals"
],
"answer": "Sleep has evolved despite making animals more vulnerable to predators",
"explanation": "The passage describes the evolutionary paradox as sleep representing 'a period of vulnerability, when animals are less aware of their surroundings and potentially more susceptible to predators.'"
},
{
"id": 8,
"type": "completion",
"question": "The text suggests that about _______ of adults regularly get less than the recommended amount of sleep.",
"answer": "one-third",
"explanation": "The passage states that 'It's estimated that about one-third of adults regularly get less than the recommended amount of sleep.'"
},
{
"id": 9,
"type": "multiple_choice",
"question": "According to the passage, what happens to sleep patterns as people age?",
"options": [
"They need more sleep",
"They spend more time in deep sleep",
"Their sleep becomes more fragmented",
"Their REM sleep increases"
],
"answer": "Their sleep becomes more fragmented",
"explanation": "The passage states that 'Elderly people often experience fragmented sleep, with more frequent awakenings during the night.'"
},
{
"id": 10,
"type": "true_false_notgiven",
"question": "The passage suggests that adequate sleep is as important as proper nutrition and exercise.",
"options": ["TRUE", "FALSE", "NOT GIVEN"],
"answer": "TRUE",
"explanation": "The passage states that 'Sleep is increasingly viewed not as a luxury or a sign of laziness, but as a biological necessity on par with proper nutrition and regular exercise.'"
},
{
"id": 11,
"type": "summary_completion",
"question": "Complete the summary using words from the text.\n\nSleep, once thought to be a _______ state, is now understood to be a complex, active process. Research has identified different types of sleep, including REM and Non-REM sleep, with the former being associated with _______. Scientists have proposed several theories about sleep's function, including memory _______, energy _______, and the clearance of _______. Despite being a period of _______ for animals, sleep appears to be essential for all species, suggesting it serves fundamental biological needs. Modern society has created challenges to healthy sleep patterns, resulting in what some researchers call a global sleep _______.",
"answers": [
"passive",
"dreaming",
"consolidation",
"conservation",
"waste products",
"vulnerability",
"crisis"
],
"explanation": "These terms are all used in the passage to describe sleep and its functions."
},
{
"id": 12,
"type": "multiple_choice",
"question": "Which of the following is NOT mentioned as a consequence of chronic sleep deprivation?",
"options": [
"Impaired memory",
"Increased risk of obesity",
"Cardiovascular disease",
"Reduced life expectancy"
],
"answer": "Reduced life expectancy",
"explanation": "While the passage mentions many health consequences of sleep deprivation including impaired memory, obesity, and cardiovascular disease, it does not specifically mention reduced life expectancy, although it does note that severe sleep deprivation can be fatal."
}
]
},
{
"title": "Urban Agriculture: Growing Food in Cities",
"text": "Urban agriculture—the practice of cultivating, processing, and distributing food in or around urban areas—has gained significant momentum in recent years. As cities continue to expand and global food security concerns intensify, growing food in urban environments offers innovative solutions to numerous challenges facing modern society.\n\nHistorically, cities and agriculture developed in tandem, with settlements often forming in fertile regions to ensure food supply. The industrial revolution and subsequent urbanization gradually separated food production from population centers, creating the distinct urban-rural divide familiar today. However, urban agriculture has deep historical roots. During World War II, 'victory gardens' in cities across the United States, United Kingdom, and other nations produced substantial amounts of fruits and vegetables to supplement wartime food shortages. In many developing countries, urban farming has been a continuous tradition born of necessity rather than choice.\n\nThe modern urban agriculture movement encompasses diverse models. Community gardens provide space for individuals to grow food while fostering social connections. Rooftop gardens and farms utilize otherwise unused space and can offer environmental benefits such as improved building insulation and reduced stormwater runoff. Indoor vertical farms use stacked growing systems and controlled environment agriculture to maximize production in limited spaces. Technological innovations including hydroponics (growing plants in nutrient-rich water instead of soil), aeroponics (growing plants with roots suspended in air and misted with nutrients), and aquaponics (combining fish farming with hydroponics) are increasingly employed in urban settings.\n\nUrban agriculture offers numerous potential benefits. From a food security perspective, it can improve access to fresh produce in 'food deserts'—areas where affordable, nutritious food is difficult to obtain. Local food production reduces the distance food travels from farm to table, potentially lowering fossil fuel consumption and associated greenhouse gas emissions from transportation. Urban farms can transform vacant lots into productive green spaces, improving neighborhood aesthetics and property values while reducing urban blight. The presence of gardens and farms in cities also increases biodiversity, creating habitats for beneficial insects, birds, and other wildlife.\n\nBeyond these environmental benefits, urban agriculture offers significant social advantages. Community gardens often become neighborhood hubs, strengthening social ties and community cohesion. Growing food can provide meaningful activity for diverse populations, including youth, elderly residents, and those with physical or mental health challenges. Educational urban farms teach valuable skills and connect people, particularly children, with the source of their food, potentially encouraging healthier eating habits. In some contexts, urban agriculture initiatives create training and employment opportunities, particularly in low-income areas.\n\nDespite these benefits, urban agriculture faces substantial challenges. Land availability and access in densely populated areas present obvious obstacles, with urban real estate values often making farmland financially unfeasible. Soil contamination from previous industrial uses is common in many urban areas, requiring remediation or alternative growing methods. Water access and cost can be problematic, particularly in regions experiencing drought conditions. Many cities have zoning regulations and ordinances that restrict agricultural activities, though many municipalities are revising these rules to accommodate urban farming.\n\nResource limitations also present challenges. Urban farms typically operate on a smaller scale than rural agriculture, potentially limiting economic viability. While some high-value specialty crops or technological growing systems can generate significant revenue, many urban agriculture projects rely on grants, subsidies, or volunteer labor to remain operational. Critics question whether urban agriculture can meaningfully address food security concerns given these limitations.\n\nThe environmental impacts of urban agriculture are complex. While local production can reduce transportation emissions, some urban growing methods—particularly controlled environment agriculture with artificial lighting—require significant energy inputs. The carbon footprint of these systems depends largely on the source of electricity used. Water use efficiency varies widely between different urban agriculture models. Additionally, nutrient management in urban systems can be challenging, with potential for pollution from fertilizer runoff if not properly managed.\n\nDespite these challenges, innovation in urban agriculture continues at a rapid pace. Entrepreneurs and engineers are developing increasingly sophisticated indoor farming systems that optimize resource use while maximizing yields. Architects are integrating food production into building design, creating 'edible architecture' that merges the built environment with food systems. Policy advocates work to reform regulations and create incentives for urban food production. Community organizations develop models for inclusive, accessible urban agriculture that addresses social equity concerns.\n\nAs the world continues to urbanize, with projections suggesting that nearly 70% of the global population will live in urban areas by 2050, the role of urban agriculture is likely to expand. While it cannot completely replace conventional rural agriculture, urban food production represents an important complement to existing food systems. By reconnecting cities with food production, urban agriculture offers possibilities for creating more resilient, sustainable, and healthy communities in an increasingly urbanized world.\n\nThe future of urban agriculture will likely involve both high-tech and community-based approaches, each addressing different aspects of the complex relationship between cities and food. Balancing innovation with accessibility, environmental sustainability with economic viability, and scale with social impact remains the central challenge—and opportunity—for urban agriculture in the 21st century.",
"questions": [
{
"id": 13,
"type": "multiple_choice",
"question": "According to the passage, when did 'victory gardens' emerge?",
"options": [
"During the industrial revolution",
"In the early 20th century",
"During World War II",
"In the 21st century"
],
"answer": "During World War II",
"explanation": "The passage states that 'During World War II, 'victory gardens' in cities across the United States, United Kingdom, and other nations produced substantial amounts of fruits and vegetables to supplement wartime food shortages.'"
},
{
"id": 14,
"type": "matching",
"question": "Match the urban agriculture methods with their correct descriptions.",
"items": [
"Hydroponics",
"Aeroponics",
"Aquaponics"
],
"options": [
"A. Growing plants with roots suspended in air",
"B. Growing plants in soil enriched with fish waste",
"C. Growing plants in nutrient-rich water instead of soil",
"D. Combining fish farming with plant cultivation",
"E. Growing plants in vertical stacks"
],
"answers": {
"Hydroponics": ["C"],
"Aeroponics": ["A"],
"Aquaponics": ["D"]
},
"explanation": "The passage defines hydroponics as 'growing plants in nutrient-rich water instead of soil', aeroponics as 'growing plants with roots suspended in air and misted with nutrients', and aquaponics as 'combining fish farming with hydroponics'."
},
{
"id": 15,
"type": "true_false_notgiven",
"question": "According to the passage, urban agriculture is more environmentally friendly than rural agriculture.",
"options": ["TRUE", "FALSE", "NOT GIVEN"],
"answer": "NOT GIVEN",
"explanation": "The passage discusses various environmental impacts of urban agriculture, both positive and negative, but does not make a direct comparison stating whether it is more environmentally friendly than rural agriculture overall."
},
{
"id": 16,
"type": "completion",
"question": "Areas where affordable, nutritious food is difficult to obtain are called _______.",
"answer": "food deserts",
"explanation": "The passage states that urban agriculture can 'improve access to fresh produce in 'food deserts'—areas where affordable, nutritious food is difficult to obtain.'"
},
{
"id": 17,
"type": "multiple_choice",
"question": "According to the passage, what percentage of the global population is projected to live in urban areas by 2050?",
"options": [
"50%",
"60%",
"70%",
"80%"
],
"answer": "70%",
"explanation": "The passage states 'with projections suggesting that nearly 70% of the global population will live in urban areas by 2050.'"
},
{
"id": 18,
"type": "matching",
"question": "Match the challenges of urban agriculture with their descriptions.",
"items": [
"Land challenges",
"Environmental challenges",
"Economic challenges"
],
"options": [
"A. High real estate values",
"B. Energy requirements for artificial lighting",
"C. Reliance on grants and subsidies",
"D. Soil contamination from industrial uses",
"E. Limited scale of operations",
"F. Restrictive zoning regulations"
],
"answers": {
"Land challenges": ["A", "D", "F"],
"Environmental challenges": ["B", "D"],
"Economic challenges": ["C", "E"]
},
"explanation": "The passage groups these challenges in its discussion: land challenges include real estate values, soil contamination, and zoning; environmental challenges include energy use and soil contamination; economic challenges include reliance on grants and limited scale."
},
{
"id": 19,
"type": "true_false_notgiven",
"question": "The passage suggests that urban agriculture will completely replace conventional rural agriculture in the future.",
"options": ["TRUE", "FALSE", "NOT GIVEN"],
"answer": "FALSE",
"explanation": "The passage explicitly states that urban agriculture 'cannot completely replace conventional rural agriculture' but represents 'an important complement to existing food systems.'"
},
{
"id": 20,
"type": "completion",
"question": "According to the passage, community gardens can function as neighborhood _______, strengthening social connections.",
"answer": "hubs",
"explanation": "The passage states that 'Community gardens often become neighborhood hubs, strengthening social ties and community cohesion.'"
},
{
"id": 21,
"type": "multiple_choice",
"question": "Which of the following is NOT mentioned as a model of urban agriculture in the passage?",
"options": [
"Community gardens",
"Rooftop farms",
"Vertical farms",
"Underground farms"
],
"answer": "Underground farms",
"explanation": "The passage mentions community gardens, rooftop gardens/farms, and indoor vertical farms, but does not specifically mention underground farms."
},
{
"id": 22,
"type": "multiple_choice",
"question": "According to the passage, what term describes the integration of food production into building design?",
"options": [
"Vertical gardening",
"Green architecture",
"Edible architecture",
"Urban integration"
],
"answer": "Edible architecture",
"explanation": "The passage states that 'Architects are integrating food production into building design, creating 'edible architecture' that merges the built environment with food systems.'"
},
{
"id": 23,
"type": "summary_completion",
"question": "Complete the summary using words from the passage:\n\nUrban agriculture has historical roots, with _______ gardens during World War II being a notable example. The modern movement includes various models like community gardens, _______ farms, and indoor vertical farms. Urban farming offers benefits such as improving food access in _______, reducing transportation emissions, transforming vacant lots, and increasing urban _______. Social advantages include creating community _______ and providing educational opportunities. However, challenges exist, including limited land availability, soil _______, water access issues, and restrictive _______. While some urban farming operations can be profitable with high-value crops, many rely on _______ or volunteer labor to remain viable. Despite these challenges, innovations continue, with projections that about _______ of the global population will live in urban areas by 2050, likely expanding urban agriculture's role.",
"answers": [
"victory",
"rooftop",
"food deserts",
"biodiversity",
"hubs",
"contamination",
"zoning regulations",
"grants",
"70%"
],
"explanation": "These terms all appear in the passage in the context described in the summary."
},
{
"id": 24,
"type": "multiple_choice",
"question": "According to the passage, what is the primary reason urban agriculture has been a continuous tradition in many developing countries?",
"options": [
"Cultural preferences",
"Government initiatives",
"Necessity",
"Environmental concerns"
],
"answer": "Necessity",
"explanation": "The passage states that 'In many developing countries, urban farming has been a continuous tradition born of necessity rather than choice.'"
}
]
},
{
"title": "Artificial Intelligence in Healthcare",
"text": "The integration of artificial intelligence (AI) into healthcare represents one of the most promising applications of this rapidly evolving technology. From diagnostic assistance to drug discovery, AI is transforming medical practice and offering solutions to longstanding healthcare challenges. However, the adoption of these technologies also raises important technical, ethical, and practical questions that must be addressed for AI to realize its full potential in healthcare settings.\n\nAt its core, AI refers to computer systems capable of performing tasks that typically require human intelligence. In healthcare, these systems often utilize machine learning (ML), a subset of AI where algorithms learn patterns from data rather than following explicitly programmed instructions. Deep learning, a specialized form of machine learning using neural networks with multiple layers, has proven particularly effective for medical applications involving complex pattern recognition, such as analyzing medical images or processing natural language in clinical notes.\n\nOne of the most developed applications of AI in healthcare is medical imaging analysis. AI systems have demonstrated remarkable ability to identify patterns in radiological images, often matching or exceeding human performance in detecting conditions such as diabetic retinopathy, certain cancers, and fractures. These systems can assist radiologists by flagging suspicious findings for review, potentially reducing diagnostic errors and improving efficiency. Similarly, AI tools for analyzing pathology slides can help pathologists identify cellular abnormalities that might indicate cancer or other diseases.\n\nBeyond imaging, AI is transforming diagnostics through various other applications. Natural language processing (NLP) techniques can extract and organize relevant information from clinical notes, potentially identifying patterns that might otherwise remain undetected. Machine learning algorithms can analyze data from wearable devices or bedside monitors to detect subtle changes in patient status that may precede critical events, enabling earlier intervention. Chatbots and virtual assistants using AI can help with initial patient screening, collecting symptom information before clinical visits to improve efficiency.\n\nIn pharmaceutical research, AI is accelerating drug discovery by predicting how different compounds might interact with biological targets, significantly reducing the time and resources required to identify promising candidates for further testing. Machine learning models can identify potential therapeutic applications for existing drugs, a process known as drug repurposing. AI systems are also being developed to design novel treatment molecules specifically tailored to target particular disease mechanisms.\n\nPersonalized medicine—healthcare customized to individual patients based on their unique genetic, environmental, and lifestyle factors—stands to benefit tremendously from AI capabilities. By analyzing vast datasets that include genomic information, medical records, and lifestyle data, AI can help identify which treatments are likely to be most effective for specific patients, potentially improving outcomes while reducing adverse effects. These approaches are particularly promising in oncology, where tumors with identical appearances may respond differently to treatments based on their molecular characteristics.\n\nOperational applications of AI in healthcare focus on improving system efficiency and resource allocation. Predictive models can forecast patient admission rates, helping hospitals optimize staffing and resource allocation. Machine learning algorithms can identify inefficiencies in clinical workflows or administrative processes. AI-based scheduling systems can reduce wait times and improve access to care. Such applications may be less visible to patients than diagnostic tools but have significant potential to reduce healthcare costs and improve service delivery.\n\nDespite these promising applications, AI in healthcare faces substantial implementation challenges. Data quality and availability present fundamental obstacles, as machine learning algorithms require large, high-quality, and representative datasets to perform reliably. Many healthcare datasets are fragmented, incomplete, or contain biases that may be perpetuated or amplified by AI systems. Interoperability issues between different electronic health record systems and other digital platforms further complicate data integration efforts.\n\nRegulatory frameworks for AI medical applications continue to evolve, creating uncertainty for developers and healthcare providers. Traditional approval processes for medical devices may be inadequate for AI systems that continuously learn and adapt based on new data. Questions about liability when AI systems contribute to medical decisions remain largely unresolved. Privacy concerns are particularly acute given the sensitive nature of health data and the potential for unauthorized access or misuse.\n\nAt a practical level, integrating AI tools into existing clinical workflows presents significant challenges. Healthcare professionals may resist technologies they perceive as threatening their autonomy or adding to their workload. Without sufficient training, clinicians may struggle to interpret AI outputs appropriately or may experience 'automation bias,' over-relying on AI recommendations. Technical infrastructure limitations, especially in resource-constrained settings, may prevent adoption of computationally intensive AI applications.\n\nEthical considerations surrounding AI in healthcare are particularly complex. Algorithmic bias may lead to AI systems that perform differently across demographic groups, potentially exacerbating existing healthcare disparities. The 'black box' nature of some complex AI systems makes it difficult to understand how they reach specific conclusions, raising concerns about transparency and trust. Questions about appropriate levels of human oversight and intervention when using AI systems remain contentious and context-dependent.\n\nDespite these challenges, the trajectory of AI in healthcare appears increasingly clear. Rather than replacing healthcare professionals, successful AI applications will likely augment human capabilities, handling routine tasks while allowing clinicians to focus on aspects of care requiring uniquely human skills such as empathy, complex reasoning, and ethical judgment. The most promising approach views AI not as a substitute for human expertise but as a tool that, when properly developed and deployed, can help healthcare professionals provide better, more efficient, and more accessible care.\n\nAs AI continues to advance, its integration into healthcare will require ongoing collaboration between technologists, healthcare professionals, patients, ethicists, and policymakers. By addressing implementation challenges thoughtfully and prioritizing ethical considerations, AI has the potential to significantly improve healthcare delivery and outcomes, ultimately benefiting patients and providers alike.",
"questions": [
{
"id": 25,
"type": "multiple_choice",
"question": "According to the passage, which type of machine learning has proven particularly effective for medical image analysis?",
"options": [
"Supervised learning",
"Reinforcement learning",
"Federated learning",
"Deep learning"
],
"answer": "Deep learning",
"explanation": "The passage states that 'Deep learning, a specialized form of machine learning using neural networks with multiple layers, has proven particularly effective for medical applications involving complex pattern recognition, such as analyzing medical images.'"
},
{
"id": 26,
"type": "true_false_notgiven",
"question": "The passage suggests that AI will eventually replace healthcare professionals entirely.",
"options": ["TRUE", "FALSE", "NOT GIVEN"],
"answer": "FALSE",
"explanation": "The passage explicitly states that 'Rather than replacing healthcare professionals, successful AI applications will likely augment human capabilities' and describes AI as 'not as a substitute for human expertise but as a tool.'"
},
{
"id": 27,
"type": "matching",
"question": "Match the AI applications with their corresponding healthcare areas.",
"items": [
"Natural language processing",
"Predictive models",
"Machine learning in pharmaceutical research"
],
"options": [
"A. Analyzing patient monitor data to detect status changes",
"B. Extracting information from clinical notes",
"C. Forecasting hospital admission rates",
"D. Identifying drug repurposing opportunities",
"E. Detecting patterns in radiological images"
],
"answers": {
"Natural language processing": ["B"],
"Predictive models": ["C"],
"Machine learning in pharmaceutical research": ["D"]
},
"explanation": "According to the passage, NLP extracts information from clinical notes, predictive models forecast admission rates, and machine learning in pharmaceutical research identifies drug repurposing opportunities."
},
{
"id": 28,
"type": "completion",
"question": "According to the passage, the process of finding new uses for existing drugs is called drug _______.",
"answer": "repurposing",
"explanation": "The passage states that 'Machine learning models can identify potential therapeutic applications for existing drugs, a process known as drug repurposing.'"
},
{
"id": 29,
"type": "multiple_choice",
"question": "Which of the following is NOT mentioned as a challenge for implementing AI in healthcare?",
"options": [
"Data quality and availability",
"Regulatory uncertainty",
"Integration into clinical workflows",
"High patient rejection rates"
],
"answer": "High patient rejection rates",
"explanation": "The passage discusses challenges related to data quality, regulatory frameworks, and clinical workflow integration, but does not mention high patient rejection rates as a specific challenge."
},
{
"id": 30,
"type": "true_false_notgiven",
"question": "According to the passage, AI systems for medical imaging have consistently outperformed human radiologists.",
"options": ["TRUE", "FALSE", "NOT GIVEN"],
"answer": "FALSE",
"explanation": "The passage states that AI systems have 'often matching or exceeding human performance' in detecting certain conditions, which indicates that they don't consistently outperform humans in all situations."
},
{
"id": 31,
"type": "multiple_choice",
"question": "What term does the passage use to describe healthcare customized to individual patients based on their unique factors?",
"options": [
"Precision medicine",
"Personalized medicine",
"Targeted therapy",
"Individualized care"
],
"answer": "Personalized medicine",
"explanation": "The passage explicitly defines 'Personalized medicine' as 'healthcare customized to individual patients based on their unique genetic, environmental, and lifestyle factors.'"
},
{
"id": 32,
"type": "matching",
"question": "Match the ethical concerns with their descriptions as mentioned in the passage.",
"items": [
"Algorithmic bias",
"Black box problem",
"Automation bias"
],
"options": [
"A. Difficulty understanding how AI systems reach specific conclusions",
"B. Over-reliance on AI recommendations by clinicians",
"C. Performance differences across demographic groups",
"D. Unauthorized access to sensitive health data",
"E. Replacement of human judgment in critical decisions"
],
"answers": {
"Algorithmic bias": ["C"],
"Black box problem": ["A"],
"Automation bias": ["B"]
},
"explanation": "The passage defines algorithmic bias as leading to 'performance differences across demographic groups,' describes the black box nature as making it 'difficult to understand how they reach specific conclusions,' and automation bias as 'over-relying on AI recommendations.'"
},
{
"id": 33,
"type": "completion",
"question": "AI tools using _______ language processing can extract information from clinical notes.",
"answer": "natural",
"explanation": "The passage states that 'Natural language processing (NLP) techniques can extract and organize relevant information from clinical notes.'"
},
{
"id": 34,
"type": "multiple_choice",
"question": "According to the passage, what is the most promising approach to viewing AI in healthcare?",
"options": [
"As a replacement for human practitioners",
"As a tool that augments human capabilities",
"As a solution primarily for administrative tasks",
"As a technology best used in research settings"
],
"answer": "As a tool that augments human capabilities",
"explanation": "The passage states that 'The most promising approach views AI not as a substitute for human expertise but as a tool that, when properly developed and deployed, can help healthcare professionals provide better, more efficient, and more accessible care.'"
},
{
"id": 35,
"type": "summary_completion",
"question": "Complete the summary using words from the passage:\n\nArtificial intelligence is transforming healthcare through various applications. In medical imaging, AI systems can match or exceed human performance in detecting conditions like diabetic _______ and certain cancers. Natural language processing extracts information from clinical _______, while machine learning algorithms can analyze data from wearable devices. In pharmaceutical research, AI accelerates drug _______ and can identify new uses for existing medications. For personalized medicine, AI analyzes datasets including _______ information to identify optimal treatments. Operational applications include predicting patient _______ rates to optimize staffing. However, implementation faces challenges including data quality issues, evolving _______ frameworks, and integration into clinical workflows. Ethical concerns include algorithmic _______, which could exacerbate healthcare disparities. Rather than replacing healthcare professionals, successful AI applications will likely augment human _______.",
"answers": [
"retinopathy",
"notes",
"discovery",
"genomic",
"admission",
"regulatory",
"bias",
"capabilities"
],
"explanation": "These terms are all found in the passage in the context described in the summary."
},
{
"id": 36,
"type": "multiple_choice",
"question": "Which medical specialty is specifically mentioned as having tumors that may respond differently to treatments based on molecular characteristics?",
"options": [
"Cardiology",
"Neurology",
"Oncology",
"Endocrinology"
],
"answer": "Oncology",
"explanation": "The passage states that 'These approaches are particularly promising in oncology, where tumors with identical appearances may respond differently to treatments based on their molecular characteristics.'"
},
{
"id": 37,
"type": "true_false_notgiven",
"question": "The passage states that AI systems for initial patient screening have been widely implemented in most hospitals.",
"options": ["TRUE", "FALSE", "NOT GIVEN"],
"answer": "NOT GIVEN",
"explanation": "The passage mentions that 'Chatbots and virtual assistants using AI can help with initial patient screening,' but does not provide information about how widely these systems have been implemented in hospitals."
},
{
"id": 38,
"type": "matching",
"question": "Match the types of AI with their descriptions from the passage.",
"items": [
"Artificial intelligence",
"Machine learning",
"Deep learning"
],
"options": [
"A. Computer systems that perform tasks requiring human intelligence",
"B. Processing natural language in clinical notes",
"C. Algorithms that learn patterns from data",
"D. A specialized form using neural networks with multiple layers",
"E. A technique for predicting patient admission rates"
],
"answers": {
"Artificial intelligence": ["A"],
"Machine learning": ["C"],
"Deep learning": ["D"]
},
"explanation": "The passage defines AI as 'computer systems capable of performing tasks that typically require human intelligence,' machine learning as where 'algorithms learn patterns from data,' and deep learning as 'a specialized form of machine learning using neural networks with multiple layers.'"
},
{
"id": 39,
"type": "completion",
"question": "According to the passage, the successful integration of AI into healthcare will require ongoing collaboration between technologists, healthcare professionals, patients, _______, and policymakers.",
"answer": "ethicists",
"explanation": "The passage states that 'its integration into healthcare will require ongoing collaboration between technologists, healthcare professionals, patients, ethicists, and policymakers.'"
},
{
"id": 40,
"type": "multiple_choice",
"question": "Which of the following best describes the main purpose of the passage?",
"options": [
"To argue that AI will revolutionize healthcare within the next decade",
"To warn about the dangers of using AI in medical settings",
"To explain how AI is used in healthcare and discuss associated benefits and challenges",
"To compare the effectiveness of different AI applications in medical diagnosis"
],
"answer": "To explain how AI is used in healthcare and discuss associated benefits and challenges",
"explanation": "The passage provides a comprehensive overview of various AI applications in healthcare, their benefits, and the challenges and ethical considerations associated with their implementation, making this the most accurate description of its purpose."
}
]
}
]
},
{
"title": "Academic Test 2",
"passages": [
{
"title": "The Decline of Bees",
"text": "Placeholder for Test 2, Passage 1",
"questions": []
},
{
"title": "The Evolution of Writing Systems",
"text": "Placeholder for Test 2, Passage 2",
"questions": []
},
{
"title": "Underwater Archaeology",
"text": "Placeholder for Test 2, Passage 3",
"questions": []
}
]
},
{
"title": "Academic Test 3",
"passages": [
{
"title": "The Science of Decision Making",
"text": "Placeholder for Test 3, Passage 1",
"questions": []
},
{
"title": "Traditional Ecological Knowledge",
"text": "Placeholder for Test 3, Passage 2",
"questions": []
},
{
"title": "The Economics of Renewable Energy",
"text": "Placeholder for Test 3, Passage 3",
"questions": []
}
]
}
]
};
let currentTest = 0;
let currentPassage = 0;
let testStarted = false;
let testEnded = false;
let startTime;
let timerInterval;
let userAnswers = {}; // Store user answers: {questionId: userAnswer}
// DOM Elements
const testSelector = document.getElementById('testSelector');
const passageTab = document.getElementById('passageTab');
const questionsTab = document.getElementById('questionsTab');
const passageTabBtn = document.getElementById('passageTabBtn');
const questionsTabBtn = document.getElementById('questionsTabBtn');
const passageContent = document.getElementById('passageContent');
const questionsContent = document.getElementById('questionsContent');
const passageNav = document.getElementById('passageNav');
const questionNav = document.getElementById('questionNav');
const mobilePassageNav = document.getElementById('mobilePassageNav');
const mobileQuestionNav = document.getElementById('mobileQuestionNav');
const timerDisplay = document.getElementById('timerDisplay');
const mobileTimerDisplay = document.getElementById('mobileTimerDisplay');
const startButton = document.getElementById('startButton');
const endButton = document.getElementById('endButton');
const mobileStartButton = document.getElementById('mobileStartButton');
const mobileEndButton = document.getElementById('mobileEndButton');
const showAnswersButton = document.getElementById('showAnswersButton');
const mobileMenuToggle = document.getElementById('mobileMenuToggle');
const mobileNavMenu = document.getElementById('mobileNavMenu');
// Initialize the app
function initializeApp(data) {
// Set up tab navigation
passageTabBtn.addEventListener('click', () => switchTab('passage'));
questionsTabBtn.addEventListener('click', () => switchTab('questions'));
// Set up test selector
testSelector.addEventListener('change', () => {
currentTest = parseInt(testSelector.value);
resetTest();
updateUI();
});
// Set up start/end buttons
startButton.addEventListener('click', startTest);
endButton.addEventListener('click', endTest);
mobileStartButton.addEventListener('click', startTest);
mobileEndButton.addEventListener('click', endTest);
showAnswersButton.addEventListener('click', showAnswers);
// Set up mobile menu toggle
mobileMenuToggle.addEventListener('click', () => {
mobileNavMenu.classList.toggle('hidden');
});
// Initial UI update
updateUI();
}
// Switch between passage and questions tabs
function switchTab(tab) {
if (tab === 'passage') {
passageTab.classList.remove('hidden');
questionsTab.classList.add('hidden');
passageTabBtn.classList.add('text-primary', 'border-primary');
passageTabBtn.classList.remove('text-gray-500', 'dark:text-gray-400');
questionsTabBtn.classList.remove('text-primary', 'border-primary');
questionsTabBtn.classList.add('text-gray-500', 'dark:text-gray-400');
} else {
passageTab.classList.add('hidden');
questionsTab.classList.remove('hidden');
passageTabBtn.classList.remove('text-primary', 'border-primary');
passageTabBtn.classList.add('text-gray-500', 'dark:text-gray-400');
questionsTabBtn.classList.add('text-primary', 'border-primary');
questionsTabBtn.classList.remove('text-gray-500', 'dark:text-gray-400');
}
}
// Update the UI based on current state
function updateUI() {
updateNavigationUI();
updatePassageContent();
updateQuestionsContent();
}
// Update navigation UI elements
function updateNavigationUI() {
// Clear existing navigation
passageNav.innerHTML = '';
questionNav.innerHTML = '';
mobilePassageNav.innerHTML = '';
mobileQuestionNav.innerHTML = '';
const test = testData.tests[currentTest];
// Add passage navigation
test.passages.forEach((passage, index) => {
const isActive = index === currentPassage;
const passageButton = document.createElement('button');
passageButton.className = `w-full text-left px-3 py-2 rounded-md ${isActive ? 'bg-primary text-white' : 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600'}`;
passageButton.textContent = passage.title;
passageButton.addEventListener('click', () => {
currentPassage = index;
updateUI();
});
passageNav.appendChild(passageButton);
// Mobile passage nav
const mobilePassageButton = passageButton.cloneNode(true);
mobilePassageButton.addEventListener('click', () => {
currentPassage = index;
updateUI();
mobileNavMenu.classList.add('hidden');
});
mobilePassageNav.appendChild(mobilePassageButton);
});
// Add question navigation
let questionNumber = 1;
test.passages.forEach((passage, passageIndex) => {
passage.questions.forEach(question => {
const questionBtn = document.createElement('button');
const isAnswered = userAnswers[question.id] !== undefined;
const isActive = passageIndex === currentPassage && questionNumber === getFirstQuestionNumberForPassage(currentPassage);
questionBtn.className = `w-full h-full aspect-square flex items-center justify-center rounded-md text-sm font-medium ${isAnswered ? 'bg-green-500 text-white' : isActive ? 'bg-primary text-white' : 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300'}`;
questionBtn.textContent = questionNumber;
questionBtn.addEventListener('click', () => {
currentPassage = passageIndex;
switchTab('questions');
updateUI();
// Scroll to the question
const questionElement = document.getElementById(`question-${question.id}`);
if (questionElement) {
questionElement.scrollIntoView({ behavior: 'smooth' });
}
});
questionNav.appendChild(questionBtn);
// Mobile question nav
const mobileQuestionBtn = questionBtn.cloneNode(true);
mobileQuestionBtn.addEventListener('click', () => {
currentPassage = passageIndex;
switchTab('questions');
updateUI();
mobileNavMenu.classList.add('hidden');
// Scroll to the question
const questionElement = document.getElementById(`question-${question.id}`);
if (questionElement) {
questionElement.scrollIntoView({ behavior: 'smooth' });
}
});
mobileQuestionNav.appendChild(mobileQuestionBtn);
questionNumber++;
});
});
}
// Get the first question number for a passage
function getFirstQuestionNumberForPassage(passageIndex) {
let questionNumber = 1;
for (let i = 0; i < passageIndex; i++) {
questionNumber += testData.tests[currentTest].passages[i].questions.length;
}
return questionNumber;
}
// Update passage content
function updatePassageContent() {
const test = testData.tests[currentTest];
const passage = test.passages[currentPassage];
if (!testStarted) {
passageContent.innerHTML = `
IELTS Reading Test
This test contains 3 passages with a total of 40 questions.
You have 60 minutes to complete the test.
Click "Start Test" when you are ready to begin.
`;
return;
}
if (testEnded) {
passageContent.innerHTML = `
Test Completed
You have completed the test.
Click "Show Answers" to see your results.
`;
return;
}
passageContent.innerHTML = `
${passage.title}
${formatPassageText(passage.text)}
`;
}
// Format passage text with paragraph numbers
function formatPassageText(text) {
const paragraphs = text.split('\n');
return paragraphs.map(paragraph => {
if (paragraph.trim().length === 0) return '';
return `
${paragraph}
`;
}).join('');
}
// Update questions content
function updateQuestionsContent() {
const test = testData.tests[currentTest];
const passage = test.passages[currentPassage];
if (!testStarted) {
questionsContent.innerHTML = `
Test completed. Click "Show Answers" to see your results.
`;
return;
}
let questionsHTML = `
Questions for: ${passage.title}
`;
passage.questions.forEach(question => {
const questionNumber = calculateQuestionNumber(question.id);
questionsHTML += generateQuestionHTML(question, questionNumber);
});
questionsContent.innerHTML = questionsHTML;
// Add event listeners for answer inputs after adding to DOM
passage.questions.forEach(question => {
attachAnswerEventListeners(question);
});
}
// Calculate the display number for a question
function calculateQuestionNumber(questionId) {
let count = 1;
for (const test of testData.tests) {
for (const passage of test.passages) {
for (const question of passage.questions) {
if (question.id === questionId) {
return count;
}
count++;
}
}
}
return questionId; // Fallback
}
// Generate HTML for a question based on its type
function generateQuestionHTML(question, questionNumber) {
const userAnswer = userAnswers[question.id];
const isCorrect = testEnded && checkAnswer(question, userAnswer);
const correctAnswer = testEnded ? getCorrectAnswerDisplay(question) : '';
const explanation = testEnded ? question.explanation : '';
let questionHTML = `
${questionNumber}.
${formatQuestionText(question.question)}
`;
// Generate answer interface based on question type
switch (question.type) {
case 'multiple_choice':
questionHTML += generateMultipleChoiceHTML(question, userAnswer);
break;
case 'true_false_notgiven':
questionHTML += generateTrueFalseNotGivenHTML(question, userAnswer);
break;
case 'matching':
questionHTML += generateMatchingHTML(question, userAnswer);
break;
case 'completion':
case 'summary_completion':
questionHTML += generateCompletionHTML(question, userAnswer);
break;
default:
questionHTML += `
Unsupported question type: ${question.type}
`;
}
// Add feedback if the test is ended and we're showing answers
if (testEnded && showAnswersButton.classList.contains('hidden')) {
questionHTML += `
Your answer:${userAnswer || 'Not answered'}
${isCorrect ? '' : ''}
Correct answer:${correctAnswer}
Explanation: ${explanation}
`;
}
questionHTML += `
`;
return questionHTML;
}
// Format question text (handle new lines, etc.)
function formatQuestionText(text) {
return text.replace(/\n/g, ' ');
}
// Generate HTML for multiple choice questions
function generateMultipleChoiceHTML(question, userAnswer) {
let html = `
Select option
`;
question.options.forEach((option, index) => {
const optionLetter = option.split('.')[0]; // Assumes options are formatted with letters like "A. ..."
const isSelected = userAnswers[item] && userAnswers[item].includes(optionLetter);
html += `${option}`;
});
html += `
`;
});
html += `
`;
return html;
}
// Generate HTML for completion questions
function generateCompletionHTML(question, userAnswer) {
// For regular completion
if (question.type === 'completion') {
return `
`;
}
// For summary completion (multiple blanks)
if (question.type === 'summary_completion') {
const userAnswers = userAnswer ? JSON.parse(userAnswer) : Array(question.answers.length).fill('');
// Split the text by blanks (_______ or similar)
const parts = question.question.split(/_{3,}/);
let html = `
`;
parts.forEach((part, index) => {
html += `${part}`;
// Add input box after each part except the last one
if (index < parts.length - 1) {
html += `
`;
}
});
html += `
`;
return html;
}
}
// Attach event listeners to answer interfaces
function attachAnswerEventListeners(question) {
if (testEnded) return;
switch (question.type) {
case 'multiple_choice':
case 'true_false_notgiven':
// For radio button questions
document.querySelectorAll(`input[name="question_${question.id}"]`).forEach(radio => {
radio.addEventListener('change', function() {
userAnswers[question.id] = this.value;
updateNavigationUI(); // Update the question navigation to show which ones are answered
});
// Make the whole option clickable
radio.parentElement.addEventListener('click', function() {
if (!testEnded) {
radio.checked = true;
userAnswers[question.id] = radio.value;
updateNavigationUI();
}
});
});
break;
case 'matching':
// For matching questions
question.items.forEach(item => {
const itemKey = item.replace(/\s+/g, '_');
const select = document.getElementById(`q${question.id}_${itemKey}`);
if (select) {
select.addEventListener('change', function() {
// Initialize or update the answers object for this question
const currentAnswers = userAnswers[question.id] ? JSON.parse(userAnswers[question.id]) : {};
currentAnswers[item] = this.value ? [this.value] : [];
userAnswers[question.id] = JSON.stringify(currentAnswers);
updateNavigationUI();
});
}
});
break;
case 'completion':
// For single answer completion questions
const input = document.getElementById(`q${question.id}_answer`);
if (input) {
input.addEventListener('input', function() {
userAnswers[question.id] = this.value;
updateNavigationUI();
});
}
break;
case 'summary_completion':
// For summary completion (multiple blanks)
const inputs = document.querySelectorAll(`[id^="q${question.id}_answer"]`);
inputs.forEach((input, index) => {
input.addEventListener('input', function() {
// Initialize or update the answers array
const currentAnswers = userAnswers[question.id] ? JSON.parse(userAnswers[question.id]) : Array(inputs.length).fill('');
currentAnswers[index] = this.value;
userAnswers[question.id] = JSON.stringify(currentAnswers);
updateNavigationUI();
});
});
break;
}
}
// Start the test
function startTest() {
if (testStarted) return;
testStarted = true;
startTime = Date.now();
// Start the timer
timerInterval = setInterval(updateTimerDisplay, 1000);
// Update UI
startButton.classList.add('hidden');
endButton.classList.remove('hidden');
mobileStartButton.classList.add('hidden');
mobileEndButton.classList.remove('hidden');
updateUI();
}
// End the test
function endTest() {
if (!testStarted || testEnded) return;
testEnded = true;
clearInterval(timerInterval);
// Update UI
endButton.classList.add('hidden');
showAnswersButton.classList.remove('hidden');
mobileEndButton.classList.add('hidden');
updateUI();
}
// Show answers and score
function showAnswers() {
showAnswersButton.classList.add('hidden');
updateUI();
displayResults();
}
// Display test results
function displayResults() {
const test = testData.tests[currentTest];
let totalQuestions = 0;
let correctAnswers = 0;
// Count correct answers
test.passages.forEach(passage => {
passage.questions.forEach(question => {
totalQuestions++;
if (checkAnswer(question, userAnswers[question.id])) {
correctAnswers++;
}
});
});
// Calculate band score (approximate mapping)
const percentage = correctAnswers / totalQuestions;
let bandScore = 0;
if (percentage >= 0.9) bandScore = 9;
else if (percentage >= 0.8) bandScore = 8;
else if (percentage >= 0.7) bandScore = 7;
else if (percentage >= 0.6) bandScore = 6;
else if (percentage >= 0.5) bandScore = 5;
else if (percentage >= 0.4) bandScore = 4;
else if (percentage >= 0.3) bandScore = 3;
else if (percentage >= 0.2) bandScore = 2;
else bandScore = 1;
// Display results modal
const resultsHTML = `
Test Results
${bandScore}
Band Score
${correctAnswers}
Correct
${totalQuestions - correctAnswers}
Incorrect
${totalQuestions}
Total
IELTS Reading Band Score Description:
Band 9 (Expert): Perfect comprehension of complex texts
Band 8 (Very Good): Very good understanding with rare errors
Band 7 (Good): Good comprehension with occasional inaccuracies
Band 6 (Competent): Generally effective understanding
Band 5 (Modest): Partial understanding of complex texts
Band 4 (Limited): Basic comprehension of simple texts
`;
// Add results to the body
const resultsModal = document.createElement('div');
resultsModal.innerHTML = resultsHTML;
document.body.appendChild(resultsModal);
// Add event listeners to buttons
document.getElementById('reviewButton').addEventListener('click', function() {
resultsModal.remove();
switchTab('questions');
});
document.getElementById('newTestButton').addEventListener('click', function() {
resultsModal.remove();
resetTest();
// Select a different test
currentTest = (currentTest + 1) % testData.tests.length;
testSelector.value = currentTest;
updateUI();
});
}
// Check if an answer is correct
function checkAnswer(question, userAnswer) {
if (!userAnswer) return false;
switch (question.type) {
case 'multiple_choice':
case 'true_false_notgiven':
case 'completion':
return userAnswer.toLowerCase().trim() === question.answer.toLowerCase().trim();
case 'matching':
try {
const userMatches = JSON.parse(userAnswer);
// Check if all items have correct answers
for (const item in question.answers) {
const expectedAnswers = question.answers[item];
const userItemAnswers = userMatches[item] || [];
// Check if arrays have the same elements
const hasAllCorrectAnswers = expectedAnswers.every(answer =>
userItemAnswers.some(userAnswer =>
userAnswer.toLowerCase().trim() === answer.toLowerCase().trim()
)
);
const hasCorrectNumberOfAnswers = userItemAnswers.length === expectedAnswers.length;
if (!hasAllCorrectAnswers || !hasCorrectNumberOfAnswers) {
return false;
}
}
return true;
} catch (e) {
return false;
}
case 'summary_completion':
try {
const userAnswers = JSON.parse(userAnswer);
// Check if each blank has the correct answer
return userAnswers.every((answer, index) =>
answer.toLowerCase().trim() === question.answers[index].toLowerCase().trim()
);
} catch (e) {
return false;
}
default:
return false;
}
}
// Get a user-friendly display of the correct answer
function getCorrectAnswerDisplay(question) {
switch (question.type) {
case 'multiple_choice':
case 'true_false_notgiven':
case 'completion':
return question.answer;
case 'matching':
let display = '';
for (const item in question.answers) {
display += `${item}: ${question.answers[item].join(', ')} `;
}
return display;
case 'summary_completion':
return question.answers.join(', ');
default:
return 'N/A';
}
}
// Update the timer display
function updateTimerDisplay() {
const elapsedSeconds = Math.floor((Date.now() - startTime) / 1000);
const remainingSeconds = Math.max(0, 60 * 60 - elapsedSeconds); // 60 minutes
const minutes = Math.floor(remainingSeconds / 60);
const seconds = remainingSeconds % 60;
const displayTime = `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
timerDisplay.textContent = displayTime;
mobileTimerDisplay.textContent = displayTime;
// End test if time runs out
if (remainingSeconds === 0 && !testEnded) {
endTest();
}
}
// Reset the test
function resetTest() {
testStarted = false;
testEnded = false;
currentPassage = 0;
userAnswers = {};
// Reset timer
clearInterval(timerInterval);
timerDisplay.textContent = '60:00';
mobileTimerDisplay.textContent = '60:00';
// Reset buttons
startButton.classList.remove('hidden');
endButton.classList.add('hidden');
showAnswersButton.classList.add('hidden');
mobileStartButton.classList.remove('hidden');
mobileEndButton.classList.add('hidden');
}
// Initialize on load
window.addEventListener('load', function() {
fetchTestData();
});