Computer Knowledge

Java Core Classes and Threads

1,935 Questions

Java core classes and threads form the foundation of object oriented programming and are crucial for IT officer and programming exams. This includes concepts like string mutability, collections, and multithreading. Solve these questions to test your practical coding and theoretical knowledge.

String and StringBuffer classesThread execution methodsJava collections frameworkCharacter streams input outputVariable serialization rules

Java Core Classes and Threads Questions

Multiple choice
  1. Events are useful way to collect data about a user's interaction with interactive components of your app.

  2. Events are usually generated in response to an external action.

  3. Most commonly used event (any android application), is interaction with touch screen.

  4. All of the above

  5. Android framework maintains an event queue into which events are placed as they occur.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Yes, all the above points are absolutely correct about an event related to android application.

Multiple choice
  1. 1 – A, 2 – B, 3 – C, 4 – D, 5 – E, 6 – F

  2. 1 – B, 2 – C, 3 – A, 4 – F, 5 – E, 6 – D

  3. 1 – C, 2 – B, 3 – A, 4 – E, 5 – F, 6 – D

  4. 1 – A, 2 – C, 3 – B, 4 – D, 5 – F, 6 – E

  5. 1 – E, 2 – C, 3 – B, 4 – D, 5 – F, 6 – A

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Here the mapping of the Event Handlers and Event Listeners are very simple. But, notice that they are case sensitive. With the help of Eclipse IDE, this is easy enough.

Multiple choice
  1. Intent intent = new Intent(MyActivity.this, MyOtherActivity); startActivity(intent);

  2. Intent intent = new Intent(MyActivity.this, MyOtherActivity.class); startActivity(intent);

  3. Intent intent = new Intent(MyActivity.class, MyOtherActivity.class); startActivity(intent);

  4. Intent intent = new Intent(this, MyOtherActivity.this); startActivity(intent);

  5. Intent intent = new Intent(MyOtherActivity.class); startActivity(intent);

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

After calling startActivity, the new activity, i.e. MyOtherActivity will be created and will move to the top of the activity stack.

Multiple choice
  1. a – 1; b – 5; c – 6; d – 7; e – 4; f – 3; g – 2

  2. a – 2; b – 5; c – 6; d – 7; e – 4; f – 3; g – 1

  3. a – 2; b – 4; c – 6; d – 7; e – 5; f – 3; g – 1

  4. None of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

.

Multiple choice
  1. Only A

  2. Only B

  3. Both A and B

  4. Neither A nor B

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The getCount() returns the total number of fragments in the pages and the getItem() returns the fragment at the specified position.This method will be called as the user scrolls through the pages.

Multiple choice
  1. doInBackground()

  2. doInFront()

  3. onPreExecute()

  4. onPostExecute()

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Following are the methods provided by AsyncTask: doInBackground(), onPreExecute(),onPostExecute(), onProgressUpdate(), isCancelled(). There is no method called doInFront() provided by AsyncTask.

Multiple choice
  1. Environment.getExternalStoragePath()

  2. Environment.getExternalStorageState()

  3. Environment.getExternalStorageDirectory()

  4. None of above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Environment.getExternalStorageDirectory() returns the File object representing the primary external storage directory. getExternalStorageState() returns storage state (mounted/shared/etc), and getExternalStoragePath() is not a standard Android API.