Unit 4 (Computational thinking) Flashcards

1
Q

If you want to solve a problem you must follow 5 steps

A
Information
Ideifnicition
Delvopment(epplore various alternatives, and develop solutions)
Selection
Implementation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Flowchart is used to:

A

Flowhcart is used to diagrammaticaly describe an alorigthim

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

Sub-procedures mean

A

Sub-procedures mean you

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

An algorithm is:

A

An algorithm: is a serious of instructions designed to solve a problem and achieve a certain goal.

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

An algorithm must have the following properties: Finitness, definiteness, input, output effectiveness

A

Finiteness: An algorithm must always terminate after a number of steps
Definiteness: Steps must be precisely defined
Input: quanntites which are given to it initially before algorithm begins (whats put into the alg)
Output: the result of the algorithm

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

An identifier:

A

An idenfitifer: is the name that is used by the programmer to uniquely idiefntiy a variable, an object, a sub procedure etc.

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

Iteration is:

A

Iteration: is the process of repeating a series of instructions

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

Condition statement:

A

Condition statement: prefroms different instructions depending on a boolean test

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

Pre-planning:

A

Pre planning: is the process of planning osmehting in advance

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

Prefechting:

A

Prefecthing: means getting data or instruction from memory into the cache before they are actually needed. Ex, when a program requests data that was previously prefetched, it can use the pre fetched data and continue with execution, instead of waiting for the data from RAM.
`

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

Gannt chart:

A

Gannt chart: is a type of bar chart that is used for project sceuhle and project management.

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

Pre-condition:

A

Pre condition: indicates what must be true before before the sub-procudre is called

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

Post-condition:

A

Post-condiiton: indnaites what will be true when the sub producide completes its task. Ex, when cooking a meal for dinner all the necessary ingredients should be available before cooking. This is a precondition of the algorithm cooking. Agter cooking a table is neeed to facilitate eating. This is ht epost-condition for a proper dinner.

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

Exception:

A

Exception: is an act or event that disrupts the anticipated flow of the program’s execution.

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

Concurrent: and Concurrent processing

A

Concurrent: means something that happens at the same time as something else.
: means the execution of different instructions simultaneous by mutliply processor to achieve the best performance.

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

Abstract thinking:

A

Abstract thinking: means reflecting on events, ideas, attributes and relationships in a manner that hies all unnecessary details of specific objects.

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

Object-orinted programming:

A

Object-orinted programming: uses abstraction and is based on the principle that all everyday taste can be considered as entities. These entities are either objects or events. So it desibres data (properoties) and behavior (methods) of real objects. he main ideas behind Java’s Object-Oriented Programming, OOP concepts include abstraction, encapsulation, inheritance and polymorphism. Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects. In functional programming, data cannot be stored in objects, and it can only be transformed by creating functions. In object-oriented programming, data is stored in objects

18
Q

Object manipulation

A

Object manipulation: means storing information inside object

19
Q

Object manipulation

A

Object manipulation: means storing information inside object

20
Q

Modelling and simultion:

A

Modelling and simultion: mathicamoal modelling refers refers to a process where a system is understood well enough and scieintens describe it usng mathematical language

21
Q

Variable:

A

variable: acts a storage location that be used to store a value.

22
Q

Variable:

A

variable: acts a storage location that be used to store a value.

23
Q

Array of objects:

A

Array of objects: is an array of reference variable. represent storing multiple objects in a single name.

24
Q

Array of objects:

A

Array of objects: is an array of reference variable. represent storing multiple objects in a single name.

25
Q

Sequential search
Binary search
Bubble sort

A

Sequential search: is a search algorithm to find a paricuplaur element in an array,
Binary search: only used in sorted array. It relies on divide and conquer strategy.
Bubble sort: is a a sorting althrotihim that compares values and exchanges them if they are not in the correct order.

26
Q

What if a programmer wishes to store integers, arrays, objects, booeans and string in one data structure

A

What if a programmer wishes to store integers, arrays, objects, booeans and string in one data structure? The answer is to use collections because some collections allow custom spefificion of the collection item.As far as the IB is concerned, collections areUNORDERED lists usually of UNKNOWN length or size.

27
Q

What are collections and what are there command (7)

A

Collections have an infinite amount of space in arrays.
a collection is a data structure that holds a group of elements. It provides a way to store and manage multiple different types of variables in a single array.

additems() it used to add an item in the collection
getNext(). It is used to return the first item in the collection
ddItem( data ) = add data item to the collection .
resetNext() = start at the beginning
hasNext()tells whether there is another item in the list
getNext() - retrieves a data item from the collection
isEmpty()- check whether collection is empty

28
Q

Effienency:

A

Effeinecy:of an algorithm refers to the amount of the computer resources required to preform itd function

29
Q

Correctness:

A

Correctness: of an algorithm refers to the exten to which the algorithm satisfies its specification

30
Q

Correctness:

A

Correctness: of an algorithm refers to the exten to which the algorithm satisfies its specification

31
Q

What does reliablity refer to?

A

Reliablity: referst to the capaiablity of the algorithm to maintain a predefined level of prefornce and preofm all required functions under stated conditions

32
Q

Flexibity refers to:

A

Felxibility: of an algorithm refers to the effort require to modify the algorithm for other phrposes than those tor which it was initially developed

33
Q

Fundamental operations:

A

The four most fundamental operations are:
ADD
COMPARE
RETRIEVE (sometimes called LOAD) STORE (sometimes called SAVE)
Compound operation: Compound operations are composed of very large numbers of fundamental operations. Compound operations are more complex than fundamental operations. For example, if we wanted to multiply, we would simply add groups of numbers until we had found our solution.

34
Q

Fundamental operation vs compound operation

A
  • A fundamental operation could be something like add two numbers, store a number, move a number to another location in RAM etc.
  • These are operations that do not require the processor to go through a large number of sub operations to reach a result.
  • A compound operation is a combination of compound operation
35
Q

Semantic:

A

Semantic: a programming language is described as the combination of its senatics, whichrefers to the meaning of every construction that is possible in the language and its syntax.
Programmers write in high-level languages because they are easier to understand and are less complex than machine code.

36
Q

Semantic:

A

Semantic: a programming language is described as the combination of its senatics, whichrefers to the meaning of every construction that is possible in the language and its syntax.
Programmers write in high-level languages because they are easier to understand and are less complex than machine code.

37
Q

translation process from a higher level language to machine code

A

Assemblers: Translates low-level assembly code into machine code.

A compiler is a translator that executes the translation process only once. It normally translates the whole source program into the object program. The object program is saved and next time a programmer wants to use the object program no recompilation is necessary.

An interpreter is a translator that goes through the process of translation every time the program is run. Interpretation refers to the process of reading each line (instruction) of the source program, analyzing it, translating it into the corresponding line of the object program and executing the line.

Compilers:
Advantages:

Faster execution time compared to interpreters, since the code is already translated into machine language.
Can detect and report errors in the source code before the program is executed.
Can optimize the code for performance.
Produces a standalone executable file, which can be run without the need for the compiler to be present.
Disadvantages:

Compilation process can be slow, especially for large programs.
Code cannot be executed until it has been fully compiled.
Difficult to debug, as errors are reported only after the code has been compiled.
The compiled code is machine-specific and cannot be executed on other platforms without recompilation.
Interpreters:
Advantages:

Immediate feedback and easy to debug, as errors are reported line by line as the code is executed.
Easy to use, as the code can be executed immediately without the need for a separate compilation step.
Platform-independent, as the same source code can be executed on any platform with an interpreter.
Disadvantages:

Slow execution time, as the code must be translated every time it is run.
Limited optimization options, as the code is executed as it is written.
Requires the interpreter to be present on the target machine, which may not always be possible.
Assemblers:
Advantages:

Faster execution time, as the code is translated into machine language.
Low-level control over the target machine, as assembly code provides a direct representation of the machine’s instruction set.
Smaller code size compared to high-level languages, as assembly code is more concise.
Disadvantages:

Difficult to write and maintain, as the code is written in low-level assembly language.
Platform-specific, as the code must be written for a specific target machine.
Limited abstraction, as the code must be written in terms of the target machine’s instruction set.

38
Q

Searches and Sorting + Time complexity

A

Linear Search: A linear search is a simple search algorithm that starts at the beginning of a data structure and iterates through it one item at a time until the item being searched for is found or the end of the data structure is reached.
Time Complexity: O(n), where n is the number of elements in the data structure.

Binary Search: A binary search is an efficient search algorithm that takes advantage of the sorted nature of a data structure by dividing the search space in half with each iteration. It can only be used on sorted data structures.
Time Complexity: O(log n), where n is the number of elements in the data structure.

Selection Sort: A selection sort is a simple sorting algorithm that repeatedly finds the minimum element from the unsorted part of the data structure and places it at the beginning of the unsorted part.
Time Complexity: O(n^2), where n is the number of elements in the data structure.

Bubble Sort: A bubble sort is a simple sorting algorithm that repeatedly compares adjacent elements and swaps them if they are in the wrong order. The largest elements “bubble” to the end of the data structure until the data structure is fully sorted.
Time Complexity: O(n^2), where n is the number of elements in the data structure.

39
Q

Constant:

A

Constant: Constants represent things and quantities that don’t change.

40
Q

Object:

A

Object: An object is a comprised of data and actions. Actions refer to the operations that can be performed by the object.

41
Q

What is =, >=, >, <=.

What is div and MOD

A

= Defined as ”is equals to”. It is also used to assign a value to a variable. Min=6 means that the value of 6 is assigned to variable Min
a: Defined as ”not equal to”. Min#Max means that Min is not equal to Max > Defined as “is greater than”
>= Defined as ”is greater than or equal to”
< Defined as ”is less than”
<= Defined as “is less than or equal to”
Div is defined as “integar part of quotient” example. 22 div 3 =7
Mod: calculator the remainder of deivison of one number by another

42
Q

Scope of a variable is:

A global variable:

A

The scope of a variable defines the visibility of that variable. It defines which parts of the algorithm can store, access and retrieve the data of the variable. Sometimes it is very useful to limit the scope of a variable.
A global variable is visible to all parts of your program while a local variable has a limited scope.