Anda di halaman 1dari 24

3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Started on Monday, 15 March 2021, 8:19 AM


State Finished
Completed on Monday, 15 March 2021, 9:35 AM
Time taken 1 hour 16 mins
Grade Not yet graded

Question 1

Correct

Mark 1.00 out of 1.00

Untuk memasukkan nilai data terformat digunakan perintah scanf(). Spesifikasi formatnya adalah: ”% type”. Kode format dengan jenis
%f berfungsi untuk membaca nilai:

a. Karakter

b. Pecahan 

c. Desimal Integer

d. Short Integer

e.
String

Your answer is correct.

The correct answer is:


Pecahan

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 1/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 2

Incorrect

Mark 0.00 out of 1.00

Dari beberapa operator berikut, yang merupakan operator bitwise adalah:

a. =

b. <<

c. &&

d. <=

e. ++ 

Your answer is incorrect.

The correct answer is:


<<

Question 3
Incorrect

Mark 0.00 out of 1.00

a. 3 4 
#include<stdio.h>
b. 3 3
int main(){
int num,a=3; c. 4 3

num = ++a; d. 5 4
printf("%d %d",num,a);
e. 4 4
return 0;
}

Output dari code diatas


adalah:

Your answer is incorrect.


The correct answer is:
44

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 2/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 4

Correct

Mark 1.00 out of 1.00

Dari beberapa deklarasi berikut:


i. char i = 10;

ii. short int i = 40000;


iii. float i = 26.5;

iv. int i = 55000;


Manakah deklarasi yang benar?

a. Hanya (iii) yang benar 

b.
Semua deklarasi benar

c.
Hanya (ii), (iii), dan (iv) yang benar

d. Hanya (iv) yang salah

e. Hanya (ii) dan (iv) yang salah

Your answer is correct.


The correct answer is:
Hanya (iii) yang benar

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 3/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 5

Incorrect

Mark 0.00 out of 1.00

#include<stdio.h>

int main(){
float x;

x=0.2==2/10;
printf("%f",x);

return 0; }
output dari code diatas adalah:

a. 2.000000

b. tidak ada jawaban yang benar

c. 0.200000

d. 0.000000 

e. 1.000000

Your answer is incorrect.


The correct answer is: 1.000000

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 4/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 6

Correct

Mark 1.00 out of 1.00

#include<stdio.h>

main()
{

int jawab,hasil;
jawab = 100;

hasil = jawab - 10;


printf("jawabannya adalah %d \n",hasil+9);

}
Output dari code program diatas adalah:

a. 109

b. 99 

c. 89

d. 107

e. 120

Your answer is correct.

The correct answer is:


99

Question 7

Incorrect

Mark 0.00 out of 1.00

Berapa ukuran dari tipe data long:

a. 1 bytes

b. 8 bytes 

c. 4 bytes

d. 2 bytes

e. 3 bytes

Your answer is incorrect.

The correct answer is:


4 bytes

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 5/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 8

Incorrect

Mark 0.00 out of 1.00

Tipe data yang paling cocok digunakan untuk menyimpan angka 120 pada sistem 32-bit adalah:

a. float 

b. unsigned long

c. short int

d. unsigned integer

e. int

Your answer is incorrect.


The correct answer is:
short int

Question 9
Correct

Mark 1.00 out of 1.00

int main()

{
int i = 1;
int j, temp = i;

i++;
i = temp;

printf("%d \n",i+1);
}

output dari. code diatas adalah

a. 0

b. error

c. 1

d. 2 

e. 3

Your answer is correct.


The correct answer is:
2

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 6/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 10

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

int ch = 1;
switch (ch)

{
case 1:

printf("yes\n");
break;

case 2:
printf("no\n");
break;

}
}

output dari code diatas adalah:

a. yes 

b. 2

c. no

d. 0

e. 1

Your answer is correct.


The correct answer is:
yes

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 7/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 11

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

int x = 12; // nilai x adalah 12


char ch ='a';

float f = 10.20;

ch = x;
printf ("line 1: %c \n", ch);

x = f;
printf ("line 2: %i \n", x);
ch = 'a';

f = ch;
printf ("line 3: %f \n", f);

x = 20;
f = x;

printf ("line 4: %f \n", f);


x += 9;

printf ("line 5: %i \n", x);

output dari line 4 adalah:

a. 10

b. tidak ada

c. 20.00000 

d. 29

e. 97.00000

Your answer is correct.

The correct answer is:


20.00000

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 8/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 12

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

int x = 12; // nilai x adalah 12


char ch ='a';

float f = 10.20;

ch = x;
printf ("line 1: %c \n", ch);

x = f;
printf ("line 2: %i \n", x);
ch = 'a';

f = ch;
printf ("line 3: %f \n", f);

x = 20;
f = x;

printf ("line 4: %f \n", f);


x += 9;

printf ("line 5: %i \n", x);

Output dari line 5 adalah:

a. 20.00000

b. 97.00000

c. 29 

d. 10

e. tidak ada

Your answer is correct.

The correct answer is:


29

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 9/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 13

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

int x = 10;
int y = ++x;

y = x++;
y = ++x + y++;

printf ("nilai y adalah: %i", y);


}

output dari code diatas adalah:

a. 23

b. 25

c. 24 

d. 21

e. 22

Your answer is correct.


The correct answer is:
24

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 10/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 14

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

int x = 7;
int y = ++x;

y = x++;
y = x + y++;

printf ("nilai y adalah: %i", y);


}

output dari code diatas adalah:

a. 17 

b. 18

c. 19

d. 15

e. 16

Your answer is correct.


The correct answer is:
17

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 11/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 15

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

//int x = 12;
printf ("shift right: %d\n", 9 << 3);

}
output dari code diatas adalah:

a. 32

b. 72 

c. 64

d. 16

e. 144

Your answer is correct.

The correct answer is:


72

Question 16

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

//int x = 12;
printf ("shift right: %d\n", 12 >> 2);

}
output dari code diatas adalah:

a. 8

b. 16

c. 4

d. 3 

e. 32

Your answer is correct.

The correct answer is:


3

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 12/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 17

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

printf ("output: %d\n", 9 ^ 3);


}

output dari code diatas adalah:

a. 11

b. 0

c. 1

d. 10 

e. 12

Your answer is correct.


The correct answer is:
10

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 13/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 18

Correct

Mark 1.00 out of 1.00

#include <stdio.h>

int main()
{

float nilai = 79;


if (nilai >=80)

printf ("lulus dengan predikat memuaskan \n");


else if(nilai >= 60 && nilai < 80)

printf ("anda lulus \n");


else if(nilai < 60 && nilai >=40)

printf ("anda bisa mengikuti remedial \n");


else
printf ("anda tidak lulus \n");

}
output dari code diatas adalah:

a. lulus dengan predikat memuaskan

b. 79

c. anda bisa mengikuti remedial

d. anda tidak lulus

e. anda lulus 

Your answer is correct.

The correct answer is:


anda lulus

Question 19
Incorrect

Mark 0.00 out of 1.00

Manakah yang bukan merupakan syarat penulisan variabel

a. tidak boleh menggunakan reserved word

b. tidak boleh menggunakan spasi 

c. diawali dengan garis bawah

d. panjang maksimal 32 karakter

e. boleh diawali dengan angka

Your answer is incorrect.


The correct answer is:
boleh diawali dengan angka

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 14/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 20

Incorrect

Mark 0.00 out of 1.00

Manakah simbol yang bukan merupakan operator relasi?

a. <=

b. !=

c. >

d. >>

e. == 

Your answer is incorrect.

The correct answer is:


>>

Question 21

Correct

Mark 1.00 out of 1.00

Berapa hasil dari operasi aritmetika berikut:

18%5

a. 3 

b. 5

c. 3.60000

d. 13

e. 23

Your answer is correct.


The correct answer is:
3

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 15/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 22

Correct

Mark 1.00 out of 1.00

Berapa hasil dari operasi bitwise berikut:

27 & 21

a. 23

b. 15

c. 17 

d. 1

e. 1010

Your answer is correct.


The correct answer is:
17

Question 23

Incorrect

Mark 0.00 out of 1.00

Berapa hasil dari operasi bitwise berikut:

10 ^ 29

a. 15

b. 1

c. 23

d. 17 

e. 1010

Your answer is incorrect.


The correct answer is:
23

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 16/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 24

Correct

Mark 1.00 out of 1.00

Mana operator yang akan dieksekusi terlebih dahulu?

a. ==

b. +

c. * 

d. <<

e. &

Your answer is correct.


The correct answer is:
*

Question 25
Incorrect

Mark 0.00 out of 1.00

Mana operator yang dieksekusi terakhir?

a. ()

b. >>

c. *

d. + 

e. &&

Your answer is incorrect.


The correct answer is:
&&

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 17/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 26

Correct

Mark 1.00 out of 1.00

Bilangan biner dari 81 adalah:

a. 1000001

b. 1100001

c. 1010011

d. 1010001 

e. 1100001

Your answer is correct.


The correct answer is:
1010001

Question 27
Incorrect

Mark 0.00 out of 1.00

Bahasa C merupakan bahasa pemrograman yang memiliki paradigma:

a. berorientasi objek

b. tidak ada jawaban yang benar

c. fungsional

d. prosedural

e. deklaratif 

Your answer is incorrect.


The correct answer is:
prosedural

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 18/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 28

Incorrect

Mark 0.00 out of 1.00

#include <stdio.h>

int main()
{

int x = 8;
int y = --x;

y = x--;
y = x * y;

printf ("nilai y adalah: %i", y << 2);


}

output dari nilai y adalah:

a. 204

b. 2

c. 64 

d. 168

e. 128

Your answer is incorrect.

The correct answer is:


168

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 19/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 29

Incorrect

Mark 0.00 out of 1.00

#include <stdio.h>

int main()
{

int x = 8;
int y = --x;

y = x--;
y = x * y;

printf ("nilai y adalah: %i", y);


}

output dari nilai y adalah

a. 204

b. 0

c. 42

d. 168 

e. 128

Your answer is incorrect.

The correct answer is:


42

Question 30

Correct

Mark 1.00 out of 1.00

jika kita hendak menyimpan nilai 32000 pada suatu variabel, tipe data manakah yang paling tepat untuk digunakan?

a. double

b. int 

c. long

d. short int

e. unsigned int

Your answer is correct.

The correct answer is:


int

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 20/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 31

Correct

Mark 1.00 out of 1.00

#include<stdio.h>

int main()
{

int i = 1;
int j, temp = i;

++i;
i = temp + 2;

printf("%d \n",i);
}

output dari kode program diatas adalah 3

Select one:
True 

False

The correct answer is 'True'.

Question 32
Correct

Mark 1.00 out of 1.00

ukuran tipe data double adalah 4 bytes

Select one:
True

False 

The correct answer is 'False'.

Question 33

Correct

Mark 1.00 out of 1.00

bentuk desimal dari 11011110 adalah 222

Select one:
True 

False

The correct answer is 'True'.

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 21/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 34

Correct

Mark 1.00 out of 1.00

hasil dari 7 >> 2 adalah 2

Select one:
True

False 

The correct answer is 'False'.

Question 35
Correct

Mark 1.00 out of 1.00

void merupakan reserved keyword pada bahasa c

Select one:
True 

False

The correct answer is 'True'.

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 22/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review

Question 36

Complete

Marked out of 1.00

Task
Given an integer, , perform the following conditional actions:
If is odd, print Weird
If is even and in the inclusive range of to , print Not Weird
If is even and in the inclusive range of to , print Weird
If is even and greater than , print Not Weird

Input Format
A single line containing a positive integer, .

Constraints

Output Format
Print Weird if the number is weird; otherwise, print Not Weird.

Sample Input 0
3

Sample Output 0
Weird

Sample Input 1
24

Sample Output 1
Not Weird

#include <stdio.h>

int main ()
{

int n;
printf("masukan bilangan ");

scanf("%d",&n);
if ( n )
{

printf("weird");
}

else if ( n>=2 && n<=5 )


{

printf("not weird");
}

else if ( n>=6 && n<=20 )


{
printf("weird");

}
else if(n>20)

{
printf("not weired");

}
else

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 23/24
3/16/2021 Ujian Tengah Semester Programming 1: Attempt review
return 0;
}

Question 37

Complete

Marked out of 1.00

Task
Complete the getLetter(s) function in the editor. It has one parameter: a string, s, consisting of lowercase English alphabetic letters
(i.e., a through z). It must return A, B, C, or D depending on the following criteria:
If the first character in string s is in the set {a, e, i, o, u}, then return A.
If the first character in string s is in the set {b, c, d, f, g}, then return B.
If the first character in string s is in the set {h, j, k, l, m}, then return C.
If the first character in string s is in the set {n, p ,q,r, s, t, v, w, x, y, z}, then return D.

Hint: You can get the letter at some index i in s using the syntax s[i] or s.charAt(i).

Input Format
Stub code in the editor reads a single string denoting s from stdin.

Constraints
1 <= |s| <= 100, where |s| is the length of s.
String s contains lowercase English alphabetic letters (i.e., a through z) only.

Output Format
Return either A, B, C, or D according to the criteria given above.

Sample Input 0
1 adfgt

Sample Output 0

1 AA

#include <stdio.h>

int main ()
{

int
}

https://ecourse.del.ac.id/mod/quiz/review.php?attempt=117553&cmid=22486 24/24

Anda mungkin juga menyukai