android banner

Android Multiple Choice Questions (MCQs) and Answers

Master Android with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Android concepts. Begin your placement preparation journey now!

Q61

Q61 How do you set a click listener for a Button in Android?

A

button.setOnClickListener(this);

B

button.addClickListener();

C

button.onClick(this);

D

button.clickListener(this);

Q62

Q62 How do you update the text in a TextView in Java code?

A

textView.updateText("New Text");

B

textView.setText("New Text");

C

textView.changeText("New Text");

D

textView.modifyText("New Text");

Q63

Q63 How do you retrieve the selected value from a Spinner in Android?

A

spinner.getSelectedItem();

B

spinner.getSelected();

C

spinner.retrieveSelection();

D

spinner.selectedItem();

Q64

Q64 How do you handle multiple checkbox selections programmatically in Android?

A

By using checkbox.onSelectListener();

B

By looping through checkboxes and checking their isChecked() status

C

By using checkbox.onMultipleSelect();

D

By using checkboxGroup();

Q65

Q65 A Button in your app is not responding to clicks. What is the most likely issue?

A

The Button is invisible

B

The Button has no click listener

C

The Button is disabled

D

The Button has no ID

Q66

Q66 A ListView displays no data even though the adapter is properly set. What could be the issue?

A

The ListView is not in the layout file

B

The adapter is empty

C

The ListView has no click listener

D

The ListView is not visible

Q67

Q67 An app crashes when trying to update a ProgressBar. What is a likely cause?

A

The ProgressBar is set to wrap_content

B

The ProgressBar is not in the main layout

C

The app tries to update UI from a background thread

D

The ProgressBar has no ID

Q68

Q68 What is the main purpose of Shared Preferences in Android?

A

To store files

B

To store key-value pairs of primitive data

C

To store large databases

D

To store images

Q69

Q69 What is SQLite used for in Android?

A

Storing structured data in tables

B

Storing images

C

Storing network data

D

Storing UI layouts

Q70

Q70 What is the maximum size of data that can be stored in Shared Preferences?

A

1MB

B

5MB

C

10MB

D

No strict limit

Q71

Q71 How do you delete a value from Shared Preferences?

A

preferences.clearValue("key");

B

preferences.edit().remove("key").apply();

C

preferences.delete("key");

D

preferences.edit().delete("key");

Q72

Q72 What is the main advantage of using SQLite over Shared Preferences for data storage?

A

Faster read and write operations

B

Ability to store large datasets and complex queries

C

Requires no permissions

D

Stores UI elements

Q73

Q73 How do you save a string in Shared Preferences in Android?

A

editor.put("key", value).apply();

B

editor.putString("key", value).apply();

C

preferences.add("key", value).apply();

D

editor.save("key", value);

Q74

Q74 How do you create or open a SQLite database in Android?

A

SQLiteDatabase.openOrCreateDatabase();

B

SQLiteDatabase.createDatabase();

C

SQLite.open();

D

SQLiteDatabase.getInstance();

Q75

Q75 How do you insert a new row into an SQLite database in Android?

A

db.insertRow();

B

db.insert("table", nullColumnHack, contentValues);

C

db.addRow();

D

db.save("table", contentValues);

Q76

Q76 How do you query data from an SQLite database using raw SQL?

A

db.query("SELECT * FROM table");

B

db.rawQuery("SELECT * FROM table", null);

C

db.runQuery("table");

D

db.executeQuery("table");

Q77

Q77 An app fails to retrieve a value from Shared Preferences. What could be the most likely issue?

A

The key does not exist

B

The key is stored incorrectly

C

The app has no internet access

D

The preferences file is corrupted

Q78

Q78 An SQLite database query in Android is returning no data. What is the most probable cause?

A

The database is not open

B

The query is malformed

C

The app has no permissions

D

The database connection is lost

Q79

Q79 An app crashes when trying to update the SQLite database. What could be a likely cause?

A

The database is locked

B

The app has no permissions

C

The table is missing

D

The query is incorrect

Q80

Q80 What is the primary purpose of using networking in Android apps?

A

To display images

B

To manage background services

C

To interact with web servers and APIs

D

To store local data

Q81

Q81 Which class is commonly used in Android to manage HTTP connections?

A

HttpURLConnection

B

SQLiteConnection

C

ServerSocket

D

HttpSocket

Q82

Q82 What does REST stand for in the context of web services?

A

Remote Event Service Tracking

B

Representational State Transfer

C

Remote Element State Transfer

D

Resource Event Service

Q83

Q83 What is the purpose of using Retrofit in Android?

A

To manage UI layouts

B

To make network requests easier

C

To handle database operations

D

To manage notifications

Q84

Q84 What is the advantage of using OkHttp over HttpURLConnection?

A

OkHttp supports caching and connection pooling

B

OkHttp requires less code

C

OkHttp has faster request time

D

OkHttp is built-in

Q85

Q85 How do you execute a GET request using HttpURLConnection?

A

connection.setRequestMethod("POST");

B

connection.getRequestMethod("GET");

C

connection.setRequestMethod("GET");

D

connection.execute("GET");

Q86

Q86 How do you handle a JSON response from a web server in Android?

A

Use JSONParser

B

Use XMLParser

C

Use JSONObject and JSONArray classes

D

Use HttpResponseHandler

Q87

Q87 How do you send data to a web server using a POST request in Retrofit?

A

@GET

B

@POST

C

@PUT

D

@DELETE

Q88

Q88 How do you make an asynchronous network call using Retrofit in Android?

A

Call call = api.getData();

B

Response response = api.getData();

C

Call call = api.getData().enqueue();

D

api.getData();

Q89

Q89 A network request in your Android app is timing out. What is the most likely cause?

A

The server is down

B

The URL is incorrect

C

The network is slow

D

The timeout duration is too short

Q90

Q90 An API response in your Android app returns 404. What does this status code indicate?

A

The request was successful

B

The server could not find the resource

C

There was a server error

D

The client is unauthorized

ad verticalad vertical
ad