mw07.v1 - Last Name _ First Name _ McGill ID _ Make sure...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Last Name _____________________________________ First Name _____________________________________ McGill ID ______________________________________ Make sure the version number is marked on your scantron sheet. This is Version 1 McGill University COMP 208 -- Computers in Engineering Mid-Term Examination Thursday, February 15, 2007 2:35 – 4:00 P. M. Faculty standard calculators allowed. Grading: Question Possible Points Your Grade 1-4 4 marks each 5-16 5 marks each 17 24 marks Total 100 Computers in Engineering 1 of 1 February 15, 2007 Midterm test Version 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 1 The Fortran statement X = Y means: a) The value of X is the same as the value of Y b) The memory cell X is the same as the memory cell Y c) The value stored in Y should be copied to X d) The value stored in X should be copied to Y e) None of the above Question 2 What is the output of the following program? program midterm integer :: x=2, y=4 real :: ans ans = x/x**x*y write (*,*) ans end program midterm a) 0. b) 0.0078125 c) 1. d) 2. e) 4. Computers in Engineering 2 of 2 February 15, 2007 Midterm test Version 1
Background image of page 2
Question 3 What is the output of the following program? PROGRAM midterm REAL A, B, C INTEGER I, J, K A = 3.5 I = A J = 5.25 K = I*2 B = A*I C = J/3 WRITE (*,*) A,B,C,I,J,K END PROGRAM midterm a) 3.5 10.5 1. 3 5 7 b) 3.5 10.5 1. 3 5 6 c) 3.5 12.25 1. 3 5 6 d) 3.5 10.5 1.75 3 5 6 e) None of the above Question 4 If the array A originally contains the values { 3 , 4 , 1 , 2 , 7 , 6 , 9 } (in that order), what will be the values in A after the following block is executed? DO I=1,3 TEMP = A(7) DO J=7,2,-1 A(J) = A(J-1) END DO A(1)=TEMP END DO a) 9 3 3 3 3 3 3 b) 9 9 9 9 9 9 3 c) 2 7 6 9 3 4 1 d) 7 6 9 3 4 1 2 e) None of the above Computers in Engineering 3 of 3 February 15, 2007 Midterm test Version 1
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 5 What is the output of the following program? program midterm implicit none integer :: x, y x = 23 y = 17 call swap (x, x+y) write (*,*) x, y end program midterm subroutine swap (x, y) implicit none integer :: x, y, z z = x x = y y = z end subroutine swap a) 17 23 b) 23 17 c) 23 40 d) 40 17 e) 40
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2010 for the course COMP COMP 206 taught by Professor Vybihal during the Spring '04 term at McGill.

Page1 / 14

mw07.v1 - Last Name _ First Name _ McGill ID _ Make sure...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online