9.7 KiB
🔧 C++ Intermediate Exam Created
✅ Exam Details
Exam ID: cpp-intermediate-v1
Title: C++ Intermediate - OOP & Practical Coding
Subject: C++
Difficulty: Intermediate
Duration: 90 minutes
Passing Score: 70%
📊 Exam Structure
Total Questions: 6 Total Points: 110 points
Question Type Breakdown
- ✅ 1 Single Choice (10 points)
- ✅ 1 Multiple Choices (15 points)
- ✅ 1 True/False (10 points)
- ✅ 1 Simple Coding Task (20 points)
- ✅ 1 Simple Coding Task (25 points)
- ✅ 1 Advanced Coding Exercise (30 points)
Theory Questions: 35 points (auto-graded) Coding Tasks: 75 points (requires manual grading)
📚 Section 1: OOP Theory & Concepts (3 questions, 35 points)
Q1: Virtual Function Control (Single Choice, 10 points)
Topic: C++11 'final' keyword Question: How to prevent derived class from overriding a virtual function? Answer: Use the 'final' keyword Tests: Understanding of modern C++ features
Q2: Rule of Five (Multiple Choices, 15 points)
Topic: Special member functions in C++11 Question: Which are included in the Rule of Five? Correct Answers:
- A: Copy constructor ✓
- B: Move constructor ✓
- C: Move assignment operator ✓
- D: Default constructor (NOT in Rule of Five) Tests: Understanding of resource management
Q3: Pure Virtual Functions (True/False, 10 points)
Topic: Abstract classes Question: Must pure virtual function be implemented in base class? Answer: False (implemented in derived classes) Tests: Understanding of polymorphism
💻 Section 2: Practical Coding Tasks (3 tasks, 75 points)
Task 1: Recursive Factorial (Simple Coding, 20 points)
Objective: Implement recursive factorial function
Requirements:
- Function name:
factorial - Parameter: non-negative integer n
- Return type:
unsigned long long - Must use recursion
Test Cases:
factorial(0) → 1 (public)
factorial(1) → 1 (public)
factorial(5) → 120 (public)
factorial(10) → 3628800 (hidden)
Skills Tested:
- Recursion understanding
- Base case handling
- Correct return type
- Edge case handling (0!)
Grading: Automatic based on test cases
Task 2: Palindrome Checker (Simple Coding, 25 points)
Objective: Implement palindrome detection with case and space handling
Requirements:
- Function name:
isPalindrome - Parameter:
std::string - Return type:
bool - Ignore case and spaces
Test Cases:
isPalindrome("racecar") → true (public)
isPalindrome("hello") → false (public)
isPalindrome("A man a plan a canal Panama") → true (public)
isPalindrome("Race Car") → true (hidden)
Skills Tested:
- String manipulation
- Character comparison
- Case conversion
- Space filtering
- Two-pointer technique or string reversal
Grading: Automatic based on test cases
Task 3: Vector2D Class (Advanced Coding Exercise, 30 points)
Objective: Design and implement a complete 2D vector class
Requirements: Implement class with:
- Constructor:
Vector2D(double x, double y) - operator+: Vector addition
- operator*: Dot product (returns
double) - magnitude(): Returns vector length
- normalize(): Returns unit vector in same direction
Example Usage:
Vector2D v1(3, 4);
Vector2D v2(1, 2);
Vector2D v3 = v1 + v2; // (4, 6)
double dot = v1 * v2; // 11
double mag = v1.magnitude(); // 5
Vector2D unit = v1.normalize(); // (0.6, 0.8) or (3/5, 4/5)
Test Cases:
Vector2D(3, 4) + Vector2D(1, 2) → Vector2D(4, 6) (public)
Vector2D(3, 4) * Vector2D(1, 2) → 11 (public)
Vector2D(3, 4).magnitude() → 5 (public)
Vector2D(6, 8).normalize().magnitude() → 1 (approx) (hidden, 2× weight)
Skills Tested:
- Class design
- Operator overloading
- Mathematical operations
- Member function implementation
- const correctness
Grading Rubric:
- Constructor: 20%
- operator+ overloading: 20%
- operator* overloading: 20%
- magnitude() method: 20%
- normalize() method: 20%
Grading: Manual review with rubric + automated tests
Starter Code Provided:
class Vector2D {
private:
double x, y;
public:
// Your implementation here
};
🎯 Topics Covered
OOP Concepts
- Virtual functions and polymorphism
- 'final' keyword (C++11)
- Rule of Five (C++11)
- Pure virtual functions
- Abstract classes
- Special member functions
Coding Skills
- Recursion: Base cases, recursive calls
- String Manipulation: Case handling, character filtering
- Class Design: Encapsulation, operator overloading
- Mathematical Operations: Vector math, normalization
- Modern C++: Smart syntax, const correctness
⚠️ Important Notes
Auto-Grading
Questions 1-3 (Theory): ✅ Auto-graded Question 4 (Factorial): ✅ Auto-graded (test cases) Question 5 (Palindrome): ✅ Auto-graded (test cases) Question 6 (Vector2D): ⚠️ Requires manual grading
Manual Grading Required
- The Vector2D class (Q6) has a rubric for manual assessment
- Auto-grading will run test cases
- Instructor should review code quality
- Check: proper operator overloading, const correctness, code style
🎓 Difficulty: Intermediate
Why Intermediate?
Theory:
- Covers C++11+ features (final, move semantics)
- Requires understanding of advanced OOP
- Not just basic syntax
Coding:
- Recursion (non-trivial)
- String processing with filtering
- Full class implementation with operator overloading
- Mathematical computations
- Multiple member functions
Not Beginner Because:
- Requires OOP mastery
- Operator overloading needed
- Modern C++ features tested
- Complex string manipulation
Not Advanced Because:
- No templates or metaprogramming
- No concurrency
- No advanced memory management
- Standard problems with clear solutions
📊 Expected Performance
Score Ranges
- 90-100% - Strong intermediate C++ skills
- 80-89% - Good understanding, minor issues
- 70-79% - Passing, needs practice
- 60-69% - Below passing, review OOP & coding
- <60% - Need to strengthen fundamentals
Time Management
- Q1-Q3 (Theory): 10-15 minutes total
- Q4 (Factorial): 10-15 minutes
- Q5 (Palindrome): 15-20 minutes
- Q6 (Vector2D): 35-45 minutes
- Review: 5-10 minutes
- Total: 75-90 minutes
🔗 Integration with Learning Plan
This exam aligns with:
- C++ Learning Plan - Phase 2: OOP
- Covers Modules 2.1-2.3, 2.5
- Tests: Classes, operator overloading, polymorphism
- Prepares for Phase 3 (Modern C++)
Prerequisites
Before taking this exam, complete:
- C++ Phase 1 (all modules) - Must be mastered
- Module 2.1: Classes & Objects
- Module 2.2: Advanced Constructors
- Module 2.3: Operator Overloading
- Module 2.5: Polymorphism (virtual functions)
After Passing
- Continue to Module 2.6: Templates Basics
- Study Module 2.7: Exception Handling
- Move to Phase 3: Modern C++
- Take advanced exam (future)
🚀 How to Access
Via Web Interface
- Go to http://localhost
- Login or register
- Navigate to "Available Exams"
- Select "C++ Intermediate - OOP & Practical Coding"
- Click "Start Exam"
Via API
# Get exam details
curl http://localhost/api/exams/cpp-intermediate-v1/
💡 Preparation Tips
For Theory Questions
- Review C++11 features: final, override, move semantics
- Understand Rule of Five vs Rule of Three
- Master virtual functions and pure virtual functions
- Know when to use which feature
For Coding Task 1 (Factorial)
- Practice recursion with base cases
- Handle edge case: 0! = 1
- Use correct return type (unsigned long long)
- Test with small and large inputs
For Coding Task 2 (Palindrome)
- Review string methods: tolower(), isspace()
- Practice two-pointer technique
- Handle mixed case correctly
- Filter out non-alphanumeric characters
For Coding Task 3 (Vector2D)
- Review operator overloading syntax
- Understand dot product formula
- Practice sqrt() for magnitude
- Remember to normalize: divide by magnitude
- Make methods const where appropriate
📐 Mathematical Formulas for Vector2D
Vector Addition
(x₁, y₁) + (x₂, y₂) = (x₁ + x₂, y₁ + y₂)
Dot Product
(x₁, y₁) · (x₂, y₂) = x₁x₂ + y₁y₂
Magnitude
||(x, y)|| = √(x² + y²)
Normalization
normalize(x, y) = (x/||v||, y/||v||)
📈 All Available Exams
- Python Easy - 10 questions (auto-graded)
- Python Easy 15Q - 15 questions (auto-graded)
- Python Intermediate - 50 questions (auto-graded)
- C++ Easy - 20 questions (auto-graded)
- C++ Intermediate - 6 questions (mixed grading) ⭐ NEW
- Linear Algebra Medium - 10 questions (auto-graded)
Total: 6 exams across 3 subjects!
🌟 Exam Features
Modern Question Types
✅ Single choice ✅ Multiple choices with partial credit ✅ True/False ✅ Simple coding tasks (auto-tested) ✅ Advanced coding exercises (rubric + tests) ✅ "I Don't Know" option
Grading Features
✅ Automatic scoring for theory ✅ Test case validation for simple code ✅ Rubric-based for complex code ✅ Detailed feedback ✅ Code quality assessment
Coding Environment
✅ Syntax highlighting ✅ Auto-save every 10 seconds ✅ Test case visibility (public/hidden) ✅ Starter code provided ✅ Clear requirements
Your C++ Intermediate exam is ready! Test your OOP and coding skills! 🔧💻
Created: October 21, 2025 Status: ✅ Published and Available Access: http://localhost Note: Question 6 requires manual grading for full assessment