SDD - Implementation Flashcards
In a programming language of your choice write code to create a create a variable called score and save 0 in the variable
score = 0
In a programming language of your choice write code to set name to Mr Oliver
name = “Mr Oliver
What type of programing construct is being demonstrated below:
Set valid to True
Write code to carry out this action in programming language of your choice
Construct: Assignment
Python: valid = True
Using a programing language of your choice write code to create a variable called totalCost and assign the value 17.80 it the variable
totalCost = 17.80
Write pseudocode to create a variable called favShow and assign Ninjago to it
favShow = “Ninjago” or
Set favShow to Ninjago
What do the arithmetic operation constructs shown below below do?
- /
+ Add
- Subtract
* Multiply
/ Divide
^ Exponent (power of)
What arithmetic operation constructs does this symbol ^ do?
^ Exponent (power of)
What is the result of the arithmetic operation constructs shown below :
**2^3 **
8
^ is exponent(power of)
2 3
2x2x2=8
Write the symbols for the arithmetic operation constructs shown below?
Add
Subtract
Multiply
Divide
Exponent
+ Add
- Subtract
* Multiply
/ Divide
^ Exponent (power of)
What type of programing construct is being demonstrated below:
add 5 to the total
arithmetic operation
A program has recorded the number of female and male students stored in variables called numFemale and numMale
Using a programming language of your choice: Calculated the total number of students and assign it to a variable called numStudents
numStudents = numFemale + numMale
Line 11 RECEIVE noTickets FROM (INTEGER) KEYBOARD
Line 12 set price to 25
Line 13 < calculate totalCost >
Using a programming language of your choice: Write the code for line 13
totalCost = noTickets x price
Code: totalPay = hoursWorked x rate + bonus
An employee has worked 10 hours, and has a rate of £12 per hour and a £30 pound bonus.
Caluate the totalPay
(12 x 10) + 30
120 + 30
150
What is Concatenation?
Concatenation means joining two or more strings together.
What is the name of the programing construct which joining two or more strings together.
Concatenation
A program stores the users name is a variable called name.
Using a programing language of your choice write code which would produce the following output if Lucy was stored in the variable name.
Output
Hello Lucy, how are you?
Python:
print(“Hello “ + name + “, how are you?”)
State the output after this program has been run.
Set subject to “Computer Science”
Set result to “pass”
Display “I can “ & result & “ “ & subject
I can pass Computer Science
Using a programming language of your choice write a program to do the following.
RECEIVE firstName FROM (STRING) KEYBOARD
RECEIVE surname FROM (STRING) KEYBOARD
SEND firstName & surname TO DISPLAY
Python:
firstName = input(“Enter First Name”)
surname = input(“Enter Surname”)
print(firstName + surname)
The total viewing figures for a show should be displayed as.
The show was watched by 1.2 million
Using a programming language of your choice and the variable numViewers
, write the code to produce the output above.
print(“The show was watched by” + numViewers + “million”)
What does the logical constructs < mean/do?
Less than
What does the logical constructs <= mean/do?
Less than or equal
What does the logical constructs >= mean/do?
Greater than or equal
What does the logical constructs != mean/do?
not equal
What does the logical constructs == mean/do?
equal to
What is the logical construct for less than?
<
What is the logical construct for less than or equal?
<=
What is the logical construct for greater than?
>
What is the logical construct for greater than or equals?
> =