MDX Limo
Topic 1 — C++ Foundations (Zero → Exam Level)

Good. We move fast.

Topic 1 — C++ Foundations (Zero → Exam Level)

These basics often appear in MCQ + short answers.


1. Keywords

Reserved words in C++ with fixed meaning.

Examples:

  • int
  • float
  • if
  • else
  • while
  • for
  • return

Exam Definition:

Keywords are reserved words in C++ that have predefined meaning and cannot be used as variable names.


2. Identifiers

Names given to variables, functions, arrays, classes.

Example:

1int age; 2float salary;

Here:

  • age = identifier
  • salary = identifier

Rules:

  • Start with letter or _
  • No spaces
  • No special chars
  • Cannot be keyword

Valid: sum _data marks1

Invalid: 1sum for my-data

Exam Definition:

Identifiers are user-defined names used to identify variables, functions, arrays, etc.


3. Constants

Fixed values that do not change.

Examples:

110 23.14 3'A' 4"Hello"

Types:

  • Integer constant
  • Float constant
  • Character constant
  • String constant

Exam Definition:

A constant is a value that remains unchanged during program execution.


4. Variables

Memory location storing data.

1int a = 10;

a = variable.

Definition:

A variable is a named memory location used to store data.


5. Data Types

Tell compiler what kind of data.

Main types:

TypeMeaningExample
intinteger10
floatdecimal3.5
charcharacterA
doublelarge decimal12.567
booltrue/falsetrue

6. Operators

Used to perform operations.

Arithmetic

+ - * / %

Relational

== != > < >= <=

Logical

&& || !

Assignment

=


7. Input / Output

1cin >> a; 2cout << a;
  • cin → input
  • cout → output

8. #include <stdio.h> / basics

PYQ repeated.

It is a preprocessor directive. Used to include standard input-output header file.

Exam line:

#include <stdio.h> is a preprocessor directive used to include standard I/O functions.


9. Small difference (very common)

Keyword vs Identifier

KeywordIdentifier
Reserved wordUser-defined name
Fixed meaningCustom meaning
Cannot be changedCreated by programmer

10. Easy MCQs (PYQ style)

Answer fast:

  1. for is? → Keyword

  2. abc1 is? → Valid identifier

  3. 3name valid? → No

  4. Fixed value? → Constant

  5. #include<stdio.h> ? → Preprocessor directive


Ultra-short revision

Remember: KIC VDO

  • K = Keyword
  • I = Identifier
  • C = Constant
  • V = Variable
  • D = Data Type
  • O = Operator

Mini test (answer without overthinking):

  1. Is while keyword or identifier?
  2. Is _sum1 valid identifier?
  3. 3.14 is what type constant?
  4. Which operator = logical AND?
  5. char stores what?