Sunteți pe pagina 1din 3

FINAL EXAM

DATA STRUCTURE AND ALGORITHM (Academic Years 2012/2013) Instructions


_ Maximum time: 90 minutes. _ Answer all the questions. _ Paper translation dictionaries are allowed.

TYPE A
1. What is output statement following? printf (3*10*2/15-2+4^2^2); a. 6 b. 10 c. 2 d. -2 e. 3 2. Statements following, which statement of assignment is correct? a. byte j = i; b. String a = "a"; c. float f = 3.14; d. long l = 40; 3. Statements following, which causing Runtime Error? a. Writing of keyword which is wrong b. Losing of semicolon (;) c. Divided with 0 d. Mistake in usage of modifier class 4. What sintaks applied to make comment multi line in C source? a. \\ b. // c. \** *\ d. /** */ e. \* *\ 5. Chooses identifier which is correct from choices following. a. $double b. bytes c. double d. long e. _Finalist 6. Statements following, which statement of method main() is correct? a. int main(void) b. float main(void) c. main() d. public int main () d. public int main (void) 7. Which between operator following having highest operation priority? a. + b. % c. / d. ( ) 8. what happen, if you are compile following source code : #include <stdio.h> int i ; main() { printf(i); } What is output part of code : a. 0 b. 1 c. Error: i variable not yet inisialisation d. Null 9. #include <stdio.h> main() { int a = 06; a= a + a++ + +a printf(a) ; } What is output part of code : a. 27 b. 29 c. 30 d. 28 e. int i = a

e. 21.

10. #include <stdio.h> main() { int i = 0, j =2; do { i=++i ; j--; } while (j>0) ; printf(i)

}
What is output part of code : a. 0 b. 1 c. 2 d. Program cant be compile 11. #include <stdio.h> main() { int a = 1; int b = 0; int a = 1; If (a==1) If (b==1) If (c==1) printf(Ada sesuatu yangbenar didunia ini); else printf(Tidak ada sesuatupun yang benar didunia ini); else if (a&&(b=c) prinf(Terlalu memusngkan); else printf(tidak akan dikompile); } a. b. c. d. Code will not be compiled There is something right in this world?" will be printed Will not be compiled" will be printed There is no choice to to be correct

12. #include <stdio.h> main() { int x =2, y=4, z= 5; If(x>2) { If (y<5){ printf(pesan pertama) ; } else { printf(pesan kedua); } else if(z>5){ printf(pesan ketiga); } else{ printf(pesan keempat); } What is output following part of code : a. pesan pertama b. pesan kedua c. pesan ketiga d. pesan keempat 13. #include <stdio.h> main() { int x=0 , y=3, z=5 ; If(x>2) { If (y<5){ printf(pesan pertama) ; } else { printf(pesan kedua); } else if(z<5){ printf(pesan ketiga); } else{ printf(pesan keempat); } What is output following part of code : a. pesan pertama b. pesan kedua c. pesan ketiga d. pesan keempat 14. #include <stdio.h> main() { int i, j ; for (i=0;i<2; i++) { for (j=0;i<3;j++) { if (i==j) { continue; } printf(i= ,i,j= ,j) e. There is no choice

} } Which output is correct ? a. i = 0 j = 0 b. i = 0 j = 1 c. i = 0 j = 2

d. i = 1 j = 1

e. i = 1 j = 2 e. input error

15. Term of program mistake causing program computer fetchs up? a. output error b. syntax error c. runtime error d. compiler error

TYPE B 1. Write flowchart and program to following output, This code reads numbers entered by a user at the keyboard and prints them on the screen : 1234 123 12 1

2. Write flowchart and program to print 10 bilangan prima pertama.


2 3 5 7 13 17

S-ar putea să vă placă și