def da_ad_rechargable_battery_piax2(): q = ucf.Question(ucf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) option, current, minSecs, statedTime, time, charge = setup() option, current2, minSecs2, statedTime2, time2, charge2 = setup() charge = (current * time) time2 = round(charge / current2, 2) q.questionBase = [ f"A certain type of rechargable battery can delivers {current}A for {statedTime} {minSecs} before its voltage drops and it needs to be recharged.", f"Calculate the maximum time it could be used before being recharged if the current drawn from it were {current2} Amps." ] q.answerBase = f"{time2}" q.answerUnits = ' seconds' return q.returnAll()
def fb_ad_charging_an_insulated_metal_conductor_pxax3(): q = ucf.Question(ucf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext(list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) q.questionBase = [f"An insulated metal conductor is earthed before a negatively charged object is brought near to it:"] q.questionPartList = [ {'sub_number': 1, 'sub_question': ['Explain why the free electrons in the conductor move as far away from the charged object as they can.'], 'sub_answer': 'The free electrons in the metal are repelled by negatively charged object because they are also negatively charged.', 'sub_mark': 1 }, {'sub_number': 2, 'sub_question': ["The conductor is then briefly earthed. The charged object is then removed from the vicinity of the conductor.","Explain why the conductor is left with an overall positive charge."], 'sub_answer': "When the conductor is earthed, electrons are able to flow out of the conductor to earth, resulting in less electrons in the conductor and an overall positive charge.", 'sub_mark': 2 }, ] return q.returnAll()
def fb_ab_shuttling_ball_experiment_pxax4(): q = ucf.Question(ucf.currentFuncName()) q.questionBase = ["In the shuttling ball experiment, explain why the ball shuttles faster if:"] q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext(list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) q.questionPartList = [ {'sub_number': 1, 'sub_question': ['the potential difference between the plates is increased'], 'sub_answer': 'On contact, electrons flow from the insulated metal to the positively charged rod, resulting in a net positive charge on the metal', 'sub_mark': 2 }, {'sub_number': 2, 'sub_question': ['the plates are brought closer together'], 'sub_answer': 'Electrons from the sphere are repelled by the negative charge on the ball and flow down the wire until the charge of the sphere is no longer negative', 'sub_mark': 2 }, ] return q.returnAll()
def fb_aa_electrical_field_observations_pxax4(): q = ucf.Question(ucf.currentFuncName()) q.questionBase = ["Explain each of the following observations in terms of transfer of electrons:"] q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext(list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) q.questionPartList = [ {'sub_number': 1, 'sub_question': ['An insulated metal can is given a positive charge by touching it with a positively charged rod'], 'sub_answer': 'On contact, electrons flow from the insulated metal to the positively charged rod, resulting in a net positive charge on the metal', 'sub_mark': 2 }, {'sub_number': 2, 'sub_question': ['A negatively charged metal sphere suspended on a thread is discharged by connecting it to the ground using a wire'], 'sub_answer': 'Electrons from the sphere are repelled by the negative charge on the ball and flow down the wire until the charge of the sphere is no longer negative', 'sub_mark': 2 }, ] return q.returnAll()
def db_aa_two_components_parallel_pxax6(): q = ucf.Question(ucf.currentFuncName()) batPd, batI, batP, comp1Pd, comp1P, comp1I, comp2Pd, comp2P, comp2I = parallelCircuitSetup( ) thing = componentSetup() q.questionBase = [ f"The battery in the circuit above has an emf of {batPd} v and negligible internal resistance is connected to a {comp1Pd}v, {comp1P}W {thing} (a) in parallel with another {comp2Pd}v, {comp2P}W {thing} (b).", "Calculate:" ] question1 = [f'the current through each {thing}'] question2 = [f'the current from the battery'] question3 = [f'the power supplied by the battery.'] answer1 = f'{thing} 1 = {comp1I}A, {thing} 2 = {comp2I}A' answer2 = f'{batI}A' answer3 = f'{batP}W' q.constant = None q.diagram = "/diagrams/physics/circuit_ab_parallel.jpg" q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) marks1 = '2' marks2 = '2' marks3 = '2' q.questionPartList = [ { 'sub_number': 1, 'sub_question': question1, 'sub_answer': answer1, 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': question2, 'sub_answer': answer2, 'sub_mark': 2 }, { 'sub_number': 3, 'sub_question': question3, 'sub_answer': answer3, 'sub_mark': 2 }, ] return q.returnAll()
def da_ae_work_PD_and_current_piax2(): q = ucf.Question(ucf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) complist = [ "hairdryer", "buzzer", "klaxon warning of immenent alien invasion", "disco light", "subwoofer", "warning becon", "pair of hair straighteners" ] component = complist[randint(0, len(complist) - 1)] option = randint(1, 4) time = randint(10, 2000) current = randint(5, 500) / 100 pd = randint(5, 20) work = round(time * current * pd, 2) q.constant = None if option == 1: q.questionBase = [ f"Calculate the energy transfered in {time} s in a {component} where the the potential difference is {pd} v and current is {current} A." ] q.answerBase = f"{work}" q.answerUnits = ' Joules' if option == 2: q.questionBase = [ f"Calculate the time taken to transfer {work} J of energy where the the potential difference accross a {component} is {pd} v and the current is {current} A." ] q.answerBase = f"{time}" q.answerUnits = 'seconds' if option == 3: q.questionBase = [ f"Calculate the average potential difference accross a {component} where a current of {current} A does {work} J of work over {time} s." ] q.answerBase = f"{pd}" q.answerUnits = 'v' if option == 4: q.questionBase = [ f"Calculate the average current drawn by a {component} where the average potential difference accross the component is {pd}v over {time} seconds and {work} J of work is done." ] q.answerBase = f"{current}" q.answerUnits = ' Amps' q.qtype = 'type' return q.returnAll()
def e1bad_phase_differencepxax3(): cycles = randrange(10, 30, 2) in_time = randrange(8, 24, 2) time = cycles / in_time difference_in_time = round(time / randrange(2, 9, 2), 2) phase_difference_radians = round( ((2 * 3.1415925635899 * difference_in_time) / time) / 3.1415925635899, 2) q = ucf.Question(ucf.currentFuncName()) q.questionBase = [ f"Two identical pendulums x and y each consist of a {q.item(vl.objects)} attached to a thread of a certain length. Each pendulum makes {cycles} complete cycles of oscillation in {in_time}s.", "State the phase difference, in radians, between the motion of x and that of y if:" ] q.questionPartList = [ { 'sub_number': 1, 'sub_question': [ f"x passes through equilibrium {difference_in_time} s after y passes through equilibrium in the same direction" ], 'sub_answer': f'{phase_difference_radians}\u03c0 radians', 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': [ "x reaches maximum displacement at the same time as y reaches maximum displacement in the opposite direction." ], 'sub_answer': f'\u03c0 radians', 'sub_mark': 1 }, ] q.diagram = f'/diagrams/physics/{ucf.currentFuncName()}.jpg' q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) return q.returnAll()
def aa_ac_Ionised_atoms_and_specific_charge_pxax6(): q = cf.Question(cf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = cf.previousNext( list_callable_functions(), cf.currentFuncName(), module_path(), cf.currentFuncName()[0:2], 0, 2) atom, mass, element, proton = generateAtom() losesGains = "loses" if randint(0, 1) == 0 else "gains" electrons = randint(1, 4) electron = -electrons if losesGains == "loses" else electrons q.questionBase = f"An {atom} atom {losesGains} {electrons} electrons." question1 = ["What is the charge of the atom in Coulombs?"] answer1 = f"{(-electron * electronCharge())} C" question2 = ["State the number of nucleons the atom contains."] answer2 = f"{mass}" question3 = ["Calculate its specific charge in Ckg-1."] specificCharge = round( (-electron * float(electronCharge())) / (mass * float(nucleonMass())), 2) if specificCharge < 0: specificCharge *= -1 answer3 = f"{specificCharge}" q.questionPartList = [ { 'sub_number': 1, 'sub_question': question1, 'sub_answer': answer1, 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': question2, 'sub_answer': answer2, 'sub_mark': 1 }, { 'sub_number': 3, 'sub_question': question3, 'sub_answer': answer3, 'sub_mark': 3 }, ] return q.returnAll()
def gx_aa_nuclear_reactor_decay_pxax3(): original_atom = sc.generate_atom() extra_neutrons = randint(1, 4) absorbing_atom = sc.make_atom(original_atom[1] + extra_neutrons, original_atom[2], original_atom[3]) decayed_atom = sc.generate_atom(original_atom[3] + extra_neutrons) decayed_atom = sc.make_atom(absorbing_atom[1], decayed_atom[2], decayed_atom[3]) q = ucf.Question(ucf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) neutron_string = f'{sc.generate_atom(0)[0]}' if extra_neutrons == 1 else f'{extra_neutrons}({sc.generate_atom(0)[0]})' q.questionBase = [ f"In an unsual nuclear reactor, some {original_atom[0]} nuclei absorb neutrons to become {absorbing_atom[0]}.", f"These nuclei decay in {extra_neutrons} stages to become nuclei of the isotope {decayed_atom[0]}." ] sub_q1 = [ f'Write down an equation to represent the formation of a {absorbing_atom[0]} nucleus from a {original_atom[0]} nucleus.' ] sub_a1 = f'{original_atom[0]} + {neutron_string} \u2192 {absorbing_atom[0]}' sub_q2 = [ f'What types of particles are emmitted when {absorbing_atom[0]} decays to become {decayed_atom[0]}?' ] sub_a2 = f'{sc.beta()}- or electrons' q.questionPartList = [ { 'sub_number': 1, 'sub_question': sub_q1, 'sub_answer': sub_a1, 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': sub_q2, 'sub_answer': sub_a2, 'sub_mark': 1 }, ] return q.returnAll()
def e1bbb_acceleration_and_frequency_of_oscillating_object_pxax4(): amplitude = randint(20, 30) time_period = randrange(6, 13, 2) direction = 'downwards' frequency = round(1 / time_period, 2) angular_frequency = 2 * 3.14159265358 / time_period plus = round(-(2 * 3.14159265359 * frequency)**2 * amplitude / 1000, 2) zero = 0 minus = round((2 * 3.14159265359 * frequency)**2 * amplitude / 1000, 2) q = ucf.Question(ucf.currentFuncName()) q.questionBase = [ f"A small {q.item(vl.objects)} attached to the end of a vertical spring oscillates with an amplitude of {amplitude}mm and a time period of {time_period}s.", "Calculate:" ] q.questionPartList = [ { 'sub_number': 1, 'sub_question': ["the frequency"], 'sub_answer': f'{frequency}Hz', 'sub_mark': 1 }, { 'sub_number': 2, 'sub_question': [ f"the acceleration of the object when the displacement is {amplitude} mm, 0 and {-amplitude} mm" ], 'sub_answer': f'{plus}, {zero} and {minus}m/s\u00b2', 'sub_mark': 2 }, ] q.diagram = f'/diagrams/physics/e1bba_displacement_and_direction_of_oscilating_objectpxax4.jpg' q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) return q.returnAll()
def db_ac_two_components_series2_pxax4(): q = ucf.Question(ucf.currentFuncName()) batPd, batI, batP, comp1Pd, comp1P, comp1I, comp2Pd, comp2P, comp2I = seriesCircuitSetup( ) thing = componentSetup() comp1R = round(comp1Pd / comp1I, 2) comp2R = round(comp2Pd / comp2I, 2) if comp2R < 0: comp2R *= -1 q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) q.diagram = "/diagrams/physics/circuit_ab_series.jpg" q.constant = None q.questionBase = [ f"The {batPd}v battery in the diagram above has negligible internal resistance and is connected in series with a {comp1R} Ohm resistor (a), a {thing} (b) and an ammeter reading {comp1I}A.", "Calculate:" ] question1 = [f'the potential difference across the resistor'] answer1 = f'{comp1Pd}v' marks1 = '2' question2 = [f'the resistance of the {thing}.'] answer2 = f'{comp2R} Ohms' marks2 = '2' q.questionPartList = [ { 'sub_number': 1, 'sub_question': question1, 'sub_answer': answer1, 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': question2, 'sub_answer': answer2, 'sub_mark': 2 }, ] return q.returnAll()
def ab_aa_Counting_protons_and_neutrons_pxax2(): q = cf.Question(cf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = cf.previousNext(list_callable_functions(), cf.currentFuncName(), module_path(), cf.currentFuncName()[0:2], 0, 2) atom, mass, element, proton = generateAtom() q.questionBase = f" {atom}" question1 = ["How many protons in the above nucleus?"] answer1 = f"{proton}" question2 = ["How many neutrons in the above nucleus?"] answer2 = f"{mass-proton}" q.questionPartList = [ {'sub_number': 1, 'sub_question': question1, 'sub_answer': answer1, 'sub_mark': 1}, {'sub_number': 2, 'sub_question': question2, 'sub_answer': answer2, 'sub_mark': 1}, ] return q.returnAll()
def db_ab_two_components_series_pxax4(): q = ucf.Question(ucf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) batPd, batI, batP, comp1Pd, comp1P, comp1I, comp2Pd, comp2P, comp2I = parallelCircuitSetup( ) thing = componentSetup() q.questionBase = [ f"A {batPd} v battery of negligible internal resistance as shown above is connected in series with a {comp1Pd} v, {comp1P} W {thing} (a) and a variable resistor (b).", f"When the resistor is adjusted so that the pd across the {thing} is {comp2Pd}, work out:" ] question1 = [f'the potential difference across the resistor'] question2 = [f'the current through the {thing}.'] answer1 = f'{comp1Pd}v' answer2 = f'{comp2I} A' q.constant = None marks1 = '2' marks2 = '2' q.diagram = "/diagrams/physics/circuit_ab_series.jpg" q.questionPartList = [ { 'sub_number': 1, 'sub_question': question1, 'sub_answer': answer1, 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': question2, 'sub_answer': answer2, 'sub_mark': 2 }, ] return q.returnAll()
def fb_ac_shuttling_ball_experiment2_pxax3(): frequency = randint(20, 30)/10 charge = 30 charge_nano = 30e-9 current = round(frequency*charge) number_of_electrons = (charge_nano/1.6e-19)/1e11 q = ucf.Question(ucf.currentFuncName()) q.constant = electron() q.questionBase = [f"A ball shuttles between two oppositely charged metal plates at a frequency of {frequency} Hz.",f"The ball carries a charge of {charge} nC each time it shuttles from one plate to the other.","Calculate:"] q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext(list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) q.questionPartList = [ {'sub_number': 1, 'sub_question': ['the average current in the circuit'], 'sub_answer': f'{current} nA', 'sub_mark': 1 }, {'sub_number': 2, 'sub_question': ['the number of electrons transferred each time the ball makes contact with a metal plate'], 'sub_answer': f'{number_of_electrons}x10\u00b9\u00b9', 'sub_mark': 2 }, ] return q.returnAll()
def da_da_temperature_of_a_fillament_pxax3(): q = ucf.Question(ucf.currentFuncName()) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext(list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) component, option, pd, current, power, resistance, length= temp_res_setup() increase_decrease = "increase" if randint(1,2) == 1 else "decrease" current_pd = "current" if randint(1,2) == 1 else "potential difference" happen = '' if current_pd == current: if increase_decrease == "increase": happen = "increase" else: happen = "decrease" else: if increase_decrease == "increase": happen = "decrease" else: happen = "increase" q.constant = None q.questionBase = [f"A filament bulb is labelled '{pd} V, {round(power, 1)} W'."] question1 = [f"Calculate its current and resistance at {pd} V."] answer1 = f"Current = {current}A, resistance = {resistance} Ohms" question2 = [f'What would happen to the temperature in the fillament bulb if the {current_pd} in the fillament were to {increase_decrease}?'] answer2 = f'The resistance and temperature of the fillament would {happen}.' q.questionPartList = [ {'sub_number': 1, 'sub_question': question1, 'sub_answer': answer1, 'sub_mark': 2}, {'sub_number': 2, 'sub_question': question2, 'sub_answer': answer2, 'sub_mark': 2}, ] return q.returnAll()
def e1bbd_displacement_and_acceleration_pxax4(): cycles = randrange(10, 30, 2) in_time = randrange(8, 24, 2) amplitude = randint(20, 30) #cycles, in_time, amplitude = 10, 20, 32 frequency = round(cycles / in_time, 2) time = 1 / frequency time_quarter, time_half, time_three_quarters = round( time * 0.25, 3), round(time * 0.5, 2), round(time * 0.75, 3) displacement_quarter = 0 displacement_half = -amplitude displacement_three_quarters = 0 angular_frequency = round(2 * 3.14159265358 / (1 / frequency), 2) acceleration = round((-angular_frequency**2) * amplitude / 1000, 3) acceleration_quarter = 0 acceleration_half = -acceleration acceleration_three_quarters = 0 q = ucf.Question(ucf.currentFuncName()) q.questionBase = [ f"A simple pendulum consists of a small {q.item(vl.objects)} attached to the end of a thread. {q.item(vl.comments)}. The aforementioned object is displaced from equilibrium and released at t = 0 with an amplitude of {amplitude}mm, taking {in_time}s to execute {cycles} oscillations.", "State the displacement and calculate the acceleration when:" ] if randint(0, 1) == 0: q.questionPartList = [ { 'sub_number': 1, 'sub_question': [f"t = {time_quarter}s"], 'sub_answer': f'Displacement = {displacement_quarter}mm, accleration ={acceleration_quarter}m/s\u00b2', 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': [f"t = {time_half}s"], 'sub_answer': f'Displacement = {displacement_half}mm, accleration ={acceleration_half}m/s\u00b2', 'sub_mark': 2 }, ] else: q.questionPartList = [ { 'sub_number': 1, 'sub_question': [f"t = {time_half}s"], 'sub_answer': f'Displacement = {displacement_half}mm, accleration ={acceleration_half}m/s\u00b2', 'sub_mark': 2 }, { 'sub_number': 2, 'sub_question': [f"t = {time_three_quarters}s"], 'sub_answer': f'Displacement = {displacement_three_quarters}mm, accleration ={acceleration_three_quarters}m/s\u00b2', 'sub_mark': 2 }, ] q.piclink = q.item(vl.pendulum_links) q.previousQ, q.nextQ, q.currentQname, q.nextQname, q.previousQname = ucf.previousNext( list_callable_functions(), ucf.currentFuncName(), module_path(), ucf.currentFuncName()[0:2], 0, 2) return q.returnAll()