Differentiate between the following terms/concepts: 1.1 Structured programming a
ID: 3724447 • Letter: D
Question
Differentiate between the following terms/concepts:
1.1 Structured programming and Object-oriented programming (4)
1.2 Class and Methods (4)
1.3 Counter-controlled loop and Sentinel controlled loop (4)
1.4 Primitive type variable and a Reference variable (4)
1.5 Boolean expression and an Identifier (4)
QUESTION 2 (20)
2.1 Explain the terms unambiguous, deterministic, complete and finite as applied to algorithms. (12)
2.2 Define the term control structure. (2)
2.3 List and explain the three controls structures used in programming. (6)
QUESTION 3 (20)
3.1 Write pseudocode that inputs 2 values from the user and prints out the larger. (5)
3.2 Write a complete Java program called FindLarge for the pseudocode in 3.1. (15)
Question 4
Write a program using called Stars1 that calls a method called Stars() which uses a nested loop to produce the following output:
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
Explanation / Answer
Ans1.1 a)The main difference between Structured programming and Object-oriented programming is Structured Programming is designed which focuses on process/ logical structure and then data required for that process. While
Object Oriented Programming is designed which focuses on data.
b) structured programming follows topdown approch while OOPs used bottom-up approches.
c)Structured programming also known as Precedural programming or the moduler programming while In OPPs, Programs are divided into small entities called objects.
Ans1.2)
Class is the template or the blueprint that describes the properties of the objects. for example Car is the class for the audi, Lamborghini, Benz type of objects
and method is an action that is performed by the object for example run() that is performed by the object Audi in Car class.
Ans1.3) Counter-controlled loop where the number of the execution is known in advance. for example
while(n<10){
}
While Sentinel controlled loop where the number of execution of the loop is unknown for example:
do{
}while(n>0);
Ans1.4) All predefined datatypes
boolean,byte,short, char, int, long, float, double these are the primitive datatypes which is predefined in the java
where referenced datatypes are those variable which is created by user means used defined class type
for example Car car = new Car(); here car is the referenced type datatype.
Ans1.5) boolean expression is depend on how to write the expression or how we use it.. for example
if(a>b){
return true;
}else
retrun false;
where identifiers are the name of the variable, methods, classes, packeges and there are set of rules to declare the identifiers known as naming convention..
because of the chegg rule i can answer the 4 part of the one question ...
Thanks a lot, Pleae let me know if you have any problem.............
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.