AP4: Cross-Platform Mobile Application Midterm Examination
Topic: XAMARIN (30pts)
Test I. Directions: Read each statement carefully. Choose the letter that corresponds to the best answer. Nx1
1. What layout that is a UI element that displays items in a two-dimensional grid that can be scrolled?
a. Gridlayout b. GridView c. Tabbed Layout d. RecyclerView
2. What layout that is a view group that displays child view elements in a relative position?
a. Linear Layout b. Tabbed Layout c. Grid Layout d. Relative Layout
3. Facebook Messenger is a FREE mobile messaging app used for instant messaging, sharing photos, videos, audio
recordings and for group chats. In the chat inbox, what UI element that displays a collection of items in a list and
enabling him to scroll through it?
a. List View b. Recycler View c. Grid View d. Text View
4. Xamarin is an open source mobile UI framework for building cross-platform applications with .NET from a single
shared codebase. The methods are in C# and the UI is in ____.
a. XAML b. HTML c. JAVA d. XHTML
5. What controls that is a UI component that presents text and image content in views that resemble cards?
a. Edit Text b. CardView c. Navigation Bar d. Pickers
6. The teacher asked John to include a widget that will allow him to flip a setting between two states. What widget will he
use?
a. Radio Button b. Check Box c. Custom Button d. Toggle Button
7. Which of the following statements is true about XAMARIN?
a. Not real native compilation as it uses Cordova wrapper
b. Browser related issues persist as it uses Web View
c. Need to wait for the new API to integrate
d. Works with the latest SDK
8. The following choices below are XAMARIN’s unique approach EXCEPT:
a. Multiple teams and code bases with different toolsets
b. Shared code across platforms with full API coverage
c. Native user interface and performance
d. All of the above
9. Maria listed 50 ingredients in her notes app for her project. She scrolled down to find the fifth ingredient. What view
group that creates a list of scrollable items?
a. Grid View b. List View c. Card View d. Recycler View
10. XAML is a markup language developed by Microsoft and is used for creating application interfaces. It is similar to HTML,
defines the content of a webpage. XAML stands for
a. Expandable Application Markup Language
b. Extensible Application Markup Language
c. Extension Application Markup Language
d. Erasable Application Markup Language
11. A layout widget that is used to display items in a horizontally scrolling list and it positions the current selection at the
center of the view.
a. Card View b. Navigation c. Gallery d. Calendar
12. Buttons are UI elements that the user taps to perform an action. What button allows the user to select one or more
options from a set?
a. Radio Button b. Toggle Button c. Check Box d. Custom Button
13. Sharon bought a new smart phone but she can’t see any hardware buttons for home, back and menu. What widget
does she need?
a. Navigation Bar b. Menu Bar c. Toggle Button d. Grid View
14. These are UI elements that allow the user to pick a date or a time using dialogs that are provided by Android.
a. Calendar b. Pickers c. Gallery d. Card View
15. A view group that displays child view elements in linear direction, either vertically or horizontally.
a. Relative Layout b. Grid Layout c. Tabbed Layout d. Linear Layout
16. What is data binding in Xamarin?
a) A technique for connecting UI elements to data sources
b) A method for encrypting sensitive data
c) A way to organize project files
d) A tool for debugging code
17. You are developing a [Link] application that requires users to enter their email address. Which widget should
you use to capture this information?
a) TextView
b) EditText
c) ImageView
d) Button
18. In a [Link] application, you need to display an image that adjusts its size based on the device's screen size.
Which layout should you use?
a) RelativeLayout
b) AbsoluteLayout
c) LinearLayout
d) ConstraintLayout
19. You want to display a list of items horizontally in a [Link] application. Which layout should you use?
a) RelativeLayout
b) AbsoluteLayout
c) StackLayout (Horizontal)
d) GridLayout
20. You are designing a [Link] application and need to position a button below an image on the screen. Which
layout should you use?
a) RelativeLayout
b) AbsoluteLayout
c) LinearLayout
d) FrameLayout
21. You are building a [Link] application and want to display a label with formatted text. Which widget should
you use?
a) TextView
b) EditText
c) Button
d) ImageView
22. You need to create a custom layout that positions elements relative to each other in a [Link] application.
Which layout should you use?
a) RelativeLayout
b) AbsoluteLayout
c) LinearLayout
d) FrameLayout
23. You want to display a grid of images in a [Link] application. Which layout should you use?
a) RelativeLayout
b) AbsoluteLayout
c) StackLayout
d) GridLayout
24. You need to create a responsive design for a [Link] application that adjusts elements based on screen size
and orientation. Which layout should you use?
a) RelativeLayout
b) AbsoluteLayout
c) LinearLayout
d) ConstraintLayout
25. You are designing a [Link] application where you want to display a button with an icon next to it. Which
widget should you use?
a) TextView b) EditText c) Button d) ImageView
26. You need to create a layout in [Link] where elements are stacked on top of each other. Which layout
should you use?
a) RelativeLayout
b) AbsoluteLayout
c) LinearLayout
d) FrameLayout
27. You want to create a [Link] application with a master-detail layout. Which widget should you use for the
master view?
a) TextView b) EditText c) ListView d) Button
28. You need to display a label with a clickable hyperlink in a [Link] application. Which widget should you use?
a) TextView b) EditTex c) Button d) ImageView
29. You want to create a [Link] application with a scrollable list of items. Which layout should you use?
a) RelativeLayout b) AbsoluteLayout c) LinearLayout d) ScrollView
30. You need to create a layout where elements are positioned relative to a guideline in a [Link] application.
Which layout should you use?
a) RelativeLayout b) AbsoluteLayout c) LinearLayout d) ConstraintLayout
31. You want to create a [Link] application with a tabbed layout. Which widget should you use to implement
this?
a) TextView b) EditText c) Button d) TabbedPage
32. You are designing a [Link] application where you need to position elements in a circular pattern. Which
layout should you use?
a) RelativeLayout b) AbsoluteLayout c) LinearLayout d) FrameLayout
33. You need to create a layout in [Link] where elements are positioned absolutely, ignoring the positions of
other elements. Which layout should you use?
a) RelativeLayout
b) AbsoluteLayout
c) LinearLayout
d) FrameLayout
34. You are designing a [Link] application where you want to display a list of selectable items. Which widget
should you use?
a) TextView b) EditText c) Button d) ListView
35. You need to perform some initialization tasks when a [Link] activity is first created. Which method should
you override for this purpose?
a) OnCreate() b) OnStart() c) OnResume() d) Initialize()
36. What is the purpose of the [Link] file in a [Link] project?
a) It contains the application's source code
b) It defines the layout of the user interface
c) It specifies the permissions required by the application
d) It handles database operations
37. What is an Activity in [Link]?
a) A background process that runs independently of the user interface
b) The layout file defining the user interface of an application
c) A class representing a single screen with a user interface
d) A component responsible for handling database operations
38. In [Link], what is the purpose of an Intent?
a) It defines the layout of the user interface
b) It represents an operation to be performed, such as opening a new activity
c) It handles database operations
d) It contains the application's source code
39. What is a Fragment in [Link]?
a) A class representing a single screen with a user interface
b) A background process that runs independently of the user interface
c) A reusable portion of a user interface that can be combined with other fragments in an activity
d) A component responsible for handling database operations
40. What is the purpose of the Resource folder in a [Link] project?
a) It contains the application's source code
b) It defines the layout of the user interface
c) It specifies the permissions required by the application
d) It stores resources such as images, strings, and layouts
41. What is the role of the Android Asset Packaging Tool (AAPT) in [Link] development?
a) It compiles Java source code into bytecode
b) It generates the APK file containing the compiled application code and resources
c) It manages database operations
d) It handles the deployment of applications to devices
42. What is the Android Debug Bridge (ADB) used for in [Link] development?
a) It manages database operations
b) It handles the deployment of applications to devices
c) It compiles Java source code into bytecode
d) It provides a command-line interface for interacting with Android devices
43. What is an APK file in [Link] development?
a) An executable file containing compiled application code and resources
b) A layout file defining the user interface of an application
c) A database file used by the application
d) A configuration file specifying application permissions
44. What is the purpose of the Android SDK Manager in [Link] development?
a) It manages database operations
b) It compiles Java source code into bytecode
c) It handles the installation and management of Android SDK components and tools
d) It provides a graphical user interface for designing application layouts
45. What is the purpose of the Android Emulator in [Link] development?
a) It provides a graphical user interface for designing application layouts
b) It manages database operations
c) It allows developers to test their applications on virtual Android devices
d) It compiles Java source code into bytecode
46. What is the Android Virtual Device (AVD) Manager used for in [Link] development?
a) It manages database operations
b) It provides a graphical user interface for designing application layouts
c) It handles the creation and management of virtual Android devices for testing
d) It compiles Java source code into bytecode
47. What is the purpose of the Android Asset Studio in [Link] development?
a) It provides a graphical user interface for designing application layouts
b) It manages database operations
c) It generates icons, splash screens, and other graphical assets for Android applications
d) It compiles Java source code into bytecode
48. What is an Intent Filter in [Link] development?
a) It specifies the permissions required by the application
b) It defines the layout of the user interface
c) It filters incoming Intents based on specified criteria
d) It compiles Java source code into bytecode
49. What is the role of the Android Runtime (ART) in [Link] development?
a) It compiles Java source code into bytecode
b) It manages database operations
c) It handles the execution of compiled application code on Android devices
d) It provides a graphical user interface for designing application layouts
50. What is the purpose of the Android SDK (Software Development Kit) in [Link] development?
a) It provides a graphical user interface for designing application layouts
b) It manages database operations
c) It contains tools, libraries, and documentation necessary for Android app development
d) It compiles Java source code into bytecode
51. A type of intent which is commonly used when launching an activity (from another one) within the same application.
a. Explicit b. Implicit c. Inplicit d. Ex-Implicit
52. In the facebook app, some of the posts, when after clicking it will lead you to another page through a browser. This kind
of intent is
a. Implicit b. Inplicit c. Explicit d. Ex-Implicit
53. An Activity is a single screen in Android application. The concept of Activities is unusual in programming and it's specific
to Android platform. Choose the correct option regarding activity in android.
a. An activity is a window that contains the user interface of your application.
b. An application can have zero or more activities.
c. An application can have only one activity.
d. Both A and B
54. Suppose that there are two activities in an application named ActivityOne and ActivityTwo. You want to invoke
ActivityTwo from ActivityOne. What code you will write?
a. Intent intent=new Intent (this, [Link]); startActivity(intent);
b. startActivity(new Intent(this, [Link]));
c. Option A and B are correct.
d. None of the above.
55. If you want to navigate from one activity to another then android provides you which class?
a. Object b. startActivity c. intent d. activityStart
56. If you need to pass data back from an activity, which method you should use?
a. startActivity() b. startActivityForResult() c. ActivityForResult() d. StartResult()
57. Suppose that there are two activities in an application named FirstActivity and SecondActivity. You want to send
website name from ActivityOne to ActivityTwo. What code you will write? Suppose that website name is
“[Link]”
a) Intent intent=new Intent (this, [Link]);
[Link]("name", “[Link]”);
startActivity(intent);
b) Intent intent=new Intent (this, [Link]);
[Link]( “[Link]”);
startActivity(intent);
d) Intent intent=new Intent ();
[Link]("name", “[Link]”);
startActivity(intent);
d) None of the above.
58. These are short pop-up messages that show up for a few seconds and then fade away.
a. AlertBox b. AlertDialog c. Toast d. MessageBox
59. AlertDialog is capable of constructing most dialog user interfaces and is the suggested dialog type. Dialogs can have
these features below, except
a. Title b. Message c. Up to 6 buttons d. List of selected items
60. Which is not true about dialog?
a. Normally used for notifications and short activities that directly relate to the app in progress
b. The underlying Activity loses focus and the dialog accepts all user interaction
c. Usually a small window that appears in front of the current activity
d. Searches the component by comparing the intent filter
Topic: Android Intent and AlertDialog (20 points)
Test II. Coding
Directions: Fill in the missing codes.
1.
private void List_ItemClick(object sender, [Link] e)
{
AlertDialog.1)_______alertDiag = new [Link](this);
alertDiag.2)_______(“Confirm delete?”);
alertDiag.3)___________(“Once deleted the move cannot be undone”);
alertDiag.4)__________(“Delete”, (senderAlert, args) => {
Toast.5)_______(this, “Deleted”, 6)___________.Short).Show();
});
alertDiag.7)__________(“Cancel”, (senderAlert, args) => {
alertDiag.8)________();
});
Dialog diag = alertDiag.9)______();
diag.10)_____();
}
2.
FILENAME: [Link]
var edtName = 11)______-<EditText>([Link]);
var edtEmail = FindViewById<EditText>([Link]);
var btnClick = FindViewById<12)_______>([Link]);
btnClick.13)______ +=(s,e) =>
{
Intent nextActivity = new 14)______(15)____, typeOf(Reactivity));
nextActivity.16)________ (“name”, [Link]);
[Link](“email”, [Link]);
17)_______(nextActivity);
};
FILENAME: [Link]
string name = Intent.18)________(“name” ?? “Not recv”);
string email = [Link](“email” ?? “Not recv”);
var txtName = FindViewById<TextView>([Link]);
var txtEmail = FindViewById<TextView>([Link]);
var btnBack = FindViewById<19)______>([Link]);
[Link] = name;
[Link] = email;
[Link] += delegate {
this.20)_____;
};
Even youths grow tired and weary, and young men stumble and fall. But those who hope in the LORD will renew their
strength. They will soar on wings like eagles; they will run and not grow weary, they will walk and not be faint.
Isaiah 40:30-31