# 20091_mt1 - Dept. of Computer Eng Fall 2009 CEng 230...

This preview shows pages 1–2. Sign up to view the full content.

Dept. of Computer Eng Fall 2009 CEng 230 Midterm Examination Nov. 17, 2009 75 Minutes Student ID 1. Which of the following variable names are illegal in C syntax? I) integral II) integer III) _number1 IV) 1stMidterm V) Top_10 a) I and IV b) III and IV c) II and IV d) IV only e) III, IV, and V 2. What will be the value of x and y after execution of the following program segment? int x =3, p=8; float y = -3.1415; x = 11 % x + 1 / x * 3.9 - (double) x ; y = - (p / x )*(x / p); a) x: 3 y: -3.1415 b) x:1 y: -3.1415 c) x: -1 y: 0.0 d) x: 0 y: 0.0 e) x: 0.3 y: 1.0 3. What is the C equivalent of the following expression? cos 2 x log (sin x 2 ) + ------------- 1 – x a) lg (sin x) 2 + cos 2 x /(1-x); b) log (sin (x*x))+ (cos x * cos x) /1-x; c) log sin x*x + cos x /1-x; d) log (sin (x*x)) + cos(x) * cos(x) /(1-x); e) log sin x 2 + cos 2 x /1-x; 4. Given the variable declarations: int x=5; double y = 9.81, angle, result; char City; Give the choice which lists ALL of the following statements with invalid C syntax ? I ) x = pow(x, -1.0); II) 2*2 = 4; III) result =squareroot(x**2 - y**2); IV) angle = atan(1.2); V) City = ‘Kiev’; VI) x = (double) x + (int) y; a) II, III and V b) II and V c) III and IV d) II,III and VI e) I and II 5. The floating type constant 2.7182E-2 is equivalent to: a) -2.71822 b) -22.7182 c) 0.27182 d) -0.271822 e) 0.027182 6. Which of the following definition is not valid? a) long my__int; b) double _benim, Sayi; c) float Mynumber_is9; d) string mystring; e) char X98char; 7. What could be the output of the following expression? printf("%d%c%c", 'A','b',67); a) Ab67 b) 65b67 c) 65bc d) AbC e) 65bC 8. How can we get the output: \\n\t’’’ ? a) printf(“\\n\t’ ’ ’ ”); b) printf(“\\\\n\\t\’\ ’\ ’ ”); c) printf(“\\n\t\’ ’ ”); d) printf(“\\\n\\t\’ \’\ ’ ”); e) printf(“\\\\n\\t\\’\\ ’\\ ’ ”); 9. If you enter 97ca97 as input for the following expression what would be the output? char a,b,c,d;

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/09/2010 for the course COMPUTER E 5710230 taught by Professor Assoc.prof.dr.cemhüseyinbozşahin during the Spring '09 term at Middle East Technical University.

### Page1 / 4

20091_mt1 - Dept. of Computer Eng Fall 2009 CEng 230...

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

View Full Document
Ask a homework question - tutors are online