Detailed Explanation of GESP C++ Level 2 Certification Standards

Detailed Explanation of GESP C++ Level 2 Certification Standards

1. Computer Storage and Networking

Knowledge Point Description

  • ROM, RAM, Cache: Functions and differences of Read-Only Memory, Random Access Memory, and Cache Memory
  • Classification of Computer Networks: Wide Area Network (WAN), Metropolitan Area Network (MAN), Local Area Network (LAN)
  • TCP/IP Four-Layer Model and OSI Seven-Layer Model: Network hierarchy structure and functions
  • IP Address and Subnetting: IP address format and subnetting principles
#include <iostream>
using namespace std;

int main() {
    cout << "ROM: Read-Only Memory, data is not lost after power off" << endl;
    cout << "RAM: Random Access Memory, data is lost after power off" << endl;
    cout << "Cache: Cache Memory, a buffer between CPU and memory" << endl;
    cout << "TCP/IP Four-Layer Model: Application Layer, Transport Layer, Network Layer, Network Interface Layer" << endl;
    cout << "IP Address Format: 192.168.1.1" << endl;
    return 0;
}

2. Classification of Programming Languages

Knowledge Point Description

Language Type Characteristics Common Languages
Machine Language Binary instructions
Assembly Language Low-level symbolic language
High-Level Language Close to natural language C++, Python, Java
#include <iostream>
using namespace std;

int main() {
    cout << "Machine Language: Binary code executed directly by the computer" << endl;
    cout << "Assembly Language: Low-level language using mnemonics" << endl;
    cout << "High-Level Language: Languages like C++, Python that are easy for humans to understand" << endl;
    return 0;
}

3. Concept of Flowcharts

Knowledge Point Description

  • Basic symbols of flowcharts: Start/End, Process, Decision, Input/Output
  • Three basic structures: Sequence, Branch, Loop
#include <iostream>
using namespace std;

int main() {
    int score;
    cout << "Please enter the exam score: ";
    cin >> score;
    
    // Branch structure implemented by flowchart
    if(score >= 90) {
        cout << "Excellent" << endl;
    } else if(score >= 60) {
        cout << "Pass" << endl;
    } else {
        cout << "Fail" << endl;
    }
    return 0;
}

4. ASCII Encoding

Problem: Character Conversion

Problem Description Input a character; if it is an uppercase letter, convert it to a lowercase letter; if it is a lowercase letter, convert it to an uppercase letter, and output its ASCII value.

Input Format One line, one character

Output Format Two lines: the first line is the converted character, the second line is its ASCII value

Input Example

A

Output Example

a
97

Data Range The input character is a letter

Reference Code

#include <iostream>
using namespace std;

int main() {
    char c;
    cin >> c;
    
    if(c >= 'A' && c <= 'Z') {
        c = c + 32;  // Convert uppercase to lowercase
    } else if(c >= 'a' && c <= 'z') {
        c = c - 32;  // Convert lowercase to uppercase
    }
    
    cout << c << endl;
    cout << (int)c << endl;
    return 0;
}

Code Explanation

  1. Input a character
  2. Check if it is an uppercase letter (ASCII 65-90)
  3. If it is uppercase, add 32 to convert to lowercase (ASCII 97-122)
  4. If it is lowercase, subtract 32 to convert to uppercase
  5. Output the converted character and its ASCII value

5. Data Type Conversion

Problem: Temperature Conversion

Problem Description Input Fahrenheit temperature and convert it to Celsius (Conversion formula: C = (F – 32) * 5/9)

Input Format One line, a floating-point number representing Fahrenheit temperature

Output Format One line, the converted Celsius temperature (rounded to two decimal places)

Input Example

77

Output Example

25.00

Reference Code

#include <iostream>
#include <iomanip>
using namespace std;

int main() {
    float fahrenheit;
    cin >> fahrenheit;
    
    // Implicit type conversion
    float celsius = (fahrenheit - 32) * 5 / 9;
    
    // Example of explicit type conversion
    int intCelsius = static_cast<int>(celsius);
    
    cout << fixed << setprecision(2) << celsius << endl;
    return 0;
}

Code Explanation

  1. Input Fahrenheit temperature (floating-point number)
  2. Use the formula to calculate Celsius temperature with implicit type conversion
  3. Example of explicit type conversion using static_cast
  4. Output the result rounded to two decimal places

6. Multi-Level Branch Structure

Problem: Grade Rating

Problem Description Input student score (0-100) and output the rating based on the score:

  • 90-100: A
  • 80-89: B
  • 70-79: C
  • 60-69: D
  • 0-59: E

Input Format One line, an integer representing the score

Output Format One line, a letter representing the rating

Input Example

85

Output Example

B

Reference Code

#include <iostream>
using namespace std;

int main() {
    int score;
    cin >> score;
    
    // Multi-level branch structure
    if(score >= 90) {
        cout << "A" << endl;
    } else if(score >= 80) {
        cout << "B" << endl;
    } else if(score >= 70) {
        cout << "C" << endl;
    } else if(score >= 60) {
        cout << "D" << endl;
    } else {
        cout << "E" << endl;
    }
    
    // Implementing with switch statement
    switch(score/10) {
        case 10:
        case 9: cout << "A"; break;
        case 8: cout << "B"; break;
        case 7: cout << "C"; break;
        case 6: cout << "D"; break;
        default: cout << "E";
    }
    
    return 0;
}

Code Explanation

  1. Using if-else if-else to implement multi-level branching
  2. Using switch-case to achieve the same functionality
  3. Converting score to integer level by dividing by 10

7. Multi-Level Loop Structure

Problem: Multiplication Table

Problem Description Output an n×n multiplication table

Input Format One line, an integer n (1≤n≤9)

Output Format n lines, each line containing several multiplication expressions, separated by spaces

Input Example

3

Output Example

1*1=1 
1*2=2 2*2=4 
1*3=3 2*3=6 3*3=9 

Reference Code

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    
    // Outer loop controls rows
    for(int i = 1; i <= n; i++) {
        // Inner loop controls columns
        for(int j = 1; j <= i; j++) {
            cout << j << "*" << i << "=" << i*j;
            if(j < i) cout << " ";  // Add space if not the last one
        }
        cout << endl;
    }
    return 0;
}

Code Diagram Steps

i=1: j=1 → Output 1*1=1
i=2: j=1 → Output 1*2=2, j=2 → Output 2*2=4
i=3: j=1 → Output 1*3=3, j=2 → Output 2*3=6, j=3 → Output 3*3=9

8. Application of Mathematical Functions

Problem: Solve a Quadratic Equation

Problem Description Solve the roots of the quadratic equation ax²+bx+c=0

Input Format One line, three floating-point numbers a, b, c (a≠0)

Output Format Two lines, two real roots (rounded to two decimal places). If there are two distinct real roots, output them in ascending order. If there are two identical real roots, output the same value twice. If there are no real roots, output “No real roots”.

Input Example 1

1 -3 2

Output Example 1

1.00
2.00

Input Example 2

1 2 1

Output Example 2

-1.00
-1.00

Reference Code

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
    double a, b, c;
    cin >> a >> b >> c;
    
    double delta = b*b - 4*a*c;
    
    if(delta < 0) {
        cout << "No real roots" << endl;
    } else {
        double sqrt_delta = sqrt(delta);  // Square root function
        double x1 = (-b - sqrt_delta) / (2*a);
        double x2 = (-b + sqrt_delta) / (2*a);
        
        // Ensure output in ascending order
        if(x1 > x2) swap(x1, x2);  // Use swap function
        
        cout << fixed << setprecision(2);
        cout << x1 << endl << x2 << endl;
    }
    return 0;
}

Code Explanation

  1. Input coefficients a, b, c
  2. Calculate the discriminant delta = b²-4ac
  3. Use the sqrt() function to calculate the square root
  4. Determine the nature of the roots based on the delta value
  5. Use the swap() function to ensure roots are output in order
  6. Use setprecision to control output precision

9. Distribution of Exam Question Types

Question Type Quantity Score Total Score
Multiple Choice Questions 15 questions 2 points 30 points
True/False Questions 10 questions 2 points 20 points
Programming Questions 2 questions 25 points 50 points

Exam Duration: 120 minutes

Note: The Level 2 exam focuses on multi-branch structures, multi-level loops, data type conversions, and basic algorithm implementation capabilities. Mastering these knowledge points is key to achieving good results.

Detailed Explanation of GESP C++ Level 2 Certification StandardsPlease add Teacher Cui’s WeChat: jikieping to receive electronic materials.

Leave a Comment