Lab7 Self Assessment

Lab7 Self Assessment


Q1 What is the purpose of Volley in Android?

Answer

A type-safe client for consuming RESTful APIs in Android and Java in general.

A convenience library that makes network calls easier and faster.

An Android unit testing framework.

An analytics tool that can shed light on parts of an app's UI that are used most/least.



Answer: A convenience library that makes network calls easier and faster.


Q2To use Volley in Android, the following line must be added to what file in the Android Project?

    implementation 'com.android.volley:volley:1.2.1'

Answer

AndroidManifest.xml

MainActivity.java

build.gradle app

activity_main.xml




Answer: build.gradle app


Q3 If the UI begins to behave sluggishly or crash while making network calls this is likely due to
Answer

Hardware malfunction

Activity Manager contains too much coding

Virus on server

Network Latency


Answer:  Network Latency

Q4 What must be set in the Android project in order to use Volley? (There is more than 1 answer)
Answer

The latest version of Volley library to the app's build.gradle file

The ProgressBar in the activity_main.xml

Import the Volley library in the MainActivity.java

The internet permission in the AndroidManifest file


Answer: All Correct  EXCEPT  The ProgressBar in the activity_main.xml

Q5 What is the Request class included in the Android Volley ? (There is more than 1 answer)
Answer
String request

Boolean request

JsonObject request

Image request.


Answer: All Correct  EXCEPT  Boolean request

Q6 How many parameters are there in the JsonObjectRequest of Android Volley?
Answer

3

4

5

6


Answer:  5

Q7  What caused the following RunTime Exception [Permission Denied] as shown in the screenshot from Android Studio below?

Answer

Programmer did not set Permission for accessing SD card in AndroidManifest file

Programmer did not set Permission for accessing Network in AndroidManifest file

Programmer did not re-start XAMPP Server

The AndroidManifest file is missing


Answer:  Programmer did not set Permission for accessing Network in AndroidManifest file

Q8 Which one of the following code snippets is the correct sequence to use Volley in Android app?
Answer

RequestQueue.add(this);

JsonObjectRequest request = JsonObjectRequest(Request.Method.GET, url, jsonRequest, new ResponseListener(), new ErrorListener());

RequestQueue(request); 

RequestQueue requestQueue = Volley.newRequestQueue(this); 

JsonObjectRequest request = JsonObjectRequest(Request.Method.GET, url, jsonRequest, new ResponseListener(), new ErrorListener());

requestQueue.add(request);

RequestQueue requestQueue = Volley.newRequestQueue(this); 

JsonObjectRequest request = JsonObjectRequest(Request.Method.GET, url, jsonRequest, new ResponseListener(), new ErrorListener());

request.add(requestQuest);

RequestQueue requestQueue = Volley.newRequestQueue(this); 

JsonObjectRequest request = JsonObjectRequest(Request.Method.GET, url, jsonRequest, new ResponseListener(), new ErrorListener());

requestQueue.run(request);



Answer:  

RequestQueue requestQueue = Volley.newRequestQueue(this); 

JsonObjectRequest request = JsonObjectRequest(Request.Method.GET, url, jsonRequest, new ResponseListener(), new ErrorListener());

requestQueue.add(request);



Q9  Below is the sample code to create a JsonObjectRequest.  What is the purpose of the ResponseListener( )? 

JsonObjectRequest request = JsonObjectRequest(Request.Method.POST, url, jsonRequest, new ResponseListener(), new ErrorListener());

Answer

For you to add codes to handle the response from the web

For you to post http request to the web

For you to handle any error

For you to format the JSON object


Answer:  For you to add codes to handle the response from the web


    Q10 Below is the sample code to create a JsonObjectRequest.  What is the purpose of the the parameter 'jsonRequest' inside the JsonObjectRequest shown below? 

JsonObjectRequest request = JsonObjectRequest(Request.Method.POST, url, jsonRequest, new ResponseListener(), new ErrorListener());

Answer

To format the JSON object

The JSON object that you want to post with the request

To process the JSON object return from this request

To handle any error in this JsonObjectRequest


Answer:  The JSON object that you want to post with the request





Comments

Popular posts from this blog

Simple Login Example (PHP Server + Android Client)

Lab 6: Using split