APTITUDE FOR PROGRAMMING PRACTICE



Similar documents
2.6 Exponents and Order of Operations

Spreadsheets Hop-around Cards

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

Solving systems by elimination

IV. ALGEBRAIC CONCEPTS

Day One: Least Common Multiple

Decimals and other fractions

3.2. Solving quadratic equations. Introduction. Prerequisites. Learning Outcomes. Learning Style

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers:

Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES

Basic numerical skills: EQUATIONS AND HOW TO SOLVE THEM. x + 5 = = (2-2) = = 5. x = 7-5. x + 0 = 20.

1.2 Linear Equations and Rational Equations

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system

Simple Examples. This is the information that we are given. To find the answer we are to solve an equation in one variable, x.

Creating Basic Excel Formulas

Maths Workshop for Parents 2. Fractions and Algebra

MEP Y9 Practice Book A

Core Maths C1. Revision Notes

Calculate Highest Common Factors(HCFs) & Least Common Multiples(LCMs) NA1

Year 2 Summer Term Oral and Mental Starter Activity Bank

Click on the links below to jump directly to the relevant section

Method To Solve Linear, Polynomial, or Absolute Value Inequalities:

Current California Math Standards Balanced Equations

Solving Linear Equations in One Variable. Worked Examples

Properties of Real Numbers

Quadratics - Build Quadratics From Roots

Multiplying and Dividing Signed Numbers. Finding the Product of Two Signed Numbers. (a) (3)( 4) ( 4) ( 4) ( 4) 12 (b) (4)( 5) ( 5) ( 5) ( 5) ( 5) 20

Closing the Books Section 7 Accounting 11

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Written methods for addition of whole numbers

25 Integers: Addition and Subtraction

Solving Systems of Linear Equations Using Matrices

26 Integers: Multiplication, Division, and Order

Section 1.5 Exponents, Square Roots, and the Order of Operations

Basic Formulas in Excel. Why use cell names in formulas instead of actual numbers?

MATHEMATICS FOR ENGINEERING BASIC ALGEBRA

Exponents and Radicals

Integrals of Rational Functions

4/1/2017. PS. Sequences and Series FROM 9.2 AND 9.3 IN THE BOOK AS WELL AS FROM OTHER SOURCES. TODAY IS NATIONAL MANATEE APPRECIATION DAY

1.4 Compound Inequalities

The theory of the six stages of learning with integers (Published in Mathematics in Schools, Volume 29, Number 2, March 2000) Stage 1

Rational Exponents. Squaring both sides of the equation yields. and to be consistent, we must have

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Section 1. Inequalities

Clifton High School Mathematics Summer Workbook Algebra 1

Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving

IB Maths SL Sequence and Series Practice Problems Mr. W Name

MATHEMATICS FOR ENGINEERING BASIC ALGEBRA

Pre-Algebra Lecture 6

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule.

Mental Math Mental Computation Grade 3

No Solution Equations Let s look at the following equation: 2 +3=2 +7

The Properties of Signed Numbers Section 1.2 The Commutative Properties If a and b are any numbers,

QM0113 BASIC MATHEMATICS I (ADDITION, SUBTRACTION, MULTIPLICATION, AND DIVISION)

Contents. Subtraction (Taking Away) Multiplication... 7 by a single digit. by a two digit number by 10, 100 or 1000

Year 9 set 1 Mathematics notes, to accompany the 9H book.

Chapter 9. Systems of Linear Equations

Grade 6 Math Circles. Binary and Beyond

Binary Adders: Half Adders and Full Adders

Finding Rates and the Geometric Mean

This is a square root. The number under the radical is 9. (An asterisk * means multiply.)

Determine If An Equation Represents a Function

3.1. RATIONAL EXPRESSIONS

JobTestPrep's Numeracy Review Decimals & Percentages

Zero-knowledge games. Christmas Lectures 2008

Direct Translation is the process of translating English words and phrases into numbers, mathematical symbols, expressions, and equations.

Binomial Probability Distribution

Systems of Equations - Addition/Elimination

Inductive Reasoning Free Sample Test 2

Inequalities - Solve and Graph Inequalities

5. Tutorial. Starting FlashCut CNC

3.GETTING STARTED WITH ORACLE8i

Pricing Your Work (Overhead Recovery Review)

FRACTIONS COMMON MISTAKES

Let s put together a Manual Processor

Training Manual. Pre-Employment Math. Version 1.1

Addition Methods. Methods Jottings Expanded Compact Examples = 15

Inductive Reasoning Free Sample Test 1

Beginning to Program Python

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system

Mathematical goals. Starting points. Materials required. Time needed

2.5 Zeros of a Polynomial Functions

Fractions and Linear Equations

Rational Number Project

Introduction. Appendix D Mathematical Induction D1

Maths methods Key Stage 2: Year 3 and Year 4

Solving Linear Equations - General Equations

7.7 Solving Rational Equations

Mathematics Higher Level

Tom wants to find two real numbers, a and b, that have a sum of 10 and have a product of 10. He makes this table.

Linear Programming Notes V Problem Transformations

SHELL INDUSTRIAL APTITUDE BATTERY PREPARATION GUIDE

Arithmetic Progression

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR!

8.2. Solution by Inverse Matrix Method. Introduction. Prerequisites. Learning Outcomes

Working with whole numbers

UNIT 3 VOCABULARY: INTEGERS

Transcription:

APTITUDE FOR PROGRAMMING PRACTICE

APTITUDE FOR PROGRAMMING PRACTISE EXAMPLES INSTRUCTIONS The following practise examples have been provided for you as reasonable example of what to expect on attending your Aptitude for Programming Test. Please note that no further advice or support will be provided. These instructions are presented in a similar format to those that you will receive in the actual test. On the day you will have 1 hour to complete the test. Please note that the test will be a written test, not on a computer. The test itself and these example questions are designed to assess your aptitude for computer programming. It is not an intelligence test and equally it is no testing existing programming knowledge. As such, although you may recognise some similarities between the programming language used in these examples and other programming languages the example language is basically very different. If you have had some experience in computer programming, try to set it aside and use only the exact instructions given here. The same will apply when you attend the test the language used there will be different again. You must use the commands in the way defined in the rest of this booklet. You should not place any different meaning on these commands other than that given explicitly in this document. The object of the questions is to determine how well you can utilise the instructions given to solve various types of problems. The questions all require you to write out the list of programming commands that will solve the problem. You may only use the numbers and variable names given in the question. In some questions you will need to store a value half way through a program and then reintroduce it into the program. In these cases an intermediate storage variable will be indicated in the question. If you are given an arithmetical equation to program, then you must reproduce that equation in the list of commands that you write. The following rules apply to the order of calculation: - Where brackets are indicated, work out what is in the brackets first. - If one expression divides another, then calculate the bottom line first. - Calculation order is left to right in the equation. Following the initial examples are some arithmetic problems to program. Use the commands as outlined in the Instructions. For each problem you should write out the list of programming commands that will solve the problem. These questions have been provided to give you some practice prior to the test. As such, we advise that you try to work through the questions attempting all before looking at the answers, which are provided separately at the end of this document. Page 2 of 13

LIST OF COMMANDS In the following list, A is used as an example of a variable that can be used with each command. When you are writing programs with this language you may use any of the variables in the question or a numeric value given in the question. All calculations are performed in a working area. This is a temporary storage space and can hold just one value at any time. Where brackets are indicated they must be used. BEGIN indicates that the program is starting. BEGIN must be in every program and can only occur on the first line of the program. PUT(A) - puts the value of the variable A into the working area. The variable A is unchanged by the command PUT. PLUS(A) - adds the value of the variable A to the value in the working area. The result is kept in the working area. The variable A is unchanged. MINUS(A) - subtracts the value of the variable A from the value in the working area. The result is kept in the working area. The variable A is unchanged. TIMES(A) - multiplies the value in the working area by the value of variable A. The result is kept in the working area. The variable A is unchanged. OVER(A) - divides the value in the working area by the value of the variable A. The result is kept in the working area. The variable A is unchanged. Page 3 of 13

SET AS A - Sets the variable A to the value currently in the working area. Any previous value in variable A is overwritten. The value in the working area remains unchanged. CLEAR - The workspace is cleared of any value currently held and then set to zero. The workspace must be cleared at the end of each program. The CLEAR command can also be used at any stage in any program and any number of times. COMPARE (condition, line number) - COMPARE is followed by a condition, e.g. X=Y. If the condition is true at the time when the COMPARE command is encountered then the program moves to next line and continues. If the condition is false then the program moves to the line number given. The condition must be of the form: A EQUAL B - is true when the values of A and B are equal or A GREATER B - is true when A has a greater value than B or A LESS B - is true when A has a value less than that of B above: The condition and line number must appear in the brackets exactly as - Separated by a comma - The condition first, the line number second e.g. COMPARE(A EQUAL B, 10) CYCLE A START CYCLE FINISH - repeats the sequence of commands enclosed between the CYCLE START and CYCLE FINISH. A defines the number of times the sequence is repeated. A is optional, i.e. you need not include it in after CYCLE; however, if A is not written then the sequence repeats itself indefinitely. A condition exit from the CYCLE START CYCLE FINISH command can be affected by incorporating a COMPARE (condition, line number) statement immediately following the CYCLE START statement. The line number of the COMPARE statement can direct the program to any line inside or outside the CYCLE START CYCLE FINISH. Page 4 of 13

EXAMPLES EXAMPLE 1 X + Y = Z The solution is: EG1 2 PUT(X) 3 PLUS(Y) 4 SET AS Z 5 CLEAR Note that the problem is broken down into 3 units: 1 X 2 +Y 3 =Z Each is tackled separately and is given a line of code to represent it. Note that the question is tackled as it is read from left to right. Although X + Y is arithmetically the same as Y + X reversing the first two lines of the program would not be exactly reproducing the equation and therefore would be marked wrong. Page 5 of 13

EXAMPLE 2 (U - V) = Z W The solution is: EG2 2 PUT(U) 3 MINUS(V) 4 OVER(W) 5 SET AS Z 6 CLEAR EXAMPLE 3 Add X to Y, 3 times and then add W. Store in V. The solution is: EG3 2 PUT(Y) 3 CYCLE 3 START 4 PLUS(X) 5 CYCLE FINISH 6 PLUS(W) 7 SET AS V 8 CLEAR Page 6 of 13

Practise Questions 1. (7 3) + 5 = Q X 2. Divide 72 by 6. Subtract 7 and multiply the result by 23. Store as F 1 2 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 Page 7 of 13

3. Subtract 3 from Z, the number of times given by the value of D. 4. The following program will not work as written. However, it will work if just one line of the code is different. Write the one line correction to the program. Multiply the sum of 6 + 7 by 16 and store in P. 1 START 2 PUT(6) 3 PLUS(7) 4 TIMES(16) 5 SET AS P 6 CLEAR 3 4 1 Line Command 2 3 4 5 6 7 8 9 10 Page 8 of 13

5. Add 1 to the variable X until it equals the value in the variable Z. Then stop. 6. A teaboy has to make sure that there are more than C biscuits in the biscuit tin. He checks the biscuit tin every tea break. If there are more than C biscuits he takes X biscuits out to distribute. If B is the number of biscuits currently in the tin, write a program to calculate N (which has a starting value of zero) the number of tea breaks the biscuit tin lasts. 5 6 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 Page 9 of 13

Solutions The following are suggested answers for the practise questions. For certain questions there may be more than one correct answer. In these cases the various options are listed. Question 1: Q1 2 PUT(7) 3 TIMES(3) 4 PLUS(5) 5 OVER(Q) 6 SET AS X 7 CLEAR Question 2: Q2 2 PUT(72) 3 OVER(6) 4 MINUS(7) 5 TIMES(23) 6 SET AS F 7 CLEAR Page 10 of 13

Question 3: Q3 Option 2 2 CYCLE D START 2 PUT(Z) 3 PUT(Z) 3 CYCLE D START 4 MINUS(3) 4 MINUS(3) 5 SET AS Z 5 SET AS Z 6 CYCLE FINISH 6 CYCLE FINISH 7 CLEAR 7 CLEAR Question 4: Q4 2 PUT(6) 3 PLUS(7) 4 TIMES(16) 5 SET AS P 6 CLEAR Page 11 of 13

Question 5: Q5 Option 1 Option 2 2 CYCLE START 2 PUT(X) 3 COMPARE (X LESS Z, 8) 3 CYCLE START 4 PUT(X) 4 COMPARE (X LESS Z, 8) 5 PLUS(1) 5 PLUS(1) 6 SET AS X 6 SET AS X 7 CYCLE FINISH 7 CYCLE FINISH 8 CLEAR 8 CLEAR Q5 Option 3 2 PUT(X) 3 PLUS(1) 4 SET AS X 5 COMPARE (X EQUAL Z, 2) 8 CLEAR Page 12 of 13

Question 6: Q6 Option 1 Option 2 2 CYCLE START 2 PUT(B) 3 COMPARE (B GREATER C, 10) 3 MINUS(X) 4 PUT(B) 4 SET AS B 5 MINUS(X) 5 PUT(N) 6 SET AS B 6 PLUS(1) 7 PUT(N) 7 SET AS N 7 PLUS(1) 7 COMPARE (B LESS C, 2) 8 SET AS N 8 CLEAR 9 CYCLE FINISH 10 CLEAR Page 13 of 13