国外android 工程师面试题

1.What is true about a Context?

Select one:
a. You can access activity's context directly from anonymous inner classes like button click listeners
b. Activity and Service will have its own Context
c. Both of the above
d. None of the above

2.Which callback should be used whenever an activity is about to be killed?

Select one:
a. onActivityDestroyed()
b. onRestoreInstanceState()
c. onSaveInstanceState()
d. Any of the above

3.Correct way to provide current context in an anonymous inner class is/are

Select one:
a. Use 'Context.this' instead of 'this'
b. Use getApplicationContext() instead of 'this'
c. Explicitly use the class name 'MenuScreen.this'

d. All of the above


4.Any launched activity that returns data causes the same onActivityResult() function to be called. Therefore how to distinguish which activity is returning using the parameters of: onActivityResult(int requestCode, int resultCode, Intent data)?

Select one:
a. resultCode
b. data
c. requestCode

d. None of the above


5.Which one of the following statements is true?

Select one:
a. Activities contain intents
b. Activities contain views and fragments
c. Views contain Fragments

d. Applications contain activities, services, implicit intents and content providers


6.If an activity needs to stop or be killed, then how can a background operation keep running?

Select one:
a. Run the operation as a thread
b. Run the operation as a service
c. Run the operation as a service or a thread

d. Run the operation as a service or as a thread with keepAlive() call


7.For an AlertDialog what is the order of buttons, if added?

Select one:
a. BUTTON_NEUTRAL, BUTTON_NEGATIVE, BUTTON_POSITIVE
b. BUTTON_POSITIVE, BUTTON_NEUTRAL, BUTTON_NEGATIVE
c. BUTTON_POSITIVE, BUTTON_NEGATIVE, BUTTON_NEUTRAL

d. BUTTON_NEGATIVE, BUTTON_NEUTRAL, BUTTON_POSITIVE


8.To center align a view within its parent use

Select one:
a. layout_centerInParent
b. layout_centerHorizontal
c. layout_centerVertical

d. All of the above


9.How should a package be named as a best practice?

Select one:
a. Dont start the package name with a domain you own like com.mydomain
b. Dont start the package name with com.example
c. Start the package name with com.android

d. All of the above


10.In the resource reference syntax "[package:]type/name" if "package" is not specified then how is "type/name" resolved?

Select one:
a. gives a compilation error
b. based on local resources and the application’s local R.java package
c. Resolves from the system namespaces like "android"

d. Resolves at runtime with available namespaces


11.How can you pre-define a resource id to use in future?

Select one:
a. <item type="id" name="text1">
b. <string name="text1">hello 1</string>
c. %lt;string type="pre" name="text1">hello 1%lt;/string>

d. None of the above


12.How can you pass a "where" clause in the content provider query?  

Select one:
a. using the URI "content://.../../employee/23"
b. managedQuery("content://.../../employee" ,null ,"_empId=?" ,new String[] {23} ,null);
c. managedQuery("content://.../../employee" ,null ,"_empId=?" ,new String[] {23} ,"_empName ASC");

d. All of the above


13.How you CANNOT put extra info into an intent?

Select one:
a. intent.putExtras(Bundle bundle);
b. intent.putExtras(Intent intent);
c. intent.putExtra(String name, double value)

d. intent.putExtra(String name, Intent intent)


14.Which one of the following is NOT a standard "activity action"?  

Select one:
a. ACTION_CALL
b. ACTION_DELETE
c. ACTION_SHUTDOWN

d. ACTION_SYNC


15.How can a Spannable be used with an EditText field?

Select one:
a. To set styles on the text dynamically at runtime
b. To check spelling of the user entered text
c. To get the height, width, padding, margin of the textbox
d. All of the above

16.What is the right way to find an existing fragment running in your application?


Select one:
a. FragmentManager.findFragmentByTag()
b. FragmentManager.getFragment()
c. FragmentManager.findFragmentById()
d. All of the above

17.Can a dialog fragment show another dialog fragment? If yes how?


Select one:
a. No, because it will create a layering issue.
b. Yes. By saving the existing transaction on the back stack.
c. Yes. By opening a child dialog fragment overlaying the existing one.
d. Yes. By opening a child dialog fragment destroying the existing one.

18.How best do you design a pattern so that all your activities can share a common action/menu bar?

Select one:
a. Use fragments
b. Use home icon of an action bar to interact with the menu infrastructure.
c. Use a tabbed action bar
d. Any of the above

19.The Debug Perspective in Eclipse does NOT give you access to the following tab:  

Select one:
a. Debug - Displays previously and currently debugged Android applications and its currently running threads
b. Variables - When breakpoints are set, displays variable values during code execution
c. Breakpoints - Displays a list of the set breakpoints in your application code
d. Devices - Shows the list of devices and AVDs that are connected to ADB.

20.What is the category name that should be used in AndroidManifest.xml for a PreferenceActivity?

Select one:
a. android.intent.category.PREFERENCEACTIVITY
b. android.intent.category.PREFERENCE
c. android.intent.category.ACTIVITYPREFS
d. android.intent.category.DEFAULT
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飛越無限

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值