converted_text (1)
converted_text (1)
Chapter #01
Short Q/A
An index in an array is required to access elements efficiently. It allows direct access to any
element using its position, improving performance.
Advantages:
1. Systematic problem-solving approach.
Long Q/A
Stack: Follows Last In, First Out (LIFO) order (e.g., undo operation in text editors).
Queue: Follows First In, First Out (FIFO) order (e.g., printer queue).
2. Define flowchart and explain its five symbols.
Symbols:
Oval: Start/End
Rectangle: Process
Parallelogram: Input/Output
Diamond: Decision
Chapter #02
Short Q/A
Machine language: Written in binary (0s and 1s), directly understood by the computer.
Assembly language: Uses mnemonics (e.g., ADD, MOV) instead of binary, requires an assembler.
Data types: Define the kind of value a variable can store (e.g., integer, float).
Storage: The memory required for each data type (e.g., int = 4 bytes).
Constant: A value that does not change (e.g., const float pi = 3.14;).
Variable: A named memory location that holds a value which can change.
Long Q/A
Types:
Components:
Code Editor
Debugger
Compiler
---
Chapter #03
Short Q/A
\n New line
\t Tab space
\\ Backslash
3. Define comment statements and types in C++.
Types:
Single-line (//)
Preprocessor directives (e.g., #include <iostream>) tell the compiler to include specific files.
Chapter #04
Short Q/A
The default keyword is used in a switch statement to handle cases not covered by case labels.
2. Function of for loop.
Example: