Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
Question 76

A meteorologist has written a C# program that asks the user to input two atmospheric pressure readings in hectopascals (hPa) as decimal values and then outputs which of the two is the higher pressure (the greater value).

Complete the program by filling in the gaps [1] to [5] using the choices provided in Figure 1. Each option in Figure 1 should only be used once.

Figure 1

writepress1press2input
else<>else if
stringdoubleintfloat
double press1;

[1] press2;

Console.WriteLine("Enter the first pressure reading (hPa): ");
press1 = double.Parse(Console.ReadLine());

Console.WriteLine("Enter the second pressure reading (hPa): ");
press2 = double.Parse(Console.ReadLine());

if (press1 > press2)
{
    Console.WriteLine([2] + " is higher.");
}
else if (press1 [3] press2)
{
    Console.WriteLine([4] + " is higher.");
}

{
    Console.WriteLine("Both pressure readings are equal.");
}
[5]
Markscheme

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts

298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank