soal c untuk IP

download soal c untuk IP

of 3

Transcript of soal c untuk IP

  • 7/28/2019 soal c untuk IP

    1/3

    FINAL EXAMDATA STRUCTURE AND ALGORITHM

    (Academic Years 2012/2013)

    Instructions_ Maximum time: 90 minutes.

    _ Answerall 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; e. int i = a

    3. Statements following, which causing Runtime Error?a. Writing of keyword which is wrongb. Losing of semicolon (;)c. Divided with 0d. 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

    int i ;

    main()

    { printf(i);

    }

    What is output part of code :a. 0b. 1c. Error: i variable not yet inisialisationd. Null

    9. #include 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. 21.

    10. #include main()

    { int i = 0, j =2;

    do {

    i=++i ;j--;

    } while (j>0) ;

    printf(i)

  • 7/28/2019 soal c untuk IP

    2/3

    }

    What is output part of code :a. 0 b. 1 c. 2 d. Program cant be compile

    11. #include 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. Code will not be compiledb. There is something right in this world?" will be printedc. Will not be compiled" will be printedd. There is no choice to to be correct

    12. #include main()

    { int x =2, y=4, z= 5;

    If(x>2) {

    If (y5){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 main()

    { int x=0 , y=3, z=5 ;

    If(x>2) {

    If (y

  • 7/28/2019 soal c untuk IP

    3/3

    }

    }

    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

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

    TYPE B

    1. Write flowchart and program to following output, This code reads numbers entered by a user at thekeyboard and prints them on the screen :

    1 2 3 4

    1 2 3

    1 2

    1

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

    2 3 5 7 13 17