Unit 4 Assignment 1: Homework (from Chapter 3)
True and False (bold your answer)
1.) Modules make it easier for programmers to work in teams
True
2.) Calling a module and defining a module mean the same thing.
True
3.) A statement on one module can access a local variable in another module. False
4.) Programming languages typically require that arguments be of the same data type as the parameters that they are passed to.
True
5.) When an argument is passed by reference, the module can modify the argument in the calling part of the program.
True
6.) Passing an argument by value is a means of establishing two-way communication between modules.
false
8.) What will this program code display?
Module main()
Dim x as integer = 1
Dim y as double = 3.4
Console.Writeline(x & “ “ $ y) changeUs(x, y)
Console.Writeline(x & “ “ $ y)
End module
Sub changeUs(ByVal x as integer, ByVal y as double) a = 0 b = 0
Console.Writeline(x & “ “ $ y)
End Sub
1 and 3.4
0 and 0
9.) What will this program code display?
Module main()
Dim x as integer = 1
Dim y as double = 3.4
Console.Writeline(x & “ “ $ y) changeUs(x, y)
Console.Writeline(x & “ “ $ y)
End module
Sub changeUs(ByRef x as integer, ByRef y as double) a = 0 b = 0
Console.Writeline(x & “ “ $ y)
End Sub
This would be 1 and 3.4
10.) Design a subroutine called timesTen. The subroutine should accept an integer argument. When the subroutine is called, it should display the product of its argument multiplied by 10.
Module Module1
Sub Main() Dim number As Integer
Console.WriteLine("Please type a number") number = Console.ReadLine()
TenTimes(number)
End Sub
Sub TenTimes(ByVal number As Integer) Number = number * 10 Console.writeline("The product of number is: " & number) End