Computer Knowledge
GUI and Web Frameworks
1,915 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
What is the role of the ngAfterViewInit lifecycle hook in Angular?
-
It is called after the component's view and child views have been initialized
-
It is called after the component's content has been projected
-
It is called after the component's inputs have been bound
-
It is called after the component's change detection has run
A
Correct answer
Explanation
The ngAfterViewInit lifecycle hook in Angular is called after the component's view and child views have been initialized. This makes it a suitable place to perform operations that require access to the component's rendered DOM elements.
Which of the following is used for change detection in Angular?
-
The ngDoCheck lifecycle hook
-
The ngOnChanges lifecycle hook
-
The ngOnInit lifecycle hook
-
The ngAfterViewInit lifecycle hook
A
Correct answer
Explanation
The ngDoCheck lifecycle hook in Angular is used for change detection. It is called during every change detection cycle, allowing components to detect and respond to changes in their input properties or state.
What is the purpose of the @Input decorator in Angular?
-
To mark a property as an input property
-
To mark a property as an output property
-
To mark a property as a state property
-
To mark a property as a service property
A
Correct answer
Explanation
The @Input decorator in Angular is used to mark a property as an input property. This allows the property to be bound to a value from the parent component or directive.
Which of the following is used for event handling in Angular?
-
Event listeners
-
Event bindings
-
Event decorators
-
Event directives
B
Correct answer
Explanation
Event bindings in Angular are used to handle user input and events. They allow components to respond to events such as clicks, keypresses, and mouse movements.
Which of the following is used to navigate between routes in React Routing?
-
<Link> component
-
<Router> component
-
<Route> component
-
<Switch> component
A
Correct answer
Explanation
The `` component is used to navigate between routes in React Routing. It provides a way to link to other routes within the application, allowing users to navigate between different views or components.
What is the purpose of the withRouter() higher-order component in React Router?
-
It allows you to access the routing context in a component
-
It allows you to navigate between routes
-
It allows you to manage the state of the current route
-
It allows you to optimize the performance of the current route
A
Correct answer
Explanation
The withRouter() higher-order component in React Router allows you to access the routing context in a component. This is useful when you need to access information about the current route, such as the pathname, search parameters, and hash, in a component that is not a direct descendant of the `` component.
What property is used to define the direction of flex items in a flex container?
-
flex-direction
-
flex-wrap
-
justify-content
-
align-items
A
Correct answer
Explanation
The flex-direction property determines the direction in which flex items are laid out within the flex container. It can be set to row, column, row-reverse, or column-reverse.
What property is used to control the wrapping behavior of flex items when they reach the end of a flex container?
-
flex-direction
-
flex-wrap
-
justify-content
-
align-items
B
Correct answer
Explanation
The flex-wrap property controls whether flex items should wrap to the next line or remain on the same line when they reach the end of the flex container. It can be set to nowrap, wrap, or wrap-reverse.
What property is used to distribute space between flex items along the main axis of the flex container?
-
flex-direction
-
flex-wrap
-
justify-content
-
align-items
C
Correct answer
Explanation
The justify-content property distributes space between flex items along the main axis of the flex container. It can be set to flex-start, flex-end, center, space-between, or space-around.
What property is used to distribute space between flex items along the cross axis of the flex container?
-
flex-direction
-
flex-wrap
-
justify-content
-
align-items
D
Correct answer
Explanation
The align-items property distributes space between flex items along the cross axis of the flex container. It can be set to flex-start, flex-end, center, baseline, or stretch.
What property is used to specify the initial size of flex items in a flex container?
-
flex-grow
-
flex-shrink
-
flex-basis
-
flex
C
Correct answer
Explanation
The flex-basis property specifies the initial size of flex items in a flex container. It can be set to a specific length value, a percentage, or auto.
What property is used to control how flex items grow when there is extra space in the flex container?
-
flex-grow
-
flex-shrink
-
flex-basis
-
flex
A
Correct answer
Explanation
The flex-grow property controls how flex items grow when there is extra space in the flex container. It can be set to a number, a percentage, or 0.
What property is used to control how flex items shrink when there is not enough space in the flex container?
-
flex-grow
-
flex-shrink
-
flex-basis
-
flex
B
Correct answer
Explanation
The flex-shrink property controls how flex items shrink when there is not enough space in the flex container. It can be set to a number, a percentage, or 0.
What property is used to specify a shorthand for the flex-grow, flex-shrink, and flex-basis properties?
-
flex-grow
-
flex-shrink
-
flex-basis
-
flex
D
Correct answer
Explanation
The flex property is a shorthand for the flex-grow, flex-shrink, and flex-basis properties. It can be set to a single value or a combination of values.
What is the default value of the flex-wrap property?
A
Correct answer
Explanation
The default value of the flex-wrap property is nowrap, which means that flex items will not wrap to the next line when they reach the end of the flex container.