401 Flashcards
Assessment 2
What are the four stages of SDLC?
Requirement analysis, Design, Implementation, Testing.
What are the five stages of SDLC / what is the fifth stage of SDLC?
The fifth stage is Deployment. The optional sixth is Maintenance.
Two different ways of meeting user requirements. What are they? Advantages and Disadvantages.
1) Interview: allows detailed feedback but time-consuming. 2) Questionnaire: quicker but less in-depth.
What are three properties of an IDE? What can IDE not do?
Syntax highlighting, auto-completion, debugging tools. Cannot ensure logic correctness or remove all bugs.
Using a labelled diagram briefly explain what a flowchart is. Advantages and disadvantages.
Flowchart: diagram showing logic flow using symbols (start/end, actions, decisions). Advantage: visual clarity. Disadvantage: can become complex.
Using a labelled diagram briefly explain what a pseudocode is. Advantages and disadvantages.
Pseudocode: informal, human-readable steps. Advantage: easy to write. Disadvantage: not executable.
What is casting?
Casting is converting a value from one data type to another (e.g., float to int).
Using a labelled diagram briefly explain what a variable is.
A variable is a named storage in memory. Diagram: shows variable name pointing to value in memory.
List the rules for naming variables.
Must start with a letter or underscore, case-sensitive, no special symbols, no Python keywords.
List the comparison operators.
==, !=, >, <, >=, <=
List the arithmetic operators (6).
+, -, *, /, %, **
Using labelled diagram briefly explain three types of selection.
If, if-else, if-elif-else (diagram: branch logic flow based on conditions).
What are the two main types of iteration?
While loop and for loop.
With examples, briefly explain three simple data types.
int (e.g. 5), float (e.g. 3.14), bool (e.g. True).
With an example briefly explain what a string is and how it is not the same as a simple data type.
A string is a sequence of characters (e.g. ‘hello’) — not a primitive numeric type, it’s immutable.
Using a small piece of code, briefly explain the syntax of a function and how a function works.
def greet(): print(‘Hello’) – ‘def’ defines the function, ‘greet()’ calls it.
Using an example, briefly explain what concatenation is.
‘Hello’ + ‘ World’ = ‘Hello World’.
Write a piece of code to convert the keyboard entry to be converted to an int.
user_input = int(input(‘Enter a number: ‘))
Using a piece of code briefly explain what is meant by string slicing.
s = ‘Python’; print(s[1:4]) → ‘yth’ – slicing extracts a substring.
What is a function?
A function is a reusable block of code that performs a specific task.
Write a syntactically correct program for a function and a function call.
def greet(): print(‘Hi’); greet()