Android English Quiz Test
Android English Quiz Test
a. ScrollView
b. LinearLayout
c. ConstraintLayout
d. TableLayout
e. RelativeLayout
f. TotalLayout
g. GridLayout
2.Which of the following are methods specific to the activity life cycle?
a. onFinish
b. onStart
c. onRun
d. onResume
e. onTerminate
f. onPause
g. onCreate
h. onEnd
i. onDestroy
These are methods that are specific to the activity life cycle in Android, and they are called at
specific points in the life of an activity. onCreate is called when an activity is first created, onStart is
called when an activity becomes visible to the user, onResume is called when the activity starts
interacting with the user, onPause is called when the activity is no longer visible to the user, onStop
is called when the activity is no longer visible and it's about to be destroyed and onDestroy is called
when the activity is destroyed.
a. It is an implicit intent
b. It is not correct initialized
c. It is an explicit intent
d. Can be used to open a new Activity
e. Can be used to pass data
f. Can include the bundle class
This line of code creates an explicit Intent, which is used to start a new Activity by specifying the class
name of the Activity to be started. The first parameter of the Intent constructor is the context, in this
case "this" refers to the current activity. The second parameter is the class of the activity you want to
open. You can use this intent to pass data between activities by calling intent.putExtra("key", value) and
retrieve the data by calling getIntent().getExtra("key"). Also, you can include additional data, such as a
Bundle, by calling intent.putExtras(bundle) or intent.getExtras()
4.For the following snippet of code choose the correct statements that are used for storing the birth
date into a SharedPreference file.
//Salvare zi de nastere
a. editor.putDate(birthdate);
b. editor.save()
c. editor.commit
d. editor.putString(“BIRTHDATE”, new SimpleDateFormat(“dd-MM-yyyy”).format(birthdate));
e. editor.apply()
SharedPreferences are used to store key-value pairs of primitive data types. In this case, the
date object cannot be directly stored into a SharedPreference file, so it needs to be converted to
a string format. In this snippet of code, a new SimpleDateFormat object is created to format the
date object into a string with the format "dd-MM-yyyy" and this string is stored in the
SharedPreference file with the key "BIRTHDATE". editor.apply() is used to apply the changes
asynchronously, it commits the changes to the shared preferences file.
5. For initializing a visual control priorly defined in the xml layout of an activity, which method
should you use:
a. getViewById()
b. findViewById()
c. findViewByName()
d. getViewByName()
e. getControlById()
f. findControlByName()
g. findControlById()
In Android, when you define a visual control (such as a Button, TextView, or ImageView)
in an XML layout file, each control is assigned a unique ID. To initialize and interact with these
controls in your activity's Java code, you can use the method findViewById(). This method
takes an integer parameter, which is the ID of the control you want to initialize. For example:
In this example, my_button is the ID of the button defined in the XML layout, and R.id is a class
that holds the IDs of all controls defined in the XML layout.
6. Which property sets the distance between the content and the boundaries of a control?
a. size
b. padding
c. width
d. height
e. margin
The margin property sets the distance between the content of a control and the
boundaries of the control. It is used to create space around the control, separating it from other
controls or the edges of the screen. Margins can be set individually for each side of the control
(left, right, top, bottom) or all at once. The values of the margins are set in pixels, dp (density-
independent pixels), sp (scaled pixels), or other units.
a. size: it's not a property that sets the distance between the content and the boundaries of a
control. b. padding: it's the space between the content and the border of the control, it's similar
to margins but it's inside the control. c. width: it's the width of the control. d. height: it's the
height of the control.
7. Which of the following storage classes are valid in an SQLite database?
a. INTEGER
b. TEXT
c. NULL
d. DATETIME
e. STRING
f. BOOLEAN
g. REAL
h. BLOB
INTEGER, is used to store signed integers (whole numbers) TEXT, is used to store text strings
NULL, is used to store null values REAL, is used to store floating-point numbers (decimal values) BLOB, is
used to store binary data (images, audio, or other files)
System on a Chip
9. Which building management tools can be used implicitly (by default) in Android?
a. Gradle
b. Ant
c. MSBuild
d. CMake
e. Maven
Gradle is the default building management tool used in Android for building and managing
projects. It is a powerful and flexible build tool that uses a Groovy-based domain-specific language (DSL)
to define build scripts. Gradle is able to handle complex dependencies and provides advanced features
such as multi-project builds, incremental builds, and build caching. It can be used to automate the
building, testing, and deployment of Android applications. Gradle is integrated with Android Studio, the
official IDE for Android development, and it is the recommended tool for building and managing Android
projects.
The handler has a reference to the Looper class, which is an object that runs in the
background and dispatches messages to the appropriate thread. The Looper checks the message
queue for new messages and sends them to the handler for processing.
A handler can post messages into the MessageQueue, these messages can contain a
Runnable object, which will be executed by the thread the Looper is associated with.
b. knows how to handle runnable objects: The handler doesn't "know" how to handle runnable
objects, but it can post them to the MessageQueue for execution c. used for processing resources
based on their unique identifier: A handler is not responsible for processing resources based on
their unique identifier. e. block messages coming from a specific thread: A handler can't block
messages coming from a specific thread, but it can remove messages from the queue or process
them in a specific way based on the type or the sender of the message.
ARGB
12. What other controls can be used to simulate the behaviour of a RadioButton in a RadioGroup?
a. Switch
b. Chip
c. Button
d. ToggleButton
e. CheckBox
A ToggleButton is a two-state button that can be used to represent a binary choice. It can
be used to simulate the behavior of a RadioButton by using only two options, one for the "on"
state and one for the "off" state.
A CheckBox is also a binary choice control, but it can be used to simulate the behavior of
a RadioButton by using only one CheckBox per option and clear the selection on the other
options when one is selected.
a. getCount()
b. getItem()
c. getItemId()
d. getRow()
e. getView()
f. getItemPosition()
g. getPosition()
BaseAdapter is an abstract class that serves as the base class for adapters that can be
used in ListViews, GridViews, and Spinner controls. It provides a basic implementation of some
common methods that need to be overridden by the subclass.
getCount() is a method that returns the number of items in the adapter. It is used to determine
the number of items to be displayed in the list.
getItem(int position) is a method that returns the data item associated with the specified position
in the data set.
getItemId(int position) is a method that returns the row id associated with the specified position
in the list.
getView(int position, View convertView, ViewGroup parent) is a method that returns a view that
represents an item in the data set. It is used to create and bind views to the data.
14. What is the role of an Android adapter? (asta e putin cu semnul intrebarii)
An android adapter's role is to bridge the data and the UI, it behaves as an adapter between
the data and the UI. It creates a view for each item in the collection, manages items inside data
collections and mitigates the interaction between the data source and controls by handling the
data and creating the views that are displayed in the controls.
c. To bind the control of the data source: An adapter's role is to bind the data source to the
controls, not to control the data source.
a. To control how the data is handled by the user: An adapter's role is to provide data to the
UI, not to control how the user handles the data.
A custom adapter can extend from the BaseAdapter class or the CursorAdapter class.
BaseAdapter is an abstract class that serves as the base class for adapters that can be used
in ListViews, GridViews, and Spinner controls. It provides a basic implementation of some
common methods that need to be overridden by the subclass.
CursorAdapter is a concrete class that bridges data from a Cursor to a ListView. It provides
a way to use a Cursor as the data source for a ListView.
a. Spinner
b. WebView
c. ListView
d. AutoCompleteTextView
e. ToggleButton
f. GridView
g. ImageButton
An adapter can be used in conjunction with several types of controls in Android, some of
them are:
Spinner: A spinner is a drop-down list that allows users to select an item from a list. It
uses an adapter to bind the data to the spinner.
ListView: A list view is a vertically scrolling list of items. It uses an adapter to bind the
data to the list view.
AutoCompleteTextView: An AutoCompleteTextView is an editable text view that shows a
list of suggestions based on the characters that the user types. It uses an adapter to bind
the data to the suggestions list.
GridView: A GridView is a view group that displays items in a two-dimensional,
scrollable grid. It uses an adapter to bind the data to the grid view.
b. WebView is a control that is used to display web pages, it's not commonly used in
conjunction with an adapter e. ToggleButton is a control that is used to represent a binary
choice, it's not commonly used in conjunction with an adapter g. ImageButton is a control that is
used to display a button with an image, it's not commonly used in conjunction with an adapter
18. Which are the wrong intent actions, NOT used for dialing a phone number?
a. ACTION_ANSWER
b. ACTION_CALL
c. ACTION_RING
d. ACTION_PHONE
e. ACTION_DIAL
The Intent actions that are commonly used for dialing a phone number in android are:
ACTION_ANSWER is not used for dialing a phone number, it is used to answer an incoming
phone call. ACTION_RING is not used for dialing a phone number, it is used to ring the phone.
ACTION_PHONE is not a standard action, and it's not used for dialing a phone number
19.What are the true statements regarding the following snippet of code?
@Override
super.onCreate(savedInstanceState);
button.setOnClickListener(this);
a. The button is instructed to search for the onClick method at the activity level
b. The button doesn’t know how to handle the on click event
c. The button uses anonymous classes for managing the on click event
d. The activity must override the onClick(View view) method
e. The activity is forced to implement the View.OnClickListener interface
a. The button is instructed to search for the onClick method at the activity level by calling
setOnClickListener(this) b. The button doesn't know how to handle the on click event, but it
knows that it should listen for click events and that it should call a method to handle them. c.
The button does not use anonymous classes for managing the on click event, the activity is set as
the listener. d. The activity must override the onClick(View view) method so that it can handle
the click event. e. The activity is forced to implement the View.OnClickListener interface so that it
can handle the click event.
20. Which method allows users to use a file for writing in the internal storage?
a. openFileInput
b. openFileReading
c. openFileWriting
d. openFileOutput
e. saveToInternalStorage
openFileOutput is the method that allows users to use a file for writing in the internal storage. It
is a method of the Context class and it takes two parameters: the name of the file and the mode
in which it should be opened. It returns a FileOutputStream that can be used to write data to the
file.
a. openFileInput is used to read data from a file in internal storage. b. openFileReading is not a
valid method in Android c. openFileWriting is not a valid method in Android e.
saveToInternalStorage is not a valid method in Android
21. Which statements are correct for the following file description?
{ “item” : [ { “ name” “Popescu”},{“name”:”Ionescu}]}
a. A json array containing a json object with property item and values Popescu and Ionescu
b. A json object containing a property name with value Popescu
c. A json object containing a property item with an array of json objects
d. A json object containing a property item with values name, Popescu and Ionescu
e. A json array containing one single element
This is a json object containing a property "item" with an array of json objects as value, each object
contains a property "name" with a string value "Popescu" and "Ionescu" respectively
22. What class is used for translating geographics coordinates into street addresses a vice-a-versa?
a. MapConverter
b. LocationProvider
c. Address
d. LocationManager
e. Geocoder
The Geocoder class is used for translating geographics coordinates into street addresses (reverse
geocoding) and vice-versa (forward geocoding). It can be used to get the street address of a geographic
location or to get the geographic coordinates of a street address.
a. MapConverter is not a valid class in android b. LocationProvider is a class that provides location
updates from the location manager. c. Address is a class that represents an address, it's not used
for geocoding. d. LocationManager is a class that provides access to the system location
services.
22. try {
bufferedReader.close();
inputStreamReader.close();
inputStream.close();
connection.disconnect();
} catch (MalformedURLException e) {
e.prinStackTrace();
} catch (IOException e) {
e.printStackTrace();
The code contains a few errors that make it not able to be compiled.
The URL constructor expects a string parameter, but the code uses
"https://pastebin.com/rawBUXXu7fz" which is missing double quotes around it.
The last catch block is missing the "printStackTrace()" method, it should be "e.printStackTrace();"
There is an extra curly brace "}" at the end of the code which is causing a syntax error.
b. The code triggers a runtime exception: This statement is not correct, the code would not
trigger a runtime exception as it is not able to be compiled c. A MalformedUrlException
will be caught by the catch clause: This is correct, the first catch block is catching the
MalformedURLException which is thrown when a malformed URL is passed to the URL
constructor. d. The class HttpUrlConnection is not used properly: This statement is not
correct, the class is being used correctly, the code is creating an HttpURLConnection
object from a URL object, and then using the connection to make a request.
23. What is the first method called when instantiating an Activity?
a. onInit
b. onCreate
c. onTrigger
d. onStart
e. onInitialization
f. onBuild
a. getObjectFromJson()
b. getObject()
c. getJSONObject()
d. getJSONArray()
a. run()
b. onProgressUpdate()
c. onPostExecute()
d. onPreExecute()
e. doInBackground()
f. publishProgress()
These methods are part of the AsyncTask class and they are used to handle the background
tasks.
onPreExecute() method runs on the UI thread, it is called before the task starts.
onProgressUpdate() method also runs on the UI thread and it is called when
publishProgress() is called from the doInBackground() method.
onPostExecute() method runs on the UI thread after the task is completed.
28. Which is the Room adnotation used for defining the class associated with a table?
a. @Dao
b. @Entity
c. @Table
d. @View
e. @DatabaseTable
29. Which method is NOT used for displaying the layout of an activity?
a. displayView()
b. setContentView()
c. setView()
d. setLayoutView()
e. displayLayout()
setContentView(R.layout.activity_main);
30. What property is necessary to be updated when upgrading the structure of a database?
a. iteration
b. level
c. stage
d. version
e. number
31. Inside any method of an Activity class, the pointer this is referred to as a:
a. Component
b. View
c. Intent
d. Context
e. Application
f. ViewGroup
32. Which methods are used for calling the onDraw() method of a View?
a. invalidate()
b. onDraw()
c. drawing()
d. onRedraw()
e. postInvalidate()
f. rePaint()
They invalidate the view and schedule it for redrawing.
b. onDraw() is not a method that is called, it's a method that needs to be overridden in a
custom View class to perform the actual drawing.
c. drawing() is not a standard method provided by the Android framework for calling the
onDraw() method.
d. onRedraw() is not a standard method provided by the Android framework for calling
the onDraw() method.
f. rePaint() is not a standard method provided by the Android framework for calling the
onDraw() method.
33. Which of the following methods could be called when an activity goes in the background?
a. onPause()
b. onDestroy()
c. onStop()
d. onFinish()
e. onResume()
f. onCreate()
g. onStart()
The onPause() method is called when the activity is no longer in the foreground, but it is
still visible on the screen, for example when a dialog box or a menu is opened. The onStop()
method is called when the activity is no longer visible on the screen and it's about to be closed or
another activity is about to be started.
The onDestroy() method is called when the activity is about to be closed and all the
resources should be released. The onFinish() method is not a valid lifecycle method in android.
The onResume() method is called when the activity comes back to the foreground. The
onCreate() method is called when the activity is first created and it's used to initialize the
activity. The onStart() method is called when the activity becomes visible on the screen.
e. the associated XML file is stored under res/xml (it’s actually under res/layout)
C/C++
a. Paint
b. ColorGradient
c. Gradient
d. Shader
e. Pixel