1/47
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a character
A letter, number or special character typically represented in ASCII.
What is a string
Anything enclosed in quote marks
The round function
Rounds a number to a specified number of decimal places.
round(num, 2) - rounds a number to two decimal places
The trunc function
Truncates real numbers to the nearest whole number.
How do you find the length of a string
len(string)
How do you concatenate two strings
‘str1’ + ‘str2’ = ‘str1str2’
What are variables
identifiers given to memory locations whose contents will change during the course of the program.
Declaring constants
const ConstantName = value
What is sequence
two or more statements following one after the other.
What is assignment
Assigning a value to a variable.
What is selection
Statements which choose which statement to be executed next depending on some condition.
What is iteration
Repetition of an instruction or series of instructions.
Two types of iteration
Indefinite: continues until some specified condition is met (WHILE)
Definite: The number of times the loop is to be executed is specified in advance (FOR)
What is an array
an ordered, finite set of elements of a single type.
1 Dimensional arrays
myArray ← [1, 2, 3, 4]
2 Dimensional Arrays
myArray ← [[1, 2, 3, 4, 5]
[10, 20, 30, 40, 50],
[100, 200, 300, 400, 500]]
What is a subroutine
A named block of code which performs a specific task within a program.
Name two types of subroutine
Functions and Procedures
What are programming languages?
formal languages comprising a set of instructions that can be used to produce various kinds of output.
What is an algorithm?
An algorithm is a step-by-step procedure or formula for solving a problem.
What do we mean by data types?
classifications of data that tell the compiler or interpreter how the programmer intends to use the data.
What is control flow?
The order in which individual statements, instructions, or function calls are executed or evaluated in a program.
What is a syntax error?
when the code does not adhere to the grammatical rules of the programming language, preventing the program from running.
What does debugging mean?
The process of identifying errors from computer software or hardware.
What is Object-Oriented Programming (OOP)?
A programming paradigm based on the concept of 'objects', which can contain data in the form of fields (attributes or properties) and code in the form of procedures (methods).
What are the four main principles of OOP?
Encapsulation, Abstraction, Inheritance, and Polymorphism.
What is Encapsulation?
The bundling of data and methods that operate on that data within a single unit (object), restricting access to some of the object's components.
What is Abstraction?
The concept of hiding the complex reality while exposing only the necessary parts of an object.
What is Inheritance?
A mechanism wherein a new class is derived from an existing class, inheriting attributes and methods of the base class.
What is Polymorphism?
The ability of different classes to be treated as instances of the same class through a common interface, allowing methods to do different things based on the object it is acting upon.
What is a Class in OOP?
A blueprint for creating objects, defining a set of attributes and methods that the created objects will have.
What is an Object in OOP?
An instance of a class that contains actual values instead of variables.
What is a Constructor?
A special method used to initialize an object when it is created.
What is Method Overriding?
A feature that allows a subclass to provide a specific implementation of a method that is already defined in its superclass.
What is Method Overloading?
The ability to create multiple methods with the same name but different parameter lists within the same class.
What is an Interface?
A reference type in OOP that defines a contract which classes can implement, providing a way to achieve abstraction and multiple inheritance.
What is a Superclass?
The class from which other classes (subclasses) inherit, often referred to as the parent class.
What is a Subclass?
A class that inherits from another class (the superclass), which can extend or modify the inherited behavior.
What is a Stack Frame?
A stack frame is a data structure that contains information about a function call, including local variables, parameters, return address, and saved registers.
What is the purpose of a Stack Frame?
The purpose of a stack frame is to manage function calls and returns, providing a way to store local state information for each invocation.
What information does a Stack Frame typically contain?
A stack frame typically contains the function's parameters, local variables, return address, and any bookkeeping information required for the function's execution.
How does a Stack Frame grow?
A stack frame grows downwards in memory (from high memory addresses to low memory addresses) as additional function calls are made.
What happens when a function is called?
When a function is called, a new stack frame is created and pushed onto the stack, storing the current context of execution.
What is the role of the Return Address in a Stack Frame?
The return address in a stack frame is used to determine where control should return after a function has finished executing.
What is a stack overflow?
A stack overflow occurs when there is more data pushed onto the stack than it can hold, typically caused by excessive function calls or recursion.
How do Stack Frames interact with Recursion?
With each recursive function call, a new stack frame is created, allowing each call to maintain its own set of local variables and execution context.
What is the Call Stack?
The call stack is a stack data structure that stores information about active subroutines (functions) in a program, including their stack frames.
What is the difference between the Call Stack and the Heap?
The call stack is used for static memory allocation of stack frames, while the heap is used for dynamic memory allocation, allowing more flexible memory use.