Variable Assignment (1 Mark)
Explain the purpose of an assignment statement in a computer program.
Variable Assignment (1 Mark) Read More »
Explain the purpose of an assignment statement in a computer program.
Variable Assignment (1 Mark) Read More »
Explain the difference between ‘integer’ and ‘real’ data types with an example of when you would use each in a program.
‘Integer’ and ‘Real’ Data Types. (4 marks) Read More »
Explain the term “data type” in the context of computer programming.
Explain the Term “Data Type”. (1 mark) Read More »
Given the following variables, identify the most appropriate data type for each: a) age b) price c) isMember d) initial e) firstName
Appropriate Data Type for each Variable. (5 marks) Read More »
Which data type would be most suitable for storing a person’s full name and why?
The Most Suitable Data Type for Storing a Person’s Full Name and Why. (2 marks) Read More »
Describe three different scenarios where a Boolean data type would be used in a computer program.
Boolean Data Type. (3 marks) Read More »
Study the code below. Identify where casting is used and why it might be useful in this context. quantity = input(“Enter number of products: “) total_cost = input(“Enter total cost of products: “) average_cost = float(total_cost) / int(quantity) print(“Average Cost:”, average_cost)
Consider the variables firstName storing “John” and lastName storing “Smith”. Write a line of code in either OCR’s ERL or a high level language of your choice, to concatenate firstName and lastName with a space between them and store the result in a new variable fullName.
String Concatenation (2 marks) Read More »
Consider a program that tracks temperature changes over time. Explain why a ‘real’ data type would be more suitable than an ‘integer’ for storing these temperatures.
Integer vs Real. (2 marks) Read More »
In a shopping cart application, items have prices and quantities. What data types would you use for the item price and quantity? Justify your choices.
Data Type Choice. (2 marks) Read More »