Computer Science - 9210 OxfordAQA

Random Number Generation In A Programming

Akopọ

A computer is the most predictable machine ever built. Give it the same input twice and it gives you the same answer twice, which is exactly what you want from a payroll system and exactly what you do not want from a game of snakes and ladders. Somewhere in that game a die has to be thrown, and the machine has to produce a number it did not know it was going to produce.

This lesson covers the one objective the specification sets here: be able to use random number generation. It also covers the boundary the specification draws, because knowing what is not asked for saves revision time. You will learn how to generate a number in a given range and count how many values that range holds, how to make a choice with equal chance, how to keep generating until you get a value you can use, and why a program that behaves differently every time is harder to test than one that does not.

Awọn Afojusun

  1. Be able to use random number generation.

Àwòrán ọpọlọ

A ti ṣe àwòrán kókó yìí kí o lè rí bí àwọn èrò ṣe so pọ̀.

Ṣí àwòrán ọpọlọ nínú áàpù

Akọ̀wé Ẹ̀kọ́

Random number generation gives a program a value it could not have worked out in advance. Without it a great deal of software would be impossible, and the examples are not all games.

Àkọsílẹ̀ Ẹ̀kọ́ Pípé wà lórí Ohun Èlò Green Bridge

Gba ohun èlò Green Bridge CBT sórí fóònù tàbí kọ̀mpútà rẹ fún gbogbo ilé ìkàwé IGCSE: ìwé ìdánwò àtijọ́, ìlànà ìdíwọ̀n, àwòrán èrò, káàdì ìkẹ́kọ̀ọ́ àti ẹ̀kọ́ ohùn.

Awọn akọsilẹ ẹkọ ni kikun pẹlu awọn aworan apejuwe
Oluranlọwọ ẹkọ ti AI ṣe agbara rẹ
Ìdánwò àdáṣe onítọ̀kọ̀ tí a ń ṣàyẹ̀wò lẹ́sẹ̀kẹsẹ̀ tí o bá parí
O wa lori Android, Windows, macOS, ati Linux Áàpù iOS ń bọ̀ láìpẹ́

Ìdánwò Ẹ̀kọ́

Oriire fun ipari ẹkọ lori Random Number Generation In A Programming. Ni bayi ti o ti ṣawari naa awọn imọran bọtini ati awọn imọran, o to akoko lati fi imọ rẹ si idanwo. Ẹka yii nfunni ni ọpọlọpọ awọn adaṣe awọn ibeere ti a ṣe lati fun oye rẹ lokun ati ṣe iranlọwọ fun ọ lati ṣe iwọn oye ohun elo naa.

Iwọ yoo pade adalu awọn iru ibeere, pẹlu awọn ibeere olumulo pupọ, awọn ibeere idahun kukuru, ati awọn ibeere iwe kikọ. Gbogbo ibeere kọọkan ni a ṣe pẹlu iṣaro lati ṣe ayẹwo awọn ẹya oriṣiriṣi ti imọ rẹ ati awọn ogbon ironu pataki.

Lo ise abala yii gege bi anfaani lati mu oye re lori koko-ọrọ naa lagbara ati lati ṣe idanimọ eyikeyi agbegbe ti o le nilo afikun ikẹkọ. Maṣe jẹ ki awọn italaya eyikeyi ti o ba pade da ọ lójú; dipo, wo wọn gẹgẹ bi awọn anfaani fun idagbasoke ati ilọsiwaju.

  1. How many different values can RANDOM(3, 9) produce, if both bounds are included? A. 6 B. 7 C. 9 D. 12 Answer: B
  2. An array holds 20 elements. Which call generates a valid index? A. RANDOM(0, 19) B. RANDOM(0, 20) C. RANDOM(1, 20) D. RANDOM(1, 21) Answer: A
  3. Which structure is used to keep generating a random number until an acceptable value appears? A. A definite loop B. A nested selection C. An indefinite loop D. A subroutine call Answer: C
  4. A program chooses one of two players at random and must give each an equal chance. Which call is correct? A. RANDOM(0, 1) B. RANDOM(0, 2) C. RANDOM(1, 10) D. RANDOM(2, 2) Answer: A
  5. According to the specification, which of these is NOT required? A. Using random number generation within a program B. Choosing an appropriate range for a task C. Understanding how pseudo-random numbers are generated D. Storing a randomly generated value in a variable Answer: C

Ṣiṣẹ́ lórí àwọn ìbéèrè wọ̀nyí nínú ohun èlò náà

Ṣiṣẹ́ lórí àwọn ìbéèrè wọ̀nyí nínú ohun èlò náà

Ṣe Adaṣe Awọn Ibeere Idanwo Adaṣe

Ṣe o fẹ ṣe adaṣe awọn ibeere idanwo adaṣe nipa Random Number Generation In A Programming? Ṣe igbasilẹ ohun elo Green Bridge CBT lati wọle si awọn ibeere idanwo adaṣe ati awọn ayẹwo adaṣe kikun fun koko-ọrọ yii.

Ṣe igbasilẹ ohun elo naa lori Google Playstore

Gbogbo ohun ti o nilo lati ṣe dara julọ ninu JAMB, WAEC ati NECO.

Green Bridge CBT Mobile App
Asiko ẹkọ AI ti ara ẹni Chat Assistant
Ìbéèrè ìdánwò IGCSE, JAMB, WAEC ati NECO tó ju 200,000 lọ
Fiwọn 1200 Awọn akọsilẹ Ẹkọ ju.
Atilẹyin Aisinipo - Kọ ẹkọ Nigbakugba, Nibi gbogbo
Tẹ̀dí Green Bridge
Àkójọpọ̀ Ìtàn Lítíréṣọ̀ & Ìbéèrè Tó Lè Dáyéé ṣẹ́lẹ̀
Tẹle iṣẹ ṣiṣe rẹ ati ilọsiwaju rẹ.
Àlàyé tí ó jinlẹ̀ fún ìmòye tó jinlẹ̀.