IB Computer Science Unit 1
IB Computer Science Unit 2
IB Computer Science Unit 3
IB Computer Science Unit 4
IB Computer Science Unit 5
IB Computer Science Unit 6

IB Computer Science Practice Java Evaluation 7

IB Computer Science Question 1

You are designing a quiz game to help elementary school students with fraction calculations.

Your game should have a set of addition, subtraction, multiplication, division questions between two fractions stored inside a file.
o Each question should be on one line and be formatted to look as follows
▪ 3/4 + 4/5
▪ 5/8 * 9/4

The questions should be displayed to the player 1 question at a time and reward the player points for getting the answer to that question correct.
o Question was correct the first time
▪ 4 Points if it is in lowest terms
▪ 3 Points if it is not in lowest terms
o Question incorrect the first time but correct if given another chance.
▪ 2 Points if it is in lowest terms
▪ 1 Point if it is not in lowest terms
o Question incorrect after the second guess
▪ 0 Points.

Your program should always display the correct answer in lowest terms so the player can learn from their mistakes. Obviously there would be no need to display the correct answer in lowest terms if they already answered it in lowest terms.
• You should write the players name and score to a high score file when he/she is done playing the game.
• You should display the top score of anybody who has played the game when the game ends.
• All fractions will be displayed on the screen or entered from the file or the keyboard must be in the form “n/d”
• Supply your question bank and high score file as part of your solution to the drop box

It would be wise for you to create two types of objects in this assignment.

  • A Fraction Object and a Player Object.

IB Computer Science Question 2

Consider an object in a 2D Plane. It has mass 𝑚 , is at position 𝑑⃑ , moving with a velocity 𝑣⃑. If a Force 𝐹⃑ acts on the object over a period of time 𝑡 then that objects position and velocity will change.

You are going to write a program that starts with two objects at some initial position and initial velocity and after reading in a series of motions (Forces and times) from a file, will display the final position and the final velocity of those objects and how far the objects are from each other.

You will find the following information helpful.
Position, velocity, and Force are all vector quantities in physics which means they have a size and a direction associated with them. The size and direction can be represented in a vector coordinate and a cartesian coordinate.

  • A vector coordinate is always stated as the size followed by a direction in a set of [ ] brackets
  • The direction will always include the North or South Direction, followed by an angle in degrees, followed by an East or West Direction.
  • The cartesian coordinate is calculated using trigonometry from the vector coordinate.
  • X-Coordinate = size * sin (angle)
  • Y-Coordinate = size * cos(angle)
  • The positive and negatives are determined by what quadrant the x coordinate and y coordinate fall into.
    o North y-coordinate is positive
    o South y-coordinate is negative
    o East x-coordinate is positive
    o West x-coordinate is negative

For Example: Consider the following vector coordinates.
𝑑⃑1=40 [𝑁30𝐸] is a vector coordinate and its cartesian coordinate is (20,34.64)
𝑑⃑2=90 [𝑁60𝑊] is a vector coordinate and its cartesian coordinate is (-77.94 ,45)
𝐹⃑=60 [𝑆40𝐸]is a vector coordinate and its cartesian coordinate is (38.57,-45.96)
𝑣⃑=120 [𝑆80𝑊] is a vector coordinate and its cartesian coordinate is (-118.18,-20.84)

The input for this program will be from a file
• It would be wise to assume that all quantities in this program could be a decimal number.
• The first two lines of the file will be the initial conditions of the first object.
• Its mass, initial position, and initial velocity.
• Each will be separated by a comma.
• The position and velocities will be in vector coordinates.
• The next N lines will describe the motion of the objects.
• There will be up to 10 motions possible in the file.
• There is not a number telling you how many motions exist in the file, read it and calculate until no motions are left
• Force acting on object 1, Force acting on object 2, time the force acts
• Each will be separated by a comma
• The Force will be in vector coordinates
Output for this program will be to the screen
• The positions and velocities of each object should be displayed in their vector coordinates
• The distance between the objects should be stated to two decimal places.
Your design should incorporate at least 2 different encapsulated classes to help you solve this

Look up your kinematic Equations from physics class to determine the new position and velocity after each motion

IB Computer Science Question 3

You are going to write a program that helps students with some simple grade 10 math work.

Design a class that will accomplish the following
Fields:

  • Design yourself based on the information below

Constructor:

  • Accept a quadratic as a string in standard form (Ax2 + Bx + C)

Methods:

  • getOpening -> Determines if the quadratic opens up or down (Return a String)
  • getVertexForm -> Displays the quadratic in vertex form a(x-h)2 + k (Return a String)
  • getXVertex -> Determines x coordinate of the vertex of the quadratic
  • getYVertex ->Determines y coordinate of the vertex of the quadratic
  • getRoots -> Determines the x intercepts of the quadratic (Return a string)
  • getYInt -> Determines the y intercept of the quadratic
  • add -> Adds two quadratics together (Returns a Quadratic object)
  • subtract -> Subtracts two quadratics from each other (Returns a Quadratic object)
  • multiply -> Multiplies two quadratics together (Returns a Quadratic object)
  • display() -> outputs in standard form (f(x) = Ax2 + Bx + C)

Create a test program that shows all of the above methods working

IB Computer Science Question 4

Four friends play a simple dice game where they each roll 2 six sided dice and record the sum of the faces shown.

  • Odd Players win when the sum is 5, 7, or 11
  • Even Players win when the sum is 3, 9, or 12

The friends determine who is an even and odd player by rolling a single dice at the start of the game. If they roll an even number they are an even player, if they roll an odd number they are an odd player.

When players win they receive the sum of their dice as points. The friends will play the game 20 times each day and keep track of how many points they each have after the end of each day in a log book. Each day that they play, they update the log book with there new accumulated # of points.

Write a program that will simulate this game being played for 1 day. Each other day the game is played would involve running the simulation again.

Supply your Log Data File as part of your solution to the drop box
It would be wise for you to create two types of objects in this assignment.

  • A Dice Object and a Player Object.

Looking to Learn More about Computer Science and Coding?

Check out our programing in python courses that focus on high school level coding.  

  • Grade 11 Computer Science ICS3U
  • Grade 12 Computer Science ICS4U

These courses are complete with interactive coding lessons, teacher led videos, and more practice questions with complete solutions

Return To International Baccalaureate Computer Science Main Page