Tech Flashcards

1
Q

Which of the following best defines a function in programming?

1.A predefined command that performs a specific task.
2.A block of organized, reusable code used to perform a single action.
3.A variable that stores multiple values.
4.A method to define the syntax of a programming language.

A
  1. To store data values.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following best defines a function in programming?

A predefined command that performs a specific task.

A block of organized, reusable code used to perform a single action.

A variable that stores multiple values.

A method to define the syntax of a programming language.

A
  1. A block of organized, reusable code used to perform a single action.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Boolean Operator ?

A

Compare two values and then returns the value TRUE (1) or FALSE (0)

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

What does the Operator “ ==” means as a Boolean Operator ?

A

The operation is true if the two value are equal

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

What does the Operator “ !=” means as a Boolean Operator ?

A

The operation is true if the two value are different

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

What does the Operator “ >” means as a Boolean Operator ?

A

The operation is true if the value to the right of the operator is less than the one on the left

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

What does the Operator “ <” means as a Boolean Operator ?

A

The operation is true if the value on the right of the operator is less than the one on the left

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

What does the Operator “ >=” means as a Boolean Operator ?

A

The operation is true if the value on the right of the operator is greater than or equal to the one on the left

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

What does the Operator “ <=” means as a Boolean Operator ?

A

The operation is true if the value on the right of the operator is less than or equal to the one on the left

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

What is used as connector of two Boolean Operations ?

A

AND e OR

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

What is an “ if-else” Statement ?

A

It’s a conditional statement that run a different sets of command depending on wether an expression is true or false.

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

What is the difference between an For loop and a While loop ?

A

in “for loop” the number of repetition to be done is already know and used for a result . In “while loop” the command run until a certain condition is reached and the statement is proved to be false.

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

What the use of a “for loop” and it’s code ?

A

performs predefined task until a condition is met.
for<counter> in range<counter>, <counter end +1>: <something></something></counter></counter>

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

What is a range and how do you code it ?

A

an range is a list of element: range(0,n)=[0,1,…,n-1]

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

What is a “while loop” and it’s code

A

It’s a statement that allow code to be executed repeatedly based on a condition statement.
while <condition>: <something></something></condition>

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

What is a lists ?

A

it’s a ordered collection of element in which any type of value can be stored.
this_is_a_list=[element 1, element 2, element 3]
this_is_the_first_element=this_is_a_list[0]

17
Q

What are the basic list methods ?

A

Basic List Methods
● append() Adds an element at the end of the list
● clear() Removes all the elements from the list
● copy() Returns a copy of the list
● count() Returns the number of elements with the specified value
● extend() Add the elements of a list (or any iterable), to the end of the current list
● index() Returns the index of the first element with the specified value
● insert() Adds an element at the specified position
● pop() Removes the element at the specified position
● remove() Removes the first item with the specified value
● reverse() Reverses the order of the list
● sort() Sorts the list
● len(my_list) Return the lenght of your list
● max(my_list) Return the maximun value of your list
● min(my_list) Return the minimum value of your list

18
Q

What is a function in coding ?

A

A function is a block organized, reusable code that is used to perform an action like print()

19
Q

How can I build my own function (called user-defined function)

A
  1. need to use the world “def” that indicated that we are defining a new function
  2. after that name the function “ex:my_function” used as a recall for the program.
  3. in () we put the input of the function, if not needed nothing need to be in the ()
  4. we have then the body of the function explaning what it does
  5. we use then the word “return” that indicate the output of the function
20
Q

What is a “library”?

A

a library is a colluction of modules a module is a set of standardized part of independent units that can be used to construct a more complex structure. (file name is needed) after in the main program you put&raquo_space;>import name of the file

21
Q

What is a “dictionary” in coding ?

A

consists of a collection of key-value pairs. each key value pair maps the key to it’s associated value. You can define a dictionary by enclosing a comma-separated list of key-value pairs in curly brackets ({}). A colon (:) separates each key from its associated value.

22
Q

What is “object” in coding ?

A

It’s an abstract data type created by the user to represent any entity. We give attributed (properties of the object) and method (functionality of the object)

23
Q

How do we create a “classes” ?

A
  1. Word used to indicate that we are defining a new object : class
  2. we name the new object:
    My_Class:
  3. We use the constructor of the object:
    def__init__
  4. We put the attributes of the object:
    (self, param_1, param_2):
  5. now the body of code:
    self.param_1=param_1
    self.param_2=param_2
24
Q

What are the different data types ?

A

● Numerical → You can apply mathematical operators on this kind of data. They are often
called continuous data.
● Textual → They contain words, sentences or, in general, text. In order to analyze this
kind of data often you have to go through a cleaning process first.
● Categorical → They represent a certain feature or characteristic and you can use them
to group data in homogeneous sets.
Ex. in weather example i have 2 categories for locations
● Date-Time → Data related to time that you can use to order chronologically the database or to subset it into shorter period of interest.

25
Q

What is a structured Data ?

A

Clearly defined and searchable types of data, it’s quantitative, stored in data warehouse, easy to search and analyse, exist in predefined formats.

26
Q

What is unstructured Data ?

A

Stored in it’s native format, qualitative, stored in data lake, require more work to process and understand, exist in a variety of formats.