100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

AQA GCSE COMPUTER SCIENCE Paper 1 Computational thinking and programming skills – C# 2023

Rating
-
Sold
-
Pages
98
Grade
A+
Uploaded on
12-01-2024
Written in
2023/2024

Figure 1 shows an algorithm, represented using pseudo-code, which assigns a different value to four variables. Figure 1 country  'United States of America' state  'California' city  'San Francisco' landmark  'Alcatraz Island' . 1 Define the term algorithm. The variable x is assigned a value using the statement: x  LEN(state) Using Figure 1, what is the value of x? Shade one lozenge. What is the result of concatenating the contents of the variables city and landmark in Figure 1? Shade one lozenge. The subroutine SUBSTRING extracts characters from a given string. For example, SUBSTRING(3, 5, 'Computing') would return put The variable y is assigned a value using the statement: y  SUBSTRING(4, 7, landmark) Using Figure 1, what is the value of y? Shade one lozenge. The subroutine POSITION finds the first position of a character in a string. For example, POSITION('Computing', 'p') would return 3 The variable z is assigned a value using the statement: z  POSITION(landmark, 't') Using Figure 1, what value is assigned to z? Shade one lozenge. Figure 2 shows an algorithm that uses integer division which has been represented using pseudo-code. • Line numbers are included but are not part of the algorithm. Figure 2 1 again  True 2 WHILE again = True 3 a  USERINPUT 4 IF a > 0 THEN 5 counter  0 6 WHILE a > 0 7 a  a DIV 3 8 counter  counter + 1 9 ENDWHILE 10 ELSE 11 again  False 12 ENDIF 13 OUTPUT a 14 ENDWHILE Integer division is the number of times one integer divides into another, with the remainder ignored. For example: • 14 DIV 5 evaluates to 2 • 25 DIV 3 evaluates to 8 11 Do not write outside the box Turn over ► IB/G/Jun23/8525/1A . 1 0 2 Where is iteration first used in the algorithm in Figure 2? Shade one lozenge. Figure 3 shows a program written in C# that calculates the area of a rectangle or the volume of a box from the user inputs. Figure 3 public static int calculate(int width, int length, int height) { if (height == -1) { return width * length; } else { return width * length * height; } } public static void Main() { int numOne, numTwo, numThree, answer; Console.Write("Enter width: "); numOne = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter length: "); numTwo = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter height, -1 to ignore: "); numThree = Convert.ToInt32(Console.ReadLine()); answer = calculate(numOne, numTwo, numThree); if (numThree == -1) { Console.WriteLine($"Area {answer}"); } else { Console.WriteLine($"Volume {answer}");

Show more Read less
Institution
Computer Science
Course
Computer Science











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Computer Science
Course
Computer Science

Document information

Uploaded on
January 12, 2024
Number of pages
98
Written in
2023/2024
Type
Exam (elaborations)
Contains
Only questions

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
twishfrancis Kaplan University
View profile
Follow You need to be logged in order to follow users or courses
Sold
199
Member since
1 year
Number of followers
42
Documents
10607
Last sold
15 hours ago
SmartStudy Hub

Discover top-quality study materials at SmartStudy Hub. From concise summaries to exam guides, I offer resources designed to boost your grades. Trust in my expertise and elevate your academic performance today! NB: I do assignments too. Struggling to meet your academic deadlines? I've got you covered! I'll ensure papers are delivered on time, each time. Don't let deadlines stress you out- let's work together to achieve your academic goals! WELCOME!!!

Read more Read less
4.0

37 reviews

5
22
4
5
3
4
2
0
1
6

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions