1. When you declare local variables and constants within the methods, the method
ID: 3592481 • Letter: 1
Question
1. When you declare local variables and constants within the methods, the methods are _____ reusable.
A. less
B. more
C. just as
D. never
2. True or False. With modules, the return statement can return a value or simply return control back to the call modules point in your logic.
3. Looping structures like while and for statements contain __________ .
A. sequence logic
B. counters
C. an If statement
D. a boolean expression
4. True or False. Debuggers can be useful in finding syntax errors.
Explanation / Answer
1.Answer is B:more
Explaination: Suppose you have a global variable which is being used in your method, and if you call that method more than once simultaneously , then the value of the gloabal variable may be become undeterrmineable because all them are trying to access and change the same variable at the same time.But if you have used local variables in your method, than even if you call your method more than once simultaneously, each method gets its own local variable and hence can access and change it independently.
2.True.
Explaination:If you want the module to return a value , then you need to specify the return type(int, float etc) in the module defintion and return the required value in the module body.If you dont want the module to return anything(i.e to simply return control back to the call modules point in your logic, then you need to specify the return type as void , which wont return anything.
ex:
public int methodA()
{
return 5;
}
This will return a value of 5 of type int
public void methodB()
{
}
This wont return any value.
3.Answer is D:a boolean expression
Explaination:Every looping structure has to have a boolean expression and accordingly if the boolean expression is true then the looping body is executed and if the boolean expression is false then the loop is exited.
4.False. Debuggers are used to find logical errors and bugs in the working of the program rather than Syntax errors..Syntax errors are found using the compiler when the code is compiled.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.