الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مركز تجميع الاسئلة

بدأه mofeed chaar في 4 يناير 2008 · 36 رد · 8,497 مشاهدة · في منتدى الشهادات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

و ضعت هذا الموضوع للافادة و ارجو ان تتعاونو معي كل ما هو كطلوب منكم ان تضعوا اسئلة من اسئلة امتحان الجافا و رقم الامتحان و ارجو ممن لم يقدم الامتحان ان يحفظ ولو سؤال واحد و يضعه هنا و انا اول المتطوعين و كل بضعة ايام سوف اضع سؤالا مع العلم ان السؤال قد يتكرر في الامتحان الذي يحمل نفس الرقم

السؤال

310-055

certkiller=new ReallyBigObject();
//mor cod her
certkiller=null;
which statement should be placed at line 14 to suggest that the virtual machine
expend effort toward recycling the memory used by the object Certkiller ?
A.System.gc()
B.Runtime.Gc()
C.System.freeMemory()
DRuntime.getRuntime().growHeap()
E.runtime.getRuntime().freeMemory()


Answer:A

mofeedchaar@hotmail.com

#2

الاخ مفيد.. انا ارسلت لك رسالة خاصة من حوالي اسبوع يمكن لم تنتبه اليها

على فكرة انا ساكن بحلب كمان و ياريت نتعرف ببعض اكتر انا ضفتك عل المسنجر على كلاً

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why

#3

بصراحة انا الي الشرف و انا بعثت لك رسالة على الخاص فيه رقم موبايلي

mofeedchaar@hotmail.com

#4

وين الاسئلة يا جماعة العادة ما حدى عمبيحط اي سؤال انا ما راح احط سؤال لحتى غيري يحط سؤال من عنده

mofeedchaar@hotmail.com

#5

CX-310-055

Which are true? (Choose all that apply.)
A. The notifyAll() method must be called from a synchronized context.
B. To call wait(), an object must own the lock on the thread.
C. The notify() method is defined in class java.lang.Thread.
D. When a thread is waiting as a result of wait(), it release its lock.
E. The notify() method causes a thread to immediately release its lock.
F. The difference between notify() and notifyAll() is that notifyAll() notifies all
waiting threads, regardless of the object they're waiting on.

Answer:
A, D are correct because notifyAll() (and wait() and notify()) must be called from
within a synchronized context. D is a correct statement.


B is incorrect because to call wait(), the thread must own the lock on the object that
wait() is being invoked on, not the other way around. C is wrong because notify() is
defined in java.lang.Object. E is wrong because notify() will not cause a thread to
release its locks. The thread can only release its locks by exiting the synchronized code. F is
wrong because notifyAll() notifies all the threads waiting on a particular locked object,
not all threads waiting on any object. (Objective 4.4)
#6

بصراحة أعجبتني فكرة مركز تجميع الأسئلة، وسأحاول اضافة اسئلة على قدر المستطاع من كتب ونماذج امتحانات اذا لم يكن هناك مانع. ولكن اتسائل هل تصبح الفكرة أفضل اذا وضعنا الأسئلة بدون اجابات بحيث تكون أكثر تحدي واثارة؟

سأجرب وضعها بدون اجابة هذي المرة لنرى اجابات الأخوة

CX-310-055

Given:
public abstract class AbstractTest {
public int getNum() {
return 45;
}
public abstract class Bar {
public int getNum() {
return 38;
}
}
public static void main(String[] args) {
AbstractTest t = new AbstractTest() {
public int getNum() {
return 22;
}
};
AbstractTest.Bar f = t.new Bar() {
public int getNum() {
return 57;
}
};
System.out.println(f.getNum() + " " + t.getNum());
} }
What is the result?
A. 57 22
B. 45 38
C. 45 57
D. An exception occurs at runtime.
E. Compilation fails.
#7

answer is A

310-055:


class Player {
Player() { System.out.print("p"); }
}
class CardPlayer extends Player implements Serializable {
CardPlayer() { System.out.print("c"); }
public static void main(String[] args) {
CardPlayer c1 = new CardPlayer();
try {
FileOutputStream fos = new FileOutputStream("play.txt");
ObjectOutputStream os = new ObjectOutputStream(fos);
os.writeObject(c1);
os.close();
FileInputStream fis = new FileInputStream("play.txt");
ObjectInputStream is = new ObjectInputStream(fis);
CardPlayer c2 = (CardPlayer) is.readObject();
is.close();
} catch (Exception x ) { }
}
}
What is the result?
A. pc
B. pcc
C. pcp
D. pcpc
E. Compilation fails.
F. An exception is thrown at runtime.
import java.io.*;

فحنوت ألثم جرحه الرعافَ فانتكأت جراحي..

وهمت على خدي الدموع فقلت يا روحي وراحي..

هلّا رحمتَ قلوبنا .. وعدلت عن هذا الرّواحِ ِ ..؟

فأجابني البطل المسجّى هازئاً بيَ .. باقتراحي

كفكف دموعك ليس في عبراتك الحرّى ارتياحي

هذي سبيلي .. إن صدقت محبتي .. فاحمل سلاحي

Sun Certified Java Programmer

#8

I think the answer is C, because in deserialization the constructor of the parent works if it is not implementing Serializable

عفوا لم أستطع التعبير عن الاجابة بالعربي

بالنسبة لاجابتك فعلا الاجابة الصحيحة A

CX-310-055

Using the fewest fragments possible (and filling the fewest slots possible), complete the code
below so that the class builds a directory named "dir3" and creates a file named "file3" inside
"dir3". Note you can use each fragment either zero or one times.


Code:
import java.io.______________
class Maker {
public static void main(String[] args) {
___________ ___________ ___________
___________ ___________ ___________
___________ ___________ ___________
___________ ___________ ___________
___________ ___________ ___________
___________ ___________ ___________
___________ ___________ ___________
} }


Fragments:
File;		   FileDescriptor;		 FileWriter;		  Directory;
try {		   .createNewDir();	   File dir				File
{ }			  (Exception x)		   ("dir3");			   file
file			.createNewFile();	  = new File		  = new File
dir			 (dir, "file3");			  (dir, file);			.createFile();
} catch	  ("dir3", "file3");		.mkdir();			  File file
#9

correct ! answer is C

import java.io.File;
class Maker {
public static void main(String[] args) {
File dir = new File("dir3");
dir.mkdir();
File file = new File("dir3","file3");
file.createNewFile();

{
{

فحنوت ألثم جرحه الرعافَ فانتكأت جراحي..

وهمت على خدي الدموع فقلت يا روحي وراحي..

هلّا رحمتَ قلوبنا .. وعدلت عن هذا الرّواحِ ِ ..؟

فأجابني البطل المسجّى هازئاً بيَ .. باقتراحي

كفكف دموعك ليس في عبراتك الحرّى ارتياحي

هذي سبيلي .. إن صدقت محبتي .. فاحمل سلاحي

Sun Certified Java Programmer

#10

أعتقد ان ترقيم الأسئله ستكون فكرة جيده لكي تكون الاجابات والردود مرتبطه بأرقام الأسئله، وأعتقد ان آخر سؤال المتعلق بانشاء مجلد باسم dir3 بداخله ملف بنفس الاسم يحمل الرقم 5

بالنسبة لاجابتك أخ iyadhoo عن السؤال رقم 5 فهي تقريبا صحيحه ولكن ينقصها شئ مهم جدا والا لن تعمل compile :)

#11

مممممممممم!!

try catch !!

لأن الميثود createNewFile ترمي IOException

فحنوت ألثم جرحه الرعافَ فانتكأت جراحي..

وهمت على خدي الدموع فقلت يا روحي وراحي..

هلّا رحمتَ قلوبنا .. وعدلت عن هذا الرّواحِ ِ ..؟

فأجابني البطل المسجّى هازئاً بيَ .. باقتراحي

كفكف دموعك ليس في عبراتك الحرّى ارتياحي

هذي سبيلي .. إن صدقت محبتي .. فاحمل سلاحي

Sun Certified Java Programmer

#12

ايوة صح. ممكن الكود كامل من الأجزاء الموجودة في السؤال

على فكرة السطر

File file = new File("dir3","file3");

ممكن كمان يكون

File file = new File(dir,"file3");

منتظرين أسئلة شباب

#13

حل السؤال الخامس كامل:

import java.io.File;
class Maker {
public static void main(String[] args) {
File dir = new File("dir3");
dir.mkdir();
try{
File file = new File("dir3","file3");
file.createNewFile();
}catch(Exception e){}
}}

السؤال السادس:

CX-310-055

Given:
public static void before() {
Set set = new TreeSet();
set.add("2");
set.add(3);
set.add("1");
Iterator it = set.iterator();
while (it.hasNext())
System.out.print(it.next() + " ");
}

Which of the following statements are true?
A. The before() method will print 1 2
B. The before() method will print 1 2 3
C. The before() method will print three numbers, but the order cannot be determined.
D. The before() method will not compile.
E. The before() method will throw an exception at runtime.
#14

حلوين

السؤال السادس يعطيك اكسبشن

لأن TreeSet is Sorted Set

وبما أن انواع الاوبجكتز متغيره وانت لم تقم بعمل امبلمنت لطريقة ترتيب هذه الSet

فراح يطلعلك اكسبشن قد الدنيا بعد اضافة الثلاثه

الحل هنا هو إما انك تجعلهم كلها سترنق وبما أن الكلاس سترنق( والبريميتيف أيضاً ) معمول له Comparator

فراح يطلع معك مزبوط

أو انك تقوم بعمل Comparator خاص فيك وبالتالي يتعرف على طريقة الترتيب الجديده

import java.util.*;

class A{
  public static void main(String args[]){
	  before();
  }

public static void before() {
Set set = new TreeSet(new S());
set.add("2");
set.add(3);
set.add("1");
Iterator it = set.iterator();
while (it.hasNext())
System.out.print(it.next() + " ");

}
static class S implements Comparator{
		public int compare(Object o1, Object o2) {
		   int i1=0,i2=0;
			if (o1 instanceof java.lang.String)
			{
			  i1=Integer.parseInt((String)o1);

			}
			else
				i1=((Integer)o1).intValue();
			  if (o2 instanceof java.lang.String)
			{
			  i2=Integer.parseInt((String)o2);

			}
				  else
				i2=((Integer)o2).intValue();

		   return ((Integer)i1).compareTo(i2);

		}

}
}
#15

كلام جميل أخي عيسى وتحليل أكثر من رائع

منتظرين منك أسئلة

السؤال السابع:

CX-310-055

Given:
public static synchronized void main(String[] args) throws
InterruptedException {
Thread t = new Thread();
t.start();
System.out.print("X");
t.wait(10000);
System.out.print("Y");
}

What is the result of this code?
A. It prints X and exits.
B. It prints X and never exits.
C. It prints XY and exits almost immeditately.
D. It prints XY with a 10-second delay between X and Y.
E. It prints XY with a 10000-second delay between X and Y.
F. The code does not compile.
G. An exception is thrown at runtime.
#16

السلام عليكم

أتوقع الجواب هو G

السؤال الثامن:

هذا السؤال جاءني في الامتحان:

class Test{
public static void main(String a[]){
for(int i=0;i<10;i++){if(++i<5){break;}}
System.out.println(i);
}
}

ماذا سيطبع البرنامج!

تم تعديل هذه المشاركة بواسطة iyadhoo في 12 أبريل 2008 في 22:16

فحنوت ألثم جرحه الرعافَ فانتكأت جراحي..

وهمت على خدي الدموع فقلت يا روحي وراحي..

هلّا رحمتَ قلوبنا .. وعدلت عن هذا الرّواحِ ِ ..؟

فأجابني البطل المسجّى هازئاً بيَ .. باقتراحي

كفكف دموعك ليس في عبراتك الحرّى ارتياحي

هذي سبيلي .. إن صدقت محبتي .. فاحمل سلاحي

Sun Certified Java Programmer

#17

اياد

error

unkown parameter i

#18

هاد السؤال لامتحان الشهادة SCWCD

رقم الامتحان 310-081

رقم السؤال 9

for a given ServletResponse response , which reterieves an object for writing binary data ?
A:response.getWriter()
B:response.getOutputStream()
C:response.getOutputWriter()
D:response.getWriter().getOutputStream()
E: response.getWriter(Writer.OUTPUT_BINARY)

و بخصوص السؤال الثامن البارامتر i تنتهي حياته داخل الحلقة لذا ان يستطيع رؤيته امر الطباعة

mofeedchaar@hotmail.com

#19
اقتباس
اياد

error

unkown parameter i

اقتباس
و بخصوص السؤال الثامن البارامتر i تنتهي حياته داخل الحلقة لذا ان يستطيع رؤيته امر الطباعة

الجواب صحيح

أكيد المتحول لا يمكن أن يُرى خارج قوسي الحلقة .. لذلك سيكون الجواب: compilation fails.

بصراحة في جو الامتحان والأعصاب مشدودة كاد أن يفلت مني هذا السؤال لكن تداركته في الآخر!

فحنوت ألثم جرحه الرعافَ فانتكأت جراحي..

وهمت على خدي الدموع فقلت يا روحي وراحي..

هلّا رحمتَ قلوبنا .. وعدلت عن هذا الرّواحِ ِ ..؟

فأجابني البطل المسجّى هازئاً بيَ .. باقتراحي

كفكف دموعك ليس في عبراتك الحرّى ارتياحي

هذي سبيلي .. إن صدقت محبتي .. فاحمل سلاحي

Sun Certified Java Programmer

#20

اعتقد الجواب هو

B:response.getOutputStream()
#21
Question :
When an array is constructed , it's elements are automatically initialized . Considering this , which of the following statements is false -

Options :

a .  numerical elements are initialized to zero
b .  boolean elements are initialized to true
c .  object references are initialized to null
d .  char elements are initialized to '\u0000'
#22

أخ iyadhoo بالنسبة لاجابة السؤال السابع فهي فعلا G، هل يتكرم أحد الأخوة بشرح السبب

بالنسبة لسؤال الأخ carlito والذي من المفروض أن يحمل الرقم 10 فأعتقد أن الاجابة هي b لأن البوليان يعطى قيمة false كقيمة افتراضية

#23
Given:
public static synchronized void main(String[] args) throws
InterruptedException {
Thread t = new Thread();
t.start();
System.out.print("X");
t.wait(10000);
System.out.print("Y");
}

What is the result of this code?
A. It prints X and exits.
B. It prints X and never exits.
C. It prints XY and exits almost immeditately.
D. It prints XY with a 10-second delay between X and Y.
E. It prints XY with a 10000-second delay between X and Y.
F. The code does not compile.
G. An exception is thrown at runtime.

الجواب هو G لأن الـmethod يجب أن تملك الـ Lock (القفل) للـobject المسمى t.

وبالنسبة للسؤال العاشر نفس إجابة الأخ Osamait.

فحنوت ألثم جرحه الرعافَ فانتكأت جراحي..

وهمت على خدي الدموع فقلت يا روحي وراحي..

هلّا رحمتَ قلوبنا .. وعدلت عن هذا الرّواحِ ِ ..؟

فأجابني البطل المسجّى هازئاً بيَ .. باقتراحي

كفكف دموعك ليس في عبراتك الحرّى ارتياحي

هذي سبيلي .. إن صدقت محبتي .. فاحمل سلاحي

Sun Certified Java Programmer

#24

السؤال الحادي عشر : 055-310 :

هذا السؤال سهل لكنه من أسئلة الامتحان:

place code into the class so that it compiles and generates the output answer=42 
Note that Code options may be used more than one time:
public class _________ {
private _____ object;
public ________  (____ object){
this.object = object;
}
public ____ getObject(){
return object;
}

public static void main(String args[]){
Gen<String> str = new Gen<String>("answer");
Gen<Integer> intg = new Gen<Integer>(42);
System.out.println(str.getObject() + " =" + intg.getObject());
}
Code Options:
1- Gen<T>
2- Gen<?>
3- Gen
4- T
5- ?

فحنوت ألثم جرحه الرعافَ فانتكأت جراحي..

وهمت على خدي الدموع فقلت يا روحي وراحي..

هلّا رحمتَ قلوبنا .. وعدلت عن هذا الرّواحِ ِ ..؟

فأجابني البطل المسجّى هازئاً بيَ .. باقتراحي

كفكف دموعك ليس في عبراتك الحرّى ارتياحي

هذي سبيلي .. إن صدقت محبتي .. فاحمل سلاحي

Sun Certified Java Programmer

#25

مع انو خبرتي ضعيفة بالجينيريك بس على ما اعتقد الجواب هو الثاني

mofeedchaar@hotmail.com

مواضيع مشابهة