programming techniques Flashcards
what is the difference between passing parameters BY VALUE and BY REFERENCE ?
passed by reference is when the funtion will call its memory location of the variable , passed by value this is when the function will receive a copy of the variable
what is meant by modular programming ?
- Modular programming is when a large program is broken down to smaller tasks which are easier to test and maintain.
what are some advantage of modular programming?
-easier to test
-easier to maintain
-modules can be reused
-a team of programmers can work on modules
explain why using local variables makes a large program easier to maintain ?
-There are no unexpected side effects as its independent than other modules.
Describe one disadvantage of a recursive routine compared with an iterative routine?
disadvantage :
-Recursion is less memeory efficient
-consistent recursion could cause a stack overflow
what is A WATCH in an ide ?
what is a trace in an ide ?
a watch -any item of data that a programmer wants to observe runs on its own.
A trace can be set so that a programmer can step through a program , line by line to trace the execution
in OOP what is a :
class ?
constructor ?
Instantiation?
a class is a blue print for objects
a constructor is a method/procedure which allows new objects in the class to be created.
instantiation is a statement which creates an object belonging to a particular class
what is an IDE ?
an IDE is a program that provides a set of tools and designed to maximise a programmers productivity.
what does an IDE have ?
- code editors
-error diagnostics
-translators
what is the difference between a whileloop and a loop ?
A while loop will keep repeating until the correct
password has been input // condition is met .
A for loop will only repeat a certain number of
times
what is a differnce between global and local variable ?
Global variable is visible throughout a program whereas local variable is visible only in module/construct where it is created/declared
what is a function ?
it returns a value often called inline
what is polymorphism?
what is encapsulation?
what are the benefits of encapsulation?
Polymorphism is the ability of a programming language to present the same interface for several different underlying data types.
encapsulation refers to the bundling of data, along with the methods that operate on that data, into a single unit.
Benefits:
- hiding data
-Easy to reuse
-more flexible
what is meant by intractable?
intractable problems are problems for which there exist no efficient algorithms to solve them.
what are the advantages of OOP?
encapsulation - hides unnecessary details , so only necessary data is shown
- inheritance- links classes that are similar , which makes it easier to refer to when coding