If something is mutable, what does that mean? | if something is mutable it means it is capable of change or of being changed. |
What data types are all immutable? | Primitive data types |
What does each of the following methods do?
1) POP
2) REMOVE
3) REVERSE
4) SORT
5) COUNT
6) EXTEND | 1) POP = Removes the last element of the list and returns that value
2) REMOVE = removes the first occurance of the element with the specified value
3) REVERSE = reverses the sorting order of the values/characters.
4) SORT = returns a sorted list of the specified iterable object.
5) COUNT = returns the number of elements with the specified value.
6) EXTEND = returns the number of elements with the specified value. |
What is the difference between procedural programming and OOP? | In procedural programming, data is stored in the main program and passed to functions.
In OOP the data and subroutines are stored together in objects which are created from classes. |
Define a class | A class is like a blueprint, it contains the plans for the data and behaviours an object should possess.
You can create many objects from a single class. |
Define a method | The associated actions of an object |
Define an instance | Every new object created from the same blueprint. |
Define an object | A collection of data and its associated actions |
Define an attribute | The individual properties of an object |
Define encapsulation | Encapsulation is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. |
Define inheritance | allows us to define a class that inherits all the methods and properties from another class. |
Define Polymorphism | the use of a single type entity (method, operator or object) to represent different types in different scenarios.
For example we can use + to add 3 + 4 and "Hannah" + "Qureshi" |
Define overriding | Overriding is an ability of any object-oriented programming language that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes |
Define data hiding | the method to prevent access to specific users in the application |
What is a string? | A “string” is a collection of alphanumeric characters; in essence, a piece of text. As programmers, we typically describe a “string” an an array of character data types.
“Strings” can be stored and/or be passed and returned from functions, be entered (as input) or displayed (as output). |
What is a string literal? | A specific instance of a string is known as a string literal |
if we have speech marks inside of a string, how do we work around this? | We use escape characters. Put a backslash just before where the ' or '' will be. For example " The clock says 1 o \'clock" |
What are the 7 key string manipulation functions and how do they work? | Split – splits a string into an array of words, with some delimiter (i.e., space)
Join – merges an array into a list
Mid – allows you to ‘extract’ a substring from a string
Left - allows you to ‘extract’ a substring starting from the left of a string
Right - allows you to ‘extract’ a substring starting from the right of a string
Find – allows you to ‘find’ the first index of a substring in a string
Trim - allows you to ‘remove’ any leading or trailing ’whitespace’ |