0% found this document useful (0 votes)
47 views5 pages

Jawaban - (Java Tech Test) - Multiple Choice & Query-SALT

The document contains a multiple choice quiz on Java programming concepts and SQL queries based on a customer data table. It includes 15 multiple choice questions on topics like Java keywords, OOP concepts, data types, methods, and error handling. It also provides 4 SQL questions to retrieve and analyze data from the customer table based on criteria like sorting, filtering, aggregation, and limiting results.

Uploaded by

The Eagle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views5 pages

Jawaban - (Java Tech Test) - Multiple Choice & Query-SALT

The document contains a multiple choice quiz on Java programming concepts and SQL queries based on a customer data table. It includes 15 multiple choice questions on topics like Java keywords, OOP concepts, data types, methods, and error handling. It also provides 4 SQL questions to retrieve and analyze data from the customer table based on criteria like sorting, filtering, aggregation, and limiting results.

Uploaded by

The Eagle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Please read the question carefully and choose the correct option!

1. The following are keywords found in Java, except..


a. Goto
b. Break
c. If
d. String

2. A method that can be executed automatically when an object of a class is created is known
as..
a. Constructor
b. Initializer
c. Garbage Collector
d. Inheritance

3. The term to protect data from attempts to modify, destroy and duplicate data by
unauthorized parties is..
a. Inheritance
b. Polymorphisme
c. Constructor
d. Encapsulation

4. The java syntax for compiling program files is


a. Java
b. Javac
c. Javaclass
d. Javax

5. Class B inherits from Class A, what cannot be said:


a. B is a sub-class of A
b. A is a super-class of B
c. B has access to private members of A
d. B has access to protected members of A

6. The following are primitive data types:


a. Boolean
b. Character
c. Byte
d. Double

7. The keyword used to make the value fixed and immutable is…
a. Protected
b. Private
c. Public
d. Final
8. The method used to convert all letters in a string to uppercase / capital is
a. UpperCase()
b. toUperCase()
c. toUpperCase()
d. isUpperCase()

9. Select the valid statement.


a. char[] ch = new char(5)
b. char[] ch = new char[5]
c. char[] ch = new char()
d. char[] ch = new char[]

10. compareTo() returns


a. true
b. false
c. an int value
d. none

11. What is the return value if a=7 and b=3?


static int function(int a, int b) {
int c = a++ - b; int d = a + ++b; return (d % c);

a. 0

b. 1

c. 2

d. 3

12. What is the result value at the end of execution?


int inp[] = new int[] {5, 4, 6, 7, 3, 6};
int result = 0;
try { for (int i = 1; i <= inp.length; i++) {
result += inp[i]; }

} catch (Exception exception) { }

a. 25
b. 26
c. Runtime error
d. Compile error
13. There is something wrong with the code. How to fix it?
public class Test6 {
public String var = " world";
public static void main(String args[]) {
System.out.println("Hello" + var);

a. System.out.println("Hello" + Test6.var);
b. System.out.println("Hello" + this.var);
c. public static String var = " world";
d. public final String var = " world";

14. What is the output of the function if n=6?


static int myFunc(int n) {
if (n == 0) {
return 0;
} else if (n == 1) {
return 1;

} else if (n > 1) {

return myFunc(n-1) + myFunc(n-2);

} else {

return -1;

a. 5
b. 6
c. 8
d. -1

15. What is the value of d?


String a = "KLMN";
String b = " AB CDEFGHIJ ";
String c = b.trim().substring(3, 7);
String d = c.concat(a);

a. CDEKLMN
b. DEFGHIJKLMN
c. CDEFKLMN
d. DEFGKLMN
Please create a query to answer questions number 16 – 19 based on the table below:

nik nama alamat kota provinsi pulau total_pembelian_2017 total_pembelian_2018 point tgl_regis

3276001 Ahmad Jl. Telaga No 3 Bandar Lampung Sumatra 984.000,00 430.000,00 7070 14-Nov-17
Lampung

3276002 Saiful Jl. Cendrawasih Batam Kepulauan Riau Batam 265.000,00 684.000,00 4745 12-Apr-17
Ahmad

3276003 Lina Jl. Mawar Makassar Sulawesi Sulawesi 902.000,00 883.000,00 8925 22-Sep-17
Selatan

3276004 Erni Jl. Cut Nyak Pontianak Kalimantan Kalimantan 384.000,00 377.000,00 3805 30-Oct-16
Dien Barat

3276005 Anto Jl. Kamboja Jakarta DKI Jakarta Jawa 561.000,00 293.000,00 4270 20-Apr-17
Barat

3276007 Maya Jl. Anoa Batam Kepulauan Riau Batam 679.000,00 746.000,00 7125 9-Aug-16

3276008 Hadi Jl. Hiu Jakarta DKI Jakarta Jawa 239.000,00 987.000,00 6130 8-Apr-16
Barat

16. Sort customer data based on the highest point to the lowest point
17. Show all data with customer names containing the word Ahmad
18. Show for the NIK and Name of the Customer who made the 3rd most total purchases in
the last 2 years
19. Show total customer purchases outside Java throughout 2017
16.

SELECT * FROM TABLE_NAME

ORDER BY POINT DESC

17.

SELECT * FROM TABLE_NAME

WHERE NAMA ilike '%ahmad%'

18.

SELECT NIK, NAMA, (TOTAL_PEMBELIAN_2017 + TOTAL_PEMBELIAN_2018) AS TOTAL

FROM PUBLIC.TABLE_NAME

ORDER BY TOTAL DESC

LIMIT 3

19.

SELECT SUM(TOTAL_PEMBELIAN_2017) AS TOTAL_PURCHASE_2017

FROM TABLE_NAME

WHERE PULAU NOT IN ('Jawa')

You might also like