Câu hỏi: MMA301 Phát triển ứng dụng di động đa nền tảng – Bộ ôn tập thi lại số 2
50 câu trắc nghiệm kèm lời giải của môn Multiplatform Mobile App Development - Phát triển ứng dụng di động đa nền tảng, xếp đúng thứ tự trong đề. Trang 2/3 — câu 21–40.
Danh sách câu hỏi
initialValuevaluecheckedinitialCheckedSwiftJavaJavaScriptKotlinimport React, { useEffect } from 'react';
import { Text } from 'react-native';
import { useIsFocused } from '@react-navigation/native';
function HomeScreen() {
const isFocused = useIsFocused();
useEffect(() => {
if (isFocused) {
console.log('HomeScreen is focused');
} else {
console.log('HomeScreen is not focused');
}
}, [isFocused]);
return <Text>Home Screen</Text>;
}What will be logged if the component is initially focused and then loses focus?
FileStreamMemoryStreamStreamReaderXmlReaderRCT_CREATE_METHODRCT_DEFINE_METHODRCT_EXPORT_METHODRCT_NATIVE_METHODImageTextScrollViewViewLinkedList<T> class?IList<T>ISet<T>IDictionary<TKey, TValue>IEnumerable<T>Đáp án đúng: "IEnumerable<T>". Trong .NET, LinkedList<T> thuộc System.Collections.Generic là danh sách liên kết đôi, mỗi nút LinkedListNode<T> trỏ tới nút trước và nút sau; lớp này cài đặt ICollection<T>, IReadOnlyCollection<T> và IEnumerable<T>, nhờ IEnumerable<T> mà ta duyệt được nó bằng foreach và dùng được LINQ. "IList<T>" sai vì giao diện này đòi truy cập theo chỉ số như list[i], Insert và RemoveAt tại vị trí; danh sách liên kết muốn tới phần tử thứ i phải đi lần từ đầu, nên .NET cố ý không cho LinkedList<T> cài IList<T>, thay vào đó là AddFirst, AddLast, AddBefore, AddAfter. "ISet<T>"là giao diện của tập hợp không cho phần tử trùng, như HashSet<T> hay SortedSet<T>, trong khi danh sách liên kết chứa trùng thoải mái. "IDictionary<TKey, TValue>" dành cho cấu trúc ánh xạ khoá sang giá trị như Dictionary<TKey, TValue>, không phải một dãy phần tử có thứ tự như
LinkedList<T>.Đáp án đúng gồm hai ý: "View is a basic container component, playing a similar role to the <div> tag in HTML, used to contain other components." và "View is mainly used to create layouts and apply style properties to the child components it contains.". View là component nền tảng, ánh xạ sang UIView trên iOS và android.view.View trên Android; nó chứa được bao nhiêu con tuỳ ý, là flex container để bố cục, nhận style như padding, backgroundColor, borderRadius, và chính các style căn chỉnh của View quyết định vị trí các con bên trong. "View is a leaf component and cannot contain any child components inside." sai vì View chính là khung chứa, hầu hết màn hình React Native là cây các View lồng nhau. "View is only used to display plain text and does not support layout or applying styles." sai vì View không hiển thị chữ trực tiếp, chữ phải nằm trong Text, còn bố cục và style lại là công dụng chính của View.
useEffectuseStateuseContextuseReducerstyleprovidermapTyperegionmapLocation