Title | Worksheet #1 Page 1 - asdasdas asdasd |
---|---|
Course | Programming Fundamentals |
Institution | University of Technology Sydney |
Pages | 1 |
File Size | 139.7 KB |
File Type | |
Total Downloads | 83 |
Total Views | 164 |
asdasdas asdasd...
Worksheet #1, Page 1 Q1 (a)
In the boxes, write the values in the variables after the following code has been executed: int a = 1; int b = 2; a = 3; The value in a is
(b)
3
and the value in b is 2
In the boxes, write the values in the variables after the following code has been executed: int r = 2; int s = 4; r = s; The value in r is
(c)
4
and the value in s is 4
In the boxes, write the values in the variables after the following code has been executed: int p = 1; int q = 8; q = p; p = q; The value in p is
(d)
1
and the value in q is 1
In the boxes, write the values in the variables after the following code has been executed: int x = 7; int y = 5; int z = 3; x = y; z = x; y = z; The value in x is 5
(e)
the value in y is
5
and the value in z is 5
In the boxes, write the values in the variables after the following code has been executed: int x = 7; int y = 5; int z = 0; z = x; x = y; y = z; The value in x is 5
the value in y is
Answers: (a) 3 2 (b) 4 4 (c) 1 1 (d) 5 5 5 (e) 5 7 7
7
and the value in z is 7...