Programming & Python: Decomposition, Abstraction, UX, Algorithms, Exams of Advanced Education

A comprehensive overview of fundamental programming concepts, including decomposition, abstraction, user experience, algorithms, and object-oriented programming. It explains these concepts in detail, using clear definitions, examples, and illustrations. The document also explores different programming approaches, such as imperative and declarative programming, and provides insights into the role of algorithms in traditional and machine learning programming. It further delves into object-oriented programming concepts like objects, classes, inheritance, and polymorphism, offering a solid foundation for understanding these essential programming paradigms.

Typology: Exams

2024/2025

Available from 01/28/2025

EXAMDOC
EXAMDOC 🇺🇸

4.4

(9)

22K documents

1 / 36

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programming and Python questions with
correct answers
Decomposition - Answer Breaking down the big project into smaller parts, like
making a to-do list.
Once you have a list of all the tasks you need to complete for your project, you can
figure out the best path forward.
4 Things to think about to think like a business technologist - Answer 1)
Approach and solving problems by BREAKING THEM DOWN (decomposition)
2) Focusing on the most important information (abstraction)
3) Understanding your users- the ones who will be using you products or services
you create (User Experience and User persona )
4) Identifying key steps, decisions, and process flow
(Algorithms)
Abstraction - Answer The process of representing the most important parts of
something without including complex background information or details. The goal
is to remove characteristics so that you can reduce things to a set of essential
characteristics.
User Experience - Answer The feelings and attitudes a person has when they are
using a product.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download Programming & Python: Decomposition, Abstraction, UX, Algorithms and more Exams Advanced Education in PDF only on Docsity!

Programming and Python questions with

correct answers

Decomposition - Answer Breaking down the big project into smaller parts, like making a to-do list. Once you have a list of all the tasks you need to complete for your project, you can figure out the best path forward. 4 Things to think about to think like a business technologist - Answer 1) Approach and solving problems by BREAKING THEM DOWN (decomposition)

  1. Focusing on the most important information (abstraction)
  2. Understanding your users- the ones who will be using you products or services you create (User Experience and User persona )
  3. Identifying key steps, decisions, and process flow (Algorithms) Abstraction - Answer The process of representing the most important parts of something without including complex background information or details. The goal is to remove characteristics so that you can reduce things to a set of essential characteristics. User Experience - Answer The feelings and attitudes a person has when they are using a product.

User Persona - Answer A made-up profile for a person who matches the characteristics of someone who might use a particular product Algorithms - Answer A list of step-by-step instructions for how to complete a task. -One way to document an algorithm is to draw a logic flowchart. This is a diagram that uses different symbols and arrows to show the different steps in a process. Traditional programming (data+algrithms) - Answer -You hard code the behavior of the application. -Create a suitable algorithm, then write the code. -The programmer sets the mandatory input parameters and a valid programmed algorithm will produce the expected result. Objects blend..... into a single element - Answer Data and Algorithms Machine Learning programming (math/stats + algorithms) - Answer -A subset of AI (artificial intelligence), machine learning denotes systems that can learn from experience. -It is a field of study that gives computers the ability to learn without being explicitly programmed. In other words, the computer behavior is based on learning from data (observations and real-world interactions). -Programmers collect an array of historical data and that data is used for model building. (So no need to build a model in advance.)

  1. Decision Steps
  2. Repetition Steps Sequence (Process) steps - Answer A step that is always to be performed, and only performed ONE time -Resides OUTSIDE of decision or repetition blocks of code. -Executed in a specific order Decision (Selection) Steps - Answer A step (or steps) that you may or may not do depending on the outcome of a decision (blocks of code) -Runs either ONE or ZERO times
  • Executed after conditions are tested Decision coding construct examples - Answer 1) IF (T/F)
  1. IF ... THEN (if condition met,then process)
  2. IF .... THEN.... ELSE (if condition met, then process 1, else process 2
  3. Nested IF, IF...THEN...ELSE...IF (if condition met, then process 1, else start new IF)

Repetition (Iterations or Looping) Steps - Answer A step (or steps) that you want repeated either; (Blocks of code) -TESTING AT THE BOTTOM OF THE STRING -0 to Many times -1 to Many times -A set number of times Repetition coding construct examples - Answer 1) DO While/UNTIL.....Loop (Do While/Until condition met Process Process ProcessN Loop to Do and retest condition) -TEST AT TOP

  1. DO.... Loop While/UNTIL or While (Do Process Process ProcessN Loop (to Do) Until/While condition met) -TESTS AT BOTTOM
  2. For (For i= 1 to 5 Process

Pill- Begin or end Rectangle with two lines within= Predefined process Arrow- flow of diagram Begin/End symbol - Answer •Used at the beginning and end of each flowchart, process, and/or sub process. Pill shaped INPUT/OUTPUT (data) symbol - Answer •Shows when information/data comes into a program or goes out. -Input examples include prompting user for input, reading from a file, etc.. -Output examples include printing, displaying to screen, storing to a file. Parallelogram PROCESS (sequence) symbol - Answer Used to show calculations, assigning values to variables/objects, and other "process steps" that take place within a program.

  • Use for any non decision, non input/output, non start/stop, non connector point Rectangle Predefined PROCESS symbol - Answer •Used to indicates a set of steps that combine to create a sub-process that is defined elsewhere in the documentation set.

(Program control flows to a DIFFERENT Unit of Code) Rectangle with stripes •DECISION symbol - Answer •Used to show that the program must test a condition and decide a path based on outcome. YES and NO (or True/False) branches are usually shown.

  • Used in BOTH decision and repetition algorithm elements. -When used in decision logic, logic flows across or DOWN the page and step(s) performed 0 or 1 time.
  • When used in repetition logic, logic flows back UP the page and step performed 0 to many time or 1 to many times, depending on the logic structure. Diamond shaped Decision logic flow (diamond) - Answer Flows across or DOWN the page and step(s) performed 0 or 1 time. Repetition logic flow (diamond) - Answer Logic flows back UP the page and step performed 0 to many time or 1 to many times, depending on the logic structure. Traditional computer program - Answer -A set of detailed directions telling the computer exactly what to do, one step at a time.
  • A program can be as short as one line of code, or as long as several millions lines of code.

Interface (API) - Answer The languages and codes that the applications use to communicate with each other and with the hardware. Encapsulation - Answer •Encapsulation is the inclusion of one thing within another thing so that the included thing is not apparent. •The characteristic in which data and behavior are bundled into a class and hidden from the outside world. •Sometimes referred to as data hiding, it is the technique of making the fields in a class private (so the data can be seen only by the class that owns it). •Access to the data and behavior (methods) is provided and controlled through an object's interface. This prevents the code and data being randomly accessed by other code defined outside the class. The process of combining elements to create a new entity. A procedure is a type of encapsulation because it combines a series of computer instructions. Generalization - Answer The process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. •A generalization describes the relationship between a more general (or parent) class and a more specific (or child) class. •The more specific class has additional attributes and operations •A generalization shows what one class inherits from another. For example, both dogs and cats are animals, so you can generalize some attributes from the animal class to either cats or dogs.

Inheritance - Answer -Creating a new class from an existing class but with some additions or changes. The original class is called a parent, superclass, or base class; the new class is called a child, subclass, or derived class. -It's an excellent way to reuse code Polymorphism - Answer A programming language's ability to process objects differently depending on their data type or class. Data type - Answer -Classification of a particular type of information -Most programming languages require the programmer to declare the data type of every data object, and most database systems require the user to specify the type of each data field. -The available data types vary from one programming language to another, and from one database application to another, but the following usually exist in one form or another: Integer= Whole numbers Floating-point= Decimal numbers Characters (text)= readable text Object-oriented programming (OOP) - Answer Programming (software design) in which programmers define the data type of a data structure, and also the types of operations (functions) that can be applied to the data structure.

Assigning a value - Answer placing a value in a variable, array, object property, list, etc Initialize - Answer place the original value in a variable, array, object property, list, etc. -If it is mutable, value can be changed during processing. -If it is immutable or constant, the value cannot be changed during processing. Array - Answer data structures that allow you to store and work with multiple values of the same data type. You can create different types of arrays (numeric, character, string). Arrays are not in python starts at 0 not 1 array(row,column) List - Answer •order important, mutable meaning you can insert and delete elements, 0 or more elements, can have same elements > once, choose element via offset (such as 0, 1, etc) Note- List comprehension (a way to define and create lists based on existing lists). is an ordered collection of values. Lists can be indexed, sliced and manipulated with other built-in functions

Create with [] e.g. listname=[ ] A list is made from zero or more elements, separated by commas, and surrounded by brackets. List commands in Python - Answer Change an Item by listname[ offset number ] e.g., listname[offset number] = new value You can extract a subsequence or range of a list by using a slice. e.g., listname[0:2] Add an Item to the End of a list with append() e.g., listname.append() Combine Lists by Using extend() method or +=. e.g., listname.extend() or listname += listname Add an Item by Offset with insert() - Append() adds items only to the end of the list. When you want to add an item before any offset in the list, use insert(). Offset 0 inserts at the beginning. e.g., listname.inset(offset number, value) Delete an Item by Offset with del statement (del is a statement, not a list method)

del listname[-1] Or Delete an Item by Value with remove() method e.g., listname.remove() To retrieve and item and delete it at the same time, use pop()

create a dictionary, you place curly brackets {} around comma-separated key : value pairs. e.g., dictionaryname={ } Dictionary Commands - Answer You can use the update() function to copy the keys and values of one dictionary into another (combine dictionaries). Add or change an item by [key] e.g., dictionary[key]= new value Delete an Item by Key with del e.g., del dictionary[key] Delete All Items by Using clear() e.g., dictionary.clear() Test for a Key by Using in e.g., value in dictionary You specify the dictionary and key to get the corresponding value. e.g. dictionary[keyvalue]

. If you do not specify a default value and no record is found, the system returns the value None. e.g., Dictionary.get(keyvalue, default value if not found) You can use dictionary.keys() to get all the keys in a dictionary. To obtain all the values in a dictionary, use dictionary.values(): When you want to get all the key-value pairs from a dictionary, use the items() function:

list( dictionary.items() ) Set - Answer Similar to a dictionary with its keys only - no associated values. Like a dictionary, each key must be unique. You use a set when you only want to know that something exists, but don't need the key related to any further data

To create a set, you use the set() function or enclose one or more comma-separated values in curly brackets. e.g. setname=set() Component of Code - Answer An identifiable part of a larger program or construction. Usually, a component provides a particular function or group of related functions. In programming design, a system is divided into components that in turn are made up of modules. Component test means testing all related modules that form a component as a group to make sure they work together. In object-oriented programming and distributed object technology, a component is a reusable program building block that can be combined with other components in the same or other computers in a distributed network to form an application. Examples of a component include: a single button in a graphical user interface, a small interest calculator, an interface to a database manager. Sub processes in VBA - Answer 1) Function -Has to return a value (receives arguments, returns a value) -Can do anything a sub can do

  1. Event handler
  2. Subroutines (Subs)

Components - Answer An identifiable part of a larger program or construction. Usually, a component provides a particular function or group of related functions. In programming design, a system is divided into components that in turn are made up of modules. Component test means testing all related modules that form a component as a group to make sure they work together.

  1. In object-oriented programming and distributed object technology, a component is a reusable program building block that can be combined with other components in the same or other computers in a distributed network to form an application. Examples of a component include: a single button in a graphical user interface, a small interest calculator, an interface to a database manager. Functions - Answer A function often receives input (called arguments) and is specifically written to return a result value. -in python, function doesn't have to return value Parameters - Answer When you define/declare a subprocess (write the event handler, method, function, sub code), you specify the values that it will accept in its declaration statement. These values are called parameters and the declaration statement specifies what the values will be called during processing in the sub. elements, when housed in the def statement, are called parameters and they are separated by commas. Unless you specify otherwise, order is important.

Arguments - Answer When you call a subprocess, you can pass values (literals/values, objects, variables, arrays...). The values you pass are called arguments The items in the call parentheses are being passed to the function. We refer to these as arguments and they are separated by commas. By reference - Answer Access to change the value This means that you pass the memory address of the argument to the called procedure. So the called procedure does not get a copy of the value of the argument. It gains access to the actual argument at its memory address. The argument's value can be changed by the receiving (called) procedure. Any computer instructions carried out by the called procedure that affect the value of the argument are permanent, meaning that when the lines of code in the called procedure are completed, the argument retains the revised value. The original value of the argument when it entered the called procedure is lost. Python by ref by val - Answer Doesn't have by ref by val #Python originally behaves as pass by reference #once change value, effectively creating new object, #python switches to pass by value By value - Answer Value comes back unchanged