Khong cho phep cac doi tuong thuoc cac class cung package truy cap B.. Cho phep cac doi tuong thuoc cac class cung package va khac package truy cap 33.. Trong java khong cho phep tu dinh
Trang 1Trac nghiem LTHDT
1 Java ho tro nhung dac diem nao sau day?
A OOP
B Doc lap flatform
C Bao mat
D Tat ca cac dac diem tren (ok)
2 Source code cua java co ten mo rong la gi?
A .class
B .java (ok)
C .com
D Tat ca deu sai
3 Java source code duoc trinh bien dich java bien dich thanh
A Bytecode (ok)
B Executable code
C Machine code
D Tat ca deu sai
4 Trinh nao se chuyen doi java source code thanh file class
A Javac (ok)
B Java
C Appletviewer
D Tat ca deu sai
E Tat ca deu dung
5 Chuong trinh nao thuc thi mot class file trong JVM
A Javac
B Java (ok)
C Appletviewer
D Tat ca deu sai
E Tat ca deu dung
6 Trinh nao cho phep ta chay applet ben ngoai browser
Trang 2A Appletviewer (ok)
B Www
C Java
D Tat ca deu sai
E Tat ca deu dung
7 Chon phat bieu sai
A Co the xay dung mot ung dung huong thu tuc trong java (ok)
B Khong the xay dung mot ung dung huong thu tuc trong java
8 Co the dung mot trinh editor bat ky de viet code java khong?
A Dung (ok)
B Sai
9 Co che cho phep mot ung dung java doc lap voi flatform
A Moi platform co mot trinh java.exe rieng de thong dich file class (ok)
B File.class co cau truc doc lap voi flatform (ok)
C Moi ha cung cap he dieu hanh tao ra cach rieng de chay ung dung java
10 Bao dong la mot dac tinh cua OOP nham de:
A Che giau du lieu
B Ben ngoai chi giao tiep voi doi tuong thong qua mot so phuong thuc
C Ca hai dung (ok)
D Ca hai sai
11 Chon phat bieu dung
A Tunh bao goi: dac diem dong goi thuoc tinh va hanh vi nham tao ra gioi han truy xuat toi mot doi tuong duoc goi la "black box"
B Tinh thua ke: kha nang truyen cac dac diem cua mot lop sang mot lop khac goi la lop dan xuat
C Tinh da hinh: kha nang cho phep dinh nghia lai mot hanh vi ke thua tu lop cha trong mot dan xuat
D Tat ca dung (ok)
Trang 312 Cac kieu du lieu trong java gom
A byte, short, int, long, char, float, double (ok)
B Byte, Long, Int, Char, Float, Double
C BYTE, LONG, INT, CHAR, FLOAT, DOUBLE
D Tat ca dung
13 Cac tu khoa cau truc lap cua java
A Do, While, For, Break, Continue
B do, while, for, break, continue
C do, while, for, break, continue, if, else
D Tat ca sai
14 Cac hang trong java gom
A True, False, Null
B TRUE, FALSE, NULL
C true, false, NULL
D true, false, null (ok)
15 Cac toan tu so hoc trong java la
A +,-,*,/,%, ++, (ok)
B +,-,x,/,%, ++,
C
D
16 Cac toan tu so sanh trong java
A <,<=,=,>=,>,!=
B <,<=,==,>=,>,<>
C (ok)
17 Toan tu gan trong java
=,+=,-=,*=,/=,%=
18 Chon dap an dung nhat
Int[] a = new int[5]
Int a[] = new int[5]
Trang 419 Dinh nghia mang tuc thoi (in-line initialization)
A int a[] = { 1,4,2,7,8}
B int []a = { 1,4,2,7,8}
C int a[5] = { 1,4,2,7,8}
D Cau A, B dung (ok)
20 Cho biet cac dac diem cua lap trinh huong doi tuong
A Dong goi
B Ke thua
C Da hinh
D Tat ca cac dac diem tren (ok)
21 Kieu du lieu trong java duoc chia lam hai loai co ban nao?
A Kieu gia tri don nguyen va kieu tham chieu (ok)
B Con tro va gia tri
C Kieu con tro
D Kieu du lieu truu tuong
22 Cu phap khai bao nhieu dong trong java
A //
B /* */
C /** **/
D / /
23 Khai bao mot dong trong java
A //
B /* */
C Ca hai cau sai
D Ca hai cau dung (ok)
24 Access modifier cho bien trong java co the la?
A public
B private
C protected
Trang 5D Tat ca dung (ok)
25 Cac cau truc lap trinh nao sau day phai thuc thi it nhat mot lan cac phat bieu ben trong
A While
B Do while (ok)
C For
D If
26 Nhan dang tu khoa java ho tro cho OOP
A Class, Private, Public
B Class, private, public
C class, private, public (ok)
D CLASS, PRIVATE, PUBLIC
27 Trong cac modifier cho mot thanh phan cua class, modifier nao cho phep ben ngoai truy cap tu do 1 thanh phan
A Public (ok)
B Private
C Protected
D Friendly
28 Modifier nao cho phep truy cap ben trong lop truy cap den thanh phan do
A Public
B Private (ok)
C Protected
D Friendly
29 Modifier cho phep cac doi tuong cung goi truy cap toi thanh phan do
A Public
B Private
C Friendly, protected, public (ok)
D Tat ca deu sai
Trang 630 Modifier nao chi gioi han cac doi tuong khac goi, khac lop, khong co quan he cha con khong duoc truy cap toi thanh phan do
A Public
B Provate
C Protected (ok)
D Friendly
31 Ky thuat overload cho phep
A Khai bao ham trung ten, trung tham so nhung khac kieu gia tri ham
B Khai bao ham khac ten, khac kieu tham so, khac gia tri ham
C Khai bao ham trung ten, khac kieu tham so, khac so luong tham so (ok)
D Tat ca deu dung
32 Khi mot thanh phan cua class duoc khai bao modifier la friendly thi thanh phan do
A Khong cho phep cac doi tuong thuoc cac class cung package truy cap
B Cho phep cac doi tuong thuoc cac class cung package (ok)
C Cho phep cac doi tuong thuoc cac class cung package va khac
package truy cap
33 Bien doi tuong trong java la
A Tham chieu cua vung nho chua du lieu cua doi tuong (ok)
B Bien static
C Bien cuc bo
D Tat ca deu sai
34 Neu modifier cua lop la public thi ten file Java
A Phai trung ten class, phan biet chu hoa chu thuong (ok)
B Phai trung ten class, phan biet cho hoa chu thuong
C Khong phai trung voi ten class
D Tat ca deu sai
35 Tu khoa this trong java la
A Doi tuong cha cua doi tuong dang thao tac
Trang 7B Doi tuong dang thao tac (ok)
C Ca hai dung
D Ca hai sai
36 Phuong thuc khoi tao (constructor) la phuong thuc
A Duoc thuc thi ngay vao luc khoi tao doi tuong (ok)
B Duoc thuc thi ngay tu luc khoi huy doi tuong
C Ca hai dung
D Ca hai sai
37 Ten phuong thuc khoi tao
A Khong duoc trung ten lop
B Phai trung ten lop (ok)
C Dat ten tuy y
D Tat ca dung
38 Phuong thuc khoi tao (constructor) la phuong thuc
A Khong co kieu tra tri (ok)
B Tra tri kieu void
C Tra tri tuy y
D Tat ca deu dung
39 Trong mot lop ta co the
A Khong dinh nghia ptkt nao
B Dinh nghia 1 ptkt
C Dinh nghia nhieu ptkt
D Tat ca dung (ok)
38 Phuong thuc khoi tao chuan
A Co nhieu tham so
B Co 1 tham so
C Khong co tham so nao (ok)
D Tat ca deu dung
39 Ngon ngu java co san 1 ptkt chuan lam cong viec
Trang 8A Xoa trong vung nho du lieu cua doi tuong ve 0 hoac null (ok)
B Ve 1 hoac null
C Ve 0
D Ve null
40 Khi mot lop da co constructor
A Constructor mac dinh cua ngon ngu van duoc sd
B Khong duoc sd (ok)
C Tat ca dung
D Tat ca sai
41 Phat bieu nao duoc dung de thoat khoi mot vong lap
A Continue
B Goto
C Break (ok)
D Exit
42 Phat bieu nao duoc dung de bo qua mot so lenh trong mot lan lap
A Continue (ok)
B Goto
C Break
D Exit
43 Ten nao hop le trong java
A Nhap mang
B Nhap-mang
C Nhap_mang (ok)
D Nhap&mang
44 Ten nao sau day hop le trong java
A _sinhvien (ok)
B Sinh vien
C Sinh@vien
D Sinh-vien
Trang 945 Ten nao sau day hop le trong java
A _san$pham
B _san_pham
C San_pham
D Tat ca dung (ok)
46 Ma ascii cua '\t' la 9
Int x = 3, y= 2;
X + '\t' + y = 3+9+2=14
47 Boolean a = true, boolean b = false
A && b = false
48 Int x =5, y =2;
X + x % y = 5 + 1 = 6
49 Neu la float cho cau 48 thi gia tri la 6.0
50 Str.substring(8) lay chuoi string bat dau tu ky tu thu 8 trong chuoi
51 Ho chi minh
Str.indexOf("chi"); -> 3
52 Chon cau lenh khong gay loi ben dich
A Float f = 1.3;
B Char c = "a"
C Byte b = 257 ( byte chi co 12x)
D Int i = 10; (ok)
53 Tu nao khong phai tu khoa trong java
A If
B Then (ok)
C While
D Case
Trang 1054 Ten nao khong hop le trong java
A Vari2
B _whatever
C $whatever
D #myvar (ok)
55 Int arr[] = new int[5];
System.out.println(arr[0]);
Kq = 0
56
Int i =9;
Switch(i){
Default:
Sysout(a);
Case 0:
Sysout(b);
Break;
Case 1:
Sysout(c);
Cass 2:
Sysout(d);
Kq la a, b (vao default, vao case 0 va break)
57
Math.floor lam tron can duoi
Math.ceil lam tron can tren
Math.round lam tron so
Math.min phai truyen vao hai doi so moi tim duoc so nho nhat -4.7 muon lam tron thanh -4.0 thi xai Math.ceil(-4.0);
58 Trong mot phuong thuc khoi tao
A Khong duoc goi su dung mot phuong thuc khac
Trang 11B Duoc phep goi den mot phuong thuc khac (ok)
C Tat ca dung
D Tat ca sai
59 Khi su dung phuong thuc khoi tao, viec thuong lam la
A Khoi tao gia tri cho cac thanh phan du lieu cua doi tuong (ok)
B Khai bao kieu cho cac thanh phan du lieu cua doi tuong
C Khai bao cac phuong thuc cua doi tuong
D Tat ca sai
60 Doi tuong song ke tu khi
A Khoi tao new den het chuong trinh
B Khoi tao new den hey phuong thuc chua no
C Khoi tao new den het khoi chua no (ok)
61 Trong java khong cho phep tu dinh nghia phuong thuc huy doi tuong,
no co trinh don rac rieng
D Tat ca dung
62 Phat bieu nao dung dung de khai bao lop java "MyClass"
—> Class MyClass
63 Tinh ke thua la
A Kha nang mot lop thua huong data tu mot hay nhieu lop khac
B Kha nang mot lop thua huong code tu mot hay nhieu lop khac
C Kha nang mot lop thua huong dât va code tu mot hay nhieu lop khac (ok)
D Tat ca đu sai
64 Uu diem cua tinh ke thua
65 Cac loai thua ke
A Don ke thua
B Da ke thua
C Tat ca dung (ok)
Trang 12D Tat ca sai
66 Don thua ke la
A Lop con co nhieu lop cha
B Lop con co mot lop cha (ok)
C Tat ca sai
D Tat dung
67 Da thua ke la
A Lop con co the co mot hay nhieu lop cha (ok)
B Lop con co mot lop cha
C Tat ca sai
D Tat ca dung
68 Tat ca cac ngon ngu ho tro
A Don thua ke (ok)
B Da thua ke
C Don va da
D Tat ca sai
69 Ngon ngu java ho tro
A Don thua ke (ok)
B Da thua ke
C Don va da
D Tat ca sai
70 Tu khoa extends trong java dung de -> khai bao thua ke lop cha
71 Khi dinh nghia lop con, tu khoa extends trong java
-> Truoc lop cha va sau lop con
72 Chin cau tra loi dung ve cac phuong thuc trong lop truu tuogg
A Chi duoc khai bao ma khong viet code
B Co the duoc khai bao ma khong viet code (ok)
C Chi duoc khai bai ma phai viet code
Trang 13D Khong can phai khai bao vi lop tu hieu
73 Lop truu tuong
A Chi co the la lop cha
B Chi co the la lop co
C A va B dung (ok)
D A va B sai
74 Khi hien thuc lop truu tuong, tu khoa abstract trong java
A Dat truoc ten lop va phuong thuc truu tuong (ok)
B Dat sau ten lop va phuong thuc truu tuong
C Dat sau ten lop con va cac phuong thuc trong lop con
D Tat ca sai
75 Nhung modifier nao khong duoc phep ket hop trong abstract
A Public
B Protected
C Final (ok)
D Tat ca sai
Public va protected duoc phep ket hop
76 Dac diem cua lop truu tuong
A Khong the khoi tao mot doi tuong thuoc lop truu tuong (ok)
B Co the
C Chi co the duoc khoi tao mot doi tuong thuoc lop truu tuong khi doi tuong do cung truu tuong
D Tat ca sai
77 Chon cau dung
A Mot bien thuoc lop truu tuong khong the chi den lop con
B Mot bien thuoc lop truu tuong co the chi den lop con (ok)
C Mot bie thuoc lop truu tuong khong de chi den lop con tru khi lop con truu tuong
D Co the khi lop con truu tuong
Trang 1478 Chon cau phat bieu dung
A Final khong chua truu tuong
B Truu tuong khong chua final
C A va B dung (ok)
D A va B sai
79 Chon cau tra loi dung
A Khong dung tu khoa extends khi ke thua kop truu tuong
B Co the dung ky thuat overloading (ok)
C A va B dung
D A va B sai
80 Tinh da hinh cua huong doi tuong cua oop nho
A Overloading
B Overriding (ok)
C Tinh da ke thua
D Tinh don ke thua
81 Lop truu tuong
A La ket qua cua viec khai quat qua cao den noi jhong biet viet code the nao
B Lop co cac tinh chat chung cua nhung lop cu the
C Lop co phuong thuc ma khong viet code
D Tat ca dung (ok)
82 Khong the khoi tao doi tuong kieu lop truu tuong vi lop truu tuong khong duoc dinh nghia day du
83 Chon cau tra loi dung
A Ta co the khai bao abstract va final
B Ta khong the (ok)
C Ta co the khai bao mot lop vua la abstract vua la final trong mot
project
D Tat ca sai
Trang 1584 Lop truu tuong la lop co nhung phuong thuc chi duoc khai bao ma khong viet code
85 Dung tu khoa nao sau day de hien thuc mot interface
A implement
B implements (ok)
C Implement
D Implements
86 Cac phuong thuc trong mot interface duoc dung voi cac modifier nao
A Public va private
B Public va friendly (ok)
87 Khi mot lop cu the viet lai cac phuong thuc cua interface thi modifier cua cac phuong thuc cua no la
A Friendly
B.private
C.public (ok)
D.protected
88 Package bao gom cac class, interface va package con, phai khai bao
o dong dau tien code java, moi package la mot thu muc chua lop
89 De su dung cac class khong cung package phai su dung
A.export
B.extend
C.import (ok)
D.include
90 Cu phap nao sau day khong hop le khi khai bao 1 hang a=10 trong interface
A Public interface int a=10
Trang 1691 Trong mot file java, thu tu dung cua cac khai bao import, class, package la
PACKAGE/IMPORT/CLASS
92 Khai bao nao sau day la khai bao cua phuong thuc truu tuong
public abstract void add();
93 De doc mot tap tin, ta su dung goi nao trong cac goi sau:
java.io
94 Moi package chua cac class va interface
95 Phuong thuc interface la ngam dinh kieu public
96 Mot lop khong the khai bao vua la final vua la abstract
97 Khi sao chep cac tap tin class thi phai chep tat ca cac thu muc lan cau truc cua cac thu muc co lien quan
98
package PackageCha[.packageCon];
99 Dung tu khoa gi de co duoc da ke thua trong java
A.abstract
B.package
C.interface (ok)
D.final
100 Phuong thuc final khong duoc override
101 Khai bao interface
public interface MyInterface{}
102 Khai bao dung
public interface MyInterface extends Ainterface, Binterface{}
Trang 17103 Co the dung ky thuat overload va override trong lop truu tuong (ca hai deu dung)
104 Cac tham so trong lop truu tuong la
A Tham tri (ok)
B Tham chieu
C Ca a va b dung
D Ca a va b sai
105 Dac tinh truy xuat trong lop truu tuong —> khong the su dung
106 Chon cau tra loi dung
Lop truu tuong khong the thua ke tu lop cu the
107 Bien doi tuong trong lop thua ke la THAM CHIEU
108 Co the su dung duoc tu khoa super va this trong lop truu tuong
109 Co the khoi tao constructor default trong lop truu tuong
110 Co the khoi tao constructor co tham so trong lop truu tuong trong moi truong hop
111 Moi lop truu tuong co the co vo so constructor
112 Constructor trong lop truu tuong mac dinh la friendly
113 Kieu tra tri cua constructor trong lop truu tuong —> KHONG CO KIEU TRA TRI
114 moi lop truu tuong deu la lop con cua lop Object
115 Ioexception lalop quan ly loi gi trong java
A Loi khong dung dang so
Trang 18B Lop nhap xuat (ok)
C.khong tim thay file
D.viet sai ten phuong thuc
116 Filenotfoundexception la loi j trong java
-> khong tim thay file
117 Nosuchmethodexception la lop quan ly loi gi
-> viet sai ten phuong thuc
118 Numberformatexception -> loi do khong dung dinh dang so
119 InteruptedException -> loi do cat ngang mot luong lenh dang duoc thuc thi
120 Eofexception -> loi co gang truy cap mot file khi o cuoi file
121 Illegalaccessexception -> loi do truy cap mot class bi cam
122 Co bao nhieu loai loi
2 la syntax va runtime
123 Trong java, thoi jan la mot so long theo don vi miligiay vao nam 1/1/1970
124 Trong cac class quan ly loi, class tren cung cua error la lop
Throwable
125 Cau lenh nao sau day yeu cau he thong goi trinh gom rac cua java: system.gc()
126 Arithmeticexception la loi do thuc thi mot phep toan
127 IllegalArgumentexception loi sai doi so cua ham