0% found this document useful (0 votes)
3 views

Programming Fundamentals – Exam Preparation Guide

This exam preparation guide covers essential C++ programming topics including conditional statements, loops, arrays, functions, nested loops, and pointers. It provides both theory and coding questions to help students prepare effectively, along with tips for time management and avoiding common mistakes during exams. The guide emphasizes practicing these topics for maximum exam success while encouraging the use of additional resources for a comprehensive understanding.

Uploaded by

s2023065073
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Programming Fundamentals – Exam Preparation Guide

This exam preparation guide covers essential C++ programming topics including conditional statements, loops, arrays, functions, nested loops, and pointers. It provides both theory and coding questions to help students prepare effectively, along with tips for time management and avoiding common mistakes during exams. The guide emphasizes practicing these topics for maximum exam success while encouraging the use of additional resources for a comprehensive understanding.

Uploaded by

s2023065073
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

C++ Programming Fundamentals – Exam

Preparation Guide

Created by: Noor Ul Hassan

Share with fellows for full marks!

Topics Covered (7 Sections)


1. Conditional Statements
2. Loops (For, While, Do-While)
3. Arrays
4. Functions
5. Arrays in Functions
6. Nested Loops
7. Basic Pointers

How to Use This Guide


Focus only on these most expected exam questions
Understand the tricks to attempt theory & coding questions
Avoid common mistakes students make in exams
Time management tips to complete your paper effectively

Section 1: Conditional Statements in C++

Theory Questions

1. What are conditional statements? Why are they used?


2. Differentiate between if , if-else , and else-if statements.
3. What is the purpose of the switch statement?
4. Explain the difference between switch and if-else .
5. What happens if a break statement is not used inside a switch case?

Page 1 of 5
Coding Questions

1. Check if a number is positive, negative, or zero using if-else


2. Find whether a number is even or odd using conditional statements
3. Display grades based on marks (A, B, C, D, F)
4. Check if a year is a leap year or not using if-else
5. Implement a simple calculator using the switch statement
6. Find the maximum of three numbers using if-else
7. Check whether a character is a vowel or consonant using switch

Section 2: Loops in C++

Theory Questions

1. What is a loop? Why do we use loops in programming?


2. Differentiate between for , while , and do-while loops.
3. When should we use a while loop instead of a for loop?
4. What is an infinite loop? Give an example.
5. How does a do-while loop work? How is it different from a while loop?

Coding Questions

1. Print numbers from 1 to N using a loop


2. Find the sum of first N natural numbers using a loop
3. Check if a number is prime or not using a loop
4. Find the factorial of a number using a loop
5. Reverse a number using a loop
6. Print the Fibonacci series up to N terms
7. Count the number of digits in an integer using a loop

Section 3: Arrays in C++

Theory Questions

1. Define an array. Why do we use arrays in C++?


2. What is an array index? How is it calculated?
3. Can we change the size of an array after declaration? Why or why not?
4. How does a two-dimensional array differ from a one-dimensional array?

Page 2 of 5
5. What happens if we access an index beyond the array's size?

Coding Questions

1. Declare an integer array of size 10 and initialize it with values


2. Find the maximum and minimum number in an array
3. Find the sum of all even numbers in an array
4. Reverse the elements of an array
5. Count how many times a specific number appears in an array
6. Find the second largest element in an array
7. Sort an array in ascending order using the Bubble Sort algorithm

Section 4: Functions in C++

Theory Questions

1. What is a function in C++?


2. Why do we use functions? List advantages.
3. What is function overloading?
4. Differentiate between call by value and call by reference.
5. Can we return an array from a function? If yes, how?

Coding Questions

1. Find the square of a number using a function


2. Find the smallest number among three numbers using a function
3. Swap two numbers without using a third variable
4. Check if a number is even or odd using a function
5. Calculate the GCD (Greatest Common Divisor) of two numbers
6. Convert Celsius to Fahrenheit using a function
7. Count the number of vowels in a string using a function

Section 5: Arrays in Functions

Theory Questions

1. How are arrays passed to functions in C++?


2. What is the benefit of passing arrays to functions?
3. Can we return an array from a function? Why or why not?

Page 3 of 5
4. What is the importance of passing array size along with an array?
5. What happens when an array is passed by reference?

Coding Questions

1. Print all elements of an array using a function


2. Find the maximum number in an array using a function
3. Reverse an array using a function
4. Merge two sorted arrays into one sorted array
5. Find the sum of all even numbers in an array using a function

Section 6: Nested Loops

Theory Questions

1. What is a nested loop? Provide an example.


2. When do we use nested loops?
3. How many times does the inner loop execute in a nested loop?

Coding Questions

1. Print a square pattern using nested loops


2. Print a pyramid pattern using nested loops
3. Print a hollow rectangle pattern using nested loops
4. Print a multiplication table using nested loops
5. Find the sum of all elements in a 2D array using nested loops

Section 7: Pointers in C++

Theory Questions

1. What is a pointer in C++?


2. How does a pointer store memory addresses?
3. What is the purpose of the * and & operators?

Coding Questions

1. Declare a pointer and assign it a variable's address


2. Swap two numbers using pointers

Page 4 of 5
3. Reverse an array using pointers
4. Demonstrate pointer arithmetic with an example
5. Find the sum of array elements using pointers

Final Exam Tips


Time Management: Solve easy questions first, then attempt longer coding ones
Show Your Work: Write proper comments if the exam allows it
For Coding Questions: Always dry-run your solution before submitting
Use AI tools like ChatGPT to understand logic but practice writing code by yourself!

Ready to Score Full Marks?


Just revise this, practice these questions, and you are set for success!

Good luck with your exam!

Important Note

This guide does not cover the entire Programming Fundamentals syllabus, but maximum exam
questions will be from these topics. However, it's recommended to practice other types of questions on
your own for better understanding.

Created by: Noor Ul Hassan


Share this with your fellows for full marks!

Page 5 of 5

You might also like