C++ Programming Exam
8 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What structured programming technique uses graphical representation to show the steps to solve a problem?

Flowchart

In C++, how do you write a single-line comment?

//Comment

When can a function prototype be omitted in C++?

When a function is defined before it is first invoked.

Which method is not commonly used to solve problems in computer science?

<p>Inductive analysis</p> Signup and view all the answers

What is the correct syntax to declare and initialize an array called 'students' with specific names in C++?

<p>string students[] = { &quot;Richard&quot;, &quot;Elizabeth&quot;, &quot;Jordan&quot;, &quot;Jose&quot; };</p> Signup and view all the answers

How would you declare an integer array 'arr' with 15 elements in C++?

<p>int arr[15];</p> Signup and view all the answers

Explain the concept of 'top-down design' in programming.

<p>Top-down design involves breaking down a program into smaller, manageable parts, starting from the highest level.</p> Signup and view all the answers

What does the term 'pseudocode' refer to in programming?

<p>Pseudocode is a way to describe an algorithm using informal programming-like language.</p> Signup and view all the answers

Study Notes

Exam Instructions

  • The exam is 2 hours long
  • The paper has 6 pages and 2 sections
  • Section A is multiple-choice
  • Section B is programming questions
  • Answer all questions
  • Total marks: 60

Section A - Multiple Choice Questions (15 marks)

  • Question 1: Structured programming technique graphically representing program steps is a flowchart.
  • Question 2: Correct C++ single-line comment syntax is //Comment.
  • Question 3: A function prototype can be omitted when the function is defined before it's called.
  • Question 4: Difference reduction is not a common problem-solving method in computer science.
  • Question 5: Correct declaration of a string array "students" initialized with values is string students[4] = {"Richard", "Elizabeth", "Jordan", "Jose"};
  • Question 6: The correct code to iterate through an integer array arr with 15 elements and display each element is int arr[15]; for (int i = 0; i < 15; i++) { cout << arr[i] << " "; }

Section B - Programming Questions (45 marks)

  • Question 1:
    • Member functions for reading and writing data to/from a file at a specific position
    • Short example code snippets for each are needed
  • Question 1 (continued): Data from a file named students.txt (first name, last name, and grade) is used to calculate the average grade and find the student with the highest grade.
  • Question 2:
    • Three unique features of a constructor function
    • Explanation of private, public, and protected access modifiers.
    • Function declarations for an overloaded function getSum() that takes 2,3 or 4 integers as parameters. (Don't write the entire program, only declarations).
  • Question 3:
    • C++ code to create a Person struct, assign values to its members (citizenship and age), and display them.
    • Class declaration and definition code for an Aeroplane class (based on the UML diagram).
    • Instantiate two objects: one with the default constructor and the other with the parameterized constructor.
    • Display the Aeroplane details (using displayAeroplane function)

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Description

This C++ programming exam consists of multiple-choice questions and programming tasks. Covering essential concepts, students must demonstrate their understanding of structured programming techniques, syntax, and code iteration. The exam is designed for a total of 60 marks and lasts for 2 hours.

More Like This

Use Quizgecko on...
Browser
Browser