final notes part a Flashcards

1
Q

File Write Name Program Key Information:

A

-offstream-:aisle location]
-.open going tothe begining of next file
-txt file name
-output going to file to redress it where it is redsides
-\n without it we don’t know where to read it

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

Fstream:

A

able to get information from the file to the keyboard

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

ofrstream

A

outfile

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

string

A

Strings are used for storing text.

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

ifstream

A

infile

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

recursion

A

Recursion in C++ is a technique in which a function calls itself repeatedly until a given condition is satisfied. In other words, recursion is the process of solving a problem by breaking it down into smaller, simpler sub-problems.

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

base case

A

is a piece of code that allows us to end a recursive function

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

binarySearch() is a recursive function

A

that is used to find the required element in the array using binary search. The …

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

struct

A

Structures (also called structs) are a way to group several related variables into one place. Each variable in the structure is known as a member of the structure.

Unlike an array, a structure can contain many different data types (int, string, bool, etc.).

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

cmath

A

for the pow function

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

Adresses

A

-declare a variable(25)
-populate with a number(5)
-&x shows the adress display it

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

ctsd libary allows you ti

A

clear a system

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

pointer variable:

A

-memory adress
-it points to some piece of data that is stored in the comput
ers memory
-manipulate x (abc)

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

int variable

A

hold intergers

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

double var

A

hold floating point numbers

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

2d array

A

-2-d arrays can be defiined as an array of arrays
it can also represents a matrix
each element represent as Arr[row][column], where Arr[][] is the 2d array

17
Q

parrell array

A

is a structure that contains multiple arrays. Each of these arrays are of the same size and the array elements are related to each other. All the elements in a parallel array represent a common entity.

employee_name = { Harry, Sally, Mark, Frank, Judy }
employee_salary = {10000, 5000, 20000, 12000, 5000}

18
Q

array sequential search

A

Sequential search in C++ is also called a linear search. This searching technique is very simple, to perform this technique the user starts the loop from the zero index of an array to the last index of an array. It starts from the first index and compared the required value with the first value.

If the required value is found it will show the result otherwise compare the value of next index and it will continue until the required value is found or loop completes without finding any value.

19
Q

array bubble sort

A

Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. This algorithm is not suitable for large data sets as its average and worst-case time complexity is quite high.

20
Q

array binary search

A

Binary Search is defined as a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(

21
Q

do while loop

A

-The do/while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true.
-The example below uses a do/while loop. The loop will always be executed at least once, even if the condition is false, because the code block is executed before the condition is tested:

22
Q

continue y/n

A

char choice =’y’
while(choice==’y’||choice ==’y’)

23
Q

reference

A

A reference variable provides a new name to an existing variable. It is dereferenced implicitly and does not need the dereferencing operator * to retrieve the value referenced.

24
Q

functions layout

A

declare,dacall,define

25
Q

void

A

-When used as a function return type, the void keyword specifies that the function doesn’t return a value. When used for a function’s parameter list, void specifies that the function takes no parameters.
-When used in the declaration of a pointer, void specifies that the pointer is “universal.

26
Q

int sum(int,int);

A

int=return type
sum=name
()=parmater playlist

27
Q

passing and returning objects in c++

A

In C++ we can pass class’s objects as arguments and also return them from a function the same way we pass and return other variables. No special keyword or header file is required to do so.

28
Q

for loop and while

A

initialize,compare, statement,new value

29
Q

for loop

A

For example, let’s say we want to show a message 100 times. Then instead of writing the print statement 100 times, we can use a loop.

That was just a simple example; we can achieve much more efficiency and sophistication in our programs by making effective use of loops.

30
Q

while loop

A

Loops can execute a block of code as long as a specified condition is reached.

Loops are handy because they save time, reduce errors, and they make code more readable.

31
Q

for loop and while loop

A

Both for loop and while loop is used to execute the statements repeatedly while the program runs. The major difference between for loop and the while loop is that for loop is used when the number of iterations is known, whereas execution is done in the while loop until the statement in the program is proved wrong.

32
Q

if else statement

A

In computer programming, we use the if…else statement to run one block of code under certain conditions and another block of code under different condition

33
Q

&& ||

A

returns true if both operands are true and returns false otherwise
||The logical “or” operator works similarly to the ”and” operator above. The difference is that “or” will return “true” if either the left or the right operand is true. The || operator will only return a false value if both operands are false.

34
Q

math library math

A

declares a set of functions to perform mathematical operations

35
Q

random number

A

rand()%100 +1