first Flashcards

1
Q

How does the c++ program run?

A

The operating system runs c++ program by calling main ()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the four elements of function definition?

A

Name, return type, formal parameter, and the body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does it mean when we say built in types?

A

Defined by the language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Can you explain how return works?

A

it returns value to the function caller but you can also provide a value, but it must be the same as the return type, example if the return type is int the value returned must be int too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a type?

A

defines the contents of a data element and the possible operations possible on those data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Source file

A

file that contains source code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain why we need to provide suffix for the file? Give some examples of a C++ suffix

A

The suffix tells the system that the file is a C++ program. .cp .cpp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a library and why do we need it.

A

Collection of classes and functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a stream?

A

Sequence of characters read from or written to an IO device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the term stream suggest?

A

It is intended to suggest that characters are generated and consumed sequentially overtime

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is iostream?

A

Header that provides the library types for stream-oriented

input and output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Define iostream

A

iostream defines cin, cout, cerr, clog, which corresponds to standard input stream, standard output stream, unbuffered standard error stream, and buffered standard error stream.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Standard input and output

A

Input and output associated with the window in which the program executes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Standard error

A

Output stream used for error reporting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

cin (see-in)
cout (see-out)
cerr
clog

A

istream object used to read from the standard input
ostream object used to write to standard output
ostream object used for error messages
ostream object used to report information about program execution to a log file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

include pre-processor directive

A

tells the compiler to include a library or header

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is expression?

A

composed of one or more operands and an operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Explain the output operator

A

Takes two operands, left-hand operand must be an ostream object and right-hand operand which is the actual value to be printed, output operator writes the value be printed to the left-hand operand. which will be the result of output operator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Why is it possible to chain output request?

A

Result of first operator becomes the left-hand operand for the next operator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

String literal

A

Sequence of characters enclosed with a double quotation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Manipulator

A

Manipulates the stream itself.

22
Q

endl()

A

Ends the line and flushes the buffer.

23
Q

Buffer

A

Region of storage used to hold data

24
Q

Why do we flush the buffer?

A

To ensure that output generated by our program is actually written in output stream, rather that sitting in memory waiting to be written.

25
Q

What this namespace statement mean ? std::cout

A

means that the name cout is defined inside the namespace called std

26
Q

Why use namespace?

A

to avoid using the same names we define and names inside the library.

27
Q

scope resolution::

A

used to access namespace

28
Q

comments and it’s uses

A

Program text that is ignored by the compiler. summarize an algo, identify the purpose of variable and expalain a segment of code.

29
Q

Condition

A

expression that yields a result that is either true or false

30
Q

Assignment

A

Replaces object’s current value by a new one.

31
Q
< less than operator
<= less than or equal to operator
>  greater than operator
>= greater than or equal to operator
== equality operator
!=  inequality operator
A

tests whether the left-hand operand is less than the right-hand operand.

tests whether the left-hand operand is less than or equal to the right-hand operand.

tests whether the left-hand operand is greater than the right-hand operand.

tests whether the left-hand operand is greater than or equal to the right-hand operand.

tests whether the left-hand operand is equal to the right-hand operand.

tests whether the left-hand operand is not equal to the right-hand operand.

32
Q

+= compound assignment operator

A

Adds right-hand operand to the left and stores the result in left-hand operand.

33
Q

++ increment operator

A

add 1 to it’s operand.

34
Q

– decrement operator

A

subtracts 1 to it’s operand

35
Q

While loop

A

loop that executes statements as long as the condition is true.

36
Q

For loop

A

loop that executes a specific number of times

37
Q

What happens when we use istream as a condition?

A

test the state of the stream. if input is valid it is true but if the input is ivalid then we will have eof.

38
Q

Explain Syntax error, Type errors, Declaration errors

A
39
Q

Why is it a good idea to correct erros?

A

because it can have cascading effect causing compiler to report more errors than what is actually present.

40
Q

Edit-compile-debug

A

process of getting the program to execute properly.

41
Q

if statement

A

consist of condition and statement to be executed if the condition is true.

42
Q

How Indentation and Formatting helps our program?

A

readability and understandability

43
Q

data structure

A

logical grouping of data and operation on that data.

44
Q

Class

A

Facility for defining our own data structures together with

associated operations.

45
Q

Class type

A

type defined by a class, the name of the type is the class name.

46
Q

purpose of header?

A

to access the classes defined for our own application

47
Q

include <> and #include “”

A

part of standard library and user defined

48
Q

member function

A

operation defined by a class

49
Q

. operator

A

left-hand operand is an object of a class and righthand operand is a class member.

50
Q

() call operator.

A

causes the function to be invoked.

51
Q

arguments

A

Value passed to a function.