Basic Structure of C++ MIS114

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/115

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

116 Terms

1
New cards

Front: What is the basic structure of a C++ program in order?

2
New cards

Back: Documentation Section → Linking Section → Definition Section → Global Declaration Section → Member Function Definitions → Main Function.

3
New cards
4
New cards

Front: What is the Documentation Section used for?

5
New cards

Back: To document the program’s objective, developer, and logic using comments (/* … */).

6
New cards
7
New cards

Front: What does the Linking Section do?

8
New cards

Back: It tells the compiler to link keywords/functions to header files (e.g., #include ).

9
New cards
10
New cards

Front: What is iostream used for?

11
New cards

Back: It contains declarations for cin and cout, which handle input and output.

12
New cards
13
New cards

Front: What is cout?

14
New cards

Back: A predefined object representing the standard output stream; used with << to display data.

15
New cards
16
New cards

Front: What is cin?

17
New cards

Back: A predefined object representing the standard input stream; used with >> to read data.

18
New cards
19
New cards

Front: What is the Definition Section?

20
New cards

Back: It declares constants using #define (e.g., #define MAX 25).

21
New cards
22
New cards

Front: What is the Global Declaration Section?

23
New cards

Back: Where variables and class definitions used throughout the program are declared outside main().

24
New cards
25
New cards

Front: What is the Main Function Section?

26
New cards

Back: main() is where program execution starts; contains declaration and executable sections.

27
New cards
28
New cards

Front: What are the two parts of the main function?

29
New cards

Back: Declaration section (variables) and Executable section (instructions).

30
New cards
31
New cards

Front: What is a data type?

32
New cards

Back: It indicates the type of data stored in a variable (e.g., int, char, float).

33
New cards
34
New cards

Front: What are the three classes of data types in C++?

35
New cards

Back: Primitive, Derived, and User-defined.

36
New cards
37
New cards

Front: What are Primitive Data Types?

38
New cards

Back: Built-in types like int, char, float, bool, double, void.

39
New cards
40
New cards

Front: What is the size and range of an int typically?

41
New cards

Back: 4 bytes, range: -2,147,483,648 to 2,147,483,647.

42
New cards
43
New cards

Front: What is the size of a char?

44
New cards

Back: 1 byte, range: -128 to 127 or 0 to 255.

45
New cards
46
New cards

Front: What values can a bool hold?

47
New cards

Back: true (1) or false (0).

48
New cards
49
New cards

Front: What is the size of a float?

50
New cards

Back: 4 bytes.

51
New cards
52
New cards

Front: What is the size of a double?

53
New cards

Back: 8 bytes.

54
New cards
55
New cards

Front: What does void represent?

56
New cards

Back: A valueless entity; used for functions that do not return a value.

57
New cards
58
New cards

Front: What are Derived Data Types?

59
New cards

Back: Types derived from primitives: Function, Array, Pointer, Reference.

60
New cards
61
New cards

Front: What are User-defined Data Types?

62
New cards

Back: Types defined by the programmer: Class, Structure, Union, Enumeration, typedef.

63
New cards
64
New cards

Front: What is #include used for?

65
New cards

Back: For input/output manipulation, e.g., setprecision().

66
New cards
67
New cards

Front: What does setprecision() do?

68
New cards

Back: Sets the number of decimal places to display in floating-point output.

69
New cards
70
New cards

Front: What are C++ tokens?

71
New cards

Back: The smallest individual units of a program: Keywords, Identifiers, Constants, Variables, Operators.

72
New cards
73
New cards

Front: What are Keywords?

74
New cards

Back: Reserved words with special meaning (e.g., int, class, if).

75
New cards
76
New cards

Front: What are Identifiers?

77
New cards

Back: Names given to variables, functions, classes, etc.

78
New cards
79
New cards

Front: What is an example of a constant?

80
New cards

Back: A fixed value like 5, 3.14, or 'A'.

81
New cards
82
New cards

Front: What is an operator?

83
New cards

Back: Symbols that perform operations (e.g., +, -, ==, <<).

84
New cards
85
New cards

Front: What is the purpose of using namespace std;?

86
New cards

Back: Allows use of names from the standard library without prefixing std::.

87
New cards
88
New cards

Front: In the example program that adds two numbers, what does cin >> x; do?

89
New cards

Back: Waits for user input and stores it in variable x.

90
New cards
91
New cards

Front: How do you print a Boolean variable’s value?

92
New cards

Back: cout prints 1 for true and 0 for false.

93
New cards
94
New cards

Front: What is the >> operator called with cin?

95
New cards

Back: Extraction operator.

96
New cards
97
New cards

Front: What is the << operator called with cout?

98
New cards

Back: Insertion operator.

99
New cards
100
New cards

Front: What is the difference between float and double?