Computer Knowledge
GUI and Web Frameworks
1,711 Questions
Graphical user interface and web frameworks involve layout management, directives, and application design across platforms like Android and Angular. These concepts are tested in computer science and IT officer competitive exams. Review these questions to understand UI components and coding standards.
Android layout attributesAngular structural directivesVB.Net web methodsJava Swing componentsSiebel application framework
GUI and Web Frameworks Questions
-
All the resources should be placed directly under the root directory.
-
All the resources should be placed directly under the res/ directory.
-
You should place each type of resource in a specific directory of your project's res/ directory.
-
You can define your own user defined directories and place all the resources over there.
-
None of these
C
Correct answer
Explanation
Android requires resources to be organized in specific subdirectories under res/ (like res/layout for XML layouts, res/drawable for images, res/values for strings/colors). Placing all resources directly under res/ or in custom user-defined directories will not work - the build system expects specific subdirectory names.
-
Log window
-
Log cat
-
Error log
-
Message log
-
Log
-
Menu bar
-
Title bar
-
Toolbar
-
Toolbar
D
Correct answer
Explanation
The action bar is automatically added to your app if it is using one of the Holo themes. Theme Holo is the default for all apps in Android 3.0.
-
Android 4.0
-
Android 3.0
-
Android 4.2.2
-
Android 2.0
D
Correct answer
Explanation
Action bar API is not available on android versions before 3.0.
-
withText
-
ifRoom
-
ifNotRoom
-
withRoom
B
Correct answer
Explanation
It is recommended that the android:showAsAction attributes to ifRoom, which will display the menu item as an action item only if there is enough room on the display. On a small size screen, the actions will collapse into the overflow menu.
-
This will collapse the action view into just an action item.
-
This will completely collapse the action view.
-
This will completely collapse the action item.
-
The search widget would consume space on the action bar even when it is not in use.
A
Correct answer
Explanation
The given code will collapse the action view into just an action item. Otherwise, the search widget would consume space on the action bar even when it is not in use.
-
Tab navigation mode
-
Viewpager
-
List navigation mode
-
Tabwidget
C
Correct answer
Explanation
List navigation mode is a good choice when the number of possible navigation options are too large to make tabs practical.
-
Only A
-
Only B
-
Both A and B
-
Neither A nor B
C
Correct answer
Explanation
ActionProvider is a new class available in Android 4.0. The action bar is a way to quickly add functionality to your application, while maintaining a native platform look and feel. Hence, both statements are correct.
-
ActionBar
-
ActionBarListener
-
ActionProvider
-
TabListener
D
Correct answer
Explanation
TabListener is used to implement the methods onTabSelected, onTabUnselected and onTabReselected.
-
ActionBar
-
TabWidget
-
ViewPager
-
Tab
B
Correct answer
Explanation
If you need to add tabs to a sub-view of your app, you can create a tab-style interface by using a TabWidget.
-
<activity>
android:name=”.SampleActivity” android:uiOptions=”splitActionBar”>
</activity>
-
<activity> android:name=”.SampleActivity” android:uiOptions=”splitActionBarWhenNarrow”> </activity>
-
<activity> android:name=”.SampleActivity” android:uiOptions=”splitActionBarNarrow”> </activity>
-
<activity> android:name=”.SampleActivity” android:Options=”splitActionBarWhenNarrow”> </activity>
B
Correct answer
Explanation
To enable a split action bar on an activity, the code is:
android:name=”.SampleActivity” android:uiOptions=”splitActionBarWhenNarrow”>
-
TabHost
-
TabWidget
-
ViewPager
-
ActionBar
-
Tab t1=bar.newTab();
t1.setText("Tab Text&");
-
Tab t1=bar.newTab();
t1.setTabListener(this);
-
Tab t1=bar.newTab();
t1.setText("Tab Text");
t1.setTabListener(this);
-
Tab t1=bar.newTab();
t1.setText("Tab Text");
t1.setTabListener(this);
bar.addTab(bar.newTab());
D
Correct answer
Explanation
The code to add the tabs and their listeners to the action bar is as follows:
t1.setText("Tab Text");
t1.setTabListener(this);
bar.addTab(bar.newTab());
C
Correct answer
Explanation
The correct sequence to create a tab-style interface is:
1.TabHost
2. LinearLayout
3. TabWidget
-
Android:actionProviderClass=”android.widget.ShareActionProvider”
-
Public void onCreate(Bundle bun1) {
Super.onCreate(bun1);
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
-
Public void onCreate(Bundle bun1) {
Super.onCreate(bun1);
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_TABS);
}
-
Public void onCreate(Bundle bun1) {
Super.onCreate(bun1);
final ActionBar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
D
Correct answer
Explanation
To create a tabbed interface, you have to set the navigation mode for the action bar in the onCreate method of your activity. The code is:
Public void onCreate(Bundle bun1) {
Super.onCreate(bun1);
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}