【HarmonyOS】应用开发者基础认证考试100分

HarmonyOS应用开发者基础认证考试.100分过


HarmonyOS应用开发者基础认证考试, 本博文的初衷是帮助大家查漏补缺, 知道错误的点在什么地方, 但是也不推荐抄答案, 纸上得来终觉浅, 希望能帮助大家考到理想的成绩!

  • 判断题

1.Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件。一个应用可以包含一个或多个Ability。
(正确)

2.Tabs组件仅可包含子组件TabsContent,每一个页签对应一个内容视图即TabContet组件。
(正确)

3.使用http模块发起网络请求时,必须要使用on(‘headersReceive’)订阅请求头,请求才会成功。
(错误)

4.Web组件对于所有的网页都可以使用zoom(factor: number)方法进行缩放。
(错误)

5.首选项preferences是以Key-Value形式存储数据,其中Key是可以重复。
(错误)

6.每一个自定义组件都有自己的生命周期。
(正确)

7.在Column和Row容器组件中,justifyContent用于设置子组件在主轴方向上的对齐格式,alignItems用于设置子组件在交叉轴方向上的对齐格式。
(正确)

8.@CustomDialog装饰器用于装饰自定义弹窗组件,使得弹窗可以动态设置内容及样式。
(正确)

9.所有使用@Component修饰的自定义组件都支持onPageShow,onBackPress和onPageHide生命周期函数。
(错误)

10.Video组件可以支持本地视频路径和网络路径播放。播放网络视频时,需要申请权限ohos.permission.INTERNET。
(正确)

11.每调用一次router.pushUrl()方法,默认情况下,页面栈数量会加1,页面栈支持的最大页面数量为32。
(正确)


  • 单选题

12.使用Image组件加载网络图片需要如下哪种权限?
(B)
A. ohos.permission.READ_MEDIA
B. ohos.permission.INTERNET
C. ohos.permission.GET_NETWORK_INFO
D. ohos.permission.DISTRIBUTED_DATASYNC

13.下面哪个方法,可以跳转到一个新页面,并销毁当前页面。
(B)
A. router.pushUrl()
B. router.replaceUrl()
C. router.back()
D. router.clear()

14.用哪一种装饰器修饰的组件可作为页面入口组件?
(B)
A. @Component
B. @Entry
C. @Preview
D. @Builder

15.下列哪种组合方式不能实现子组件从父子组件之间双向数据同步。
(D)
A. @State和@Link
B. @Provide和@Consume
C. @Observed和@ObjectLink
D. @State和@Prop

16.关于容器组件Row和Column,下面说法错误的是:
(D)
A. Column容器的主轴是垂直方向,交叉轴是水平方向;Row容器的主轴是水平方向,交叉轴是垂直方向。
B. 主轴和交叉轴始终是相互垂直的,Row和Column主轴的方向不一样。
C. Column的子组件在主轴方向上的对齐使用justifyContent属性来设置,其参数类型是FlexAlign。
D. Row的子组件在交叉轴方向上的对齐方式使用alignItems属性来设置,其参数类型为HorizontalAlign。

17.首选项preferences值的存储支持哪些数据类型?
(D)
A. 数字型
B. 字符型
C. 布尔型
D. 数字型、字符型、布尔型以及这3种类型的数组类型

18.下面哪个组件不能包含子组件:
(D)
A. Row
B. Button
C. Text
D. LoadingProgress

19.关于@State状态数据特征,下列描述错误的是:
(C
A. @State装饰的变量是组件内部的状态数据,当这些状态数据被修改时,将会调用所在组件的build方法进行UI刷新。
B. 标记为@State的属性是私有变量,只能在组件内访问。
C. @State变量可以不用给定初始值。
D. 子组件@Link装饰的变量可以和父组件的@State变量建立双向数据绑定。

20.关于Resource是资源引用类型描述错误的是:
(C
A. Resource是资源引用类型,用于设置组件属性的值。
B. 通过"$r(‘app.type.name’)"的形式引用应用资源,app代表是应用内resources目录中定义的资源,type代表资源类型(或资源的存放位置)。
C. Resource支持所有的数据类型。
D. 系统可以根据当前配置加载合适的Resource资源,例如,开发者可以根据屏幕尺寸呈现不同的布局效果,或根据语言设置提供不同的字符串。

21. Which of the following modules needs to be imported for page routing?
(B)
A. import prompt from '@ohos.prompt'
B. import router from '@ohos. router'
C. import Notification from '@ohos.notification'
D. import window from '@ohos.window'

22. There are two Text components in the Row component. If you use the justifyContent alignment method, which of the following attributes can achieve alignment between the left and right ends:
(D)
A. FlexAlign.Start
B. FlexAlign.SpaceEvenly
C. FlexAlign.End
D. FlexAlign.SpaceBetween

23. Regarding Web components, the following description is wrong:
(D)
A. WebController controller can control various behaviors of Web components , such as forward, backward, runJavaScript, etc.
B. Web components support the setting of multiple attributes such as fileAccess and javaScriptAccess. For example, .javaScriptAccess(true) means that JavaScript scripts are allowed to be executed.
C. Web components support onConfirm, onConsole and other events. For example, the onConfirm callback is triggered when a confirm() alarm is called on the web page.
D. Using web components to access online and offline web pages requires adding the ohos.permission.INTERNET permission.

24. Which of the following event methods can obtain the offset of List sliding
(A)
A. onScroll< a i=3> B. onScrollIndex C. onReachStart D. onReachEnd


25. Regarding the startup mode of UIAbility, which of the following statements is wrong:
(C
A. UIAbility supports single instance, standard mode and designated There are 3 startup modes for instances, configured through launchType in module.json.
B. singleton is a single instance mode. There is only one instance in the system. When startAbility, if it already exists, it will be reused. The only instance in the system.
C. standard is the standard mode. A new instance will be started every time startAbility is started. The system defaults to the standard mode.
D. specified refers to the specified instance mode, and Ability's internal business determines whether to create multiple instances at runtime.

26. Maximum length limit size () character for the key selection?
(C
A. 60
B. 70
C. 80
D. 90

27. Which of the following modules needs to be imported to initiate a network data request?
(A)
A. import http from '@ohos.net.http'
B. import http from '@ ohos.net.https'
C. import request from '@ohos.request'
D. import request from '@ohos.net.request'

28. Regarding the callback event of the Video component, which of the following statements is wrong:
(A)
A. This event is triggered when the onStart video is played. , where you can get the video duration.
B. onFinish This event is triggered when the video playback ends.
C. onPrepared This event is triggered when the video preparation is completed.
D. onUpdate This event is triggered when the playback progress changes. The unit is s and the update interval is 250ms.

29. Regarding the position setting of the Tabs component, the following description is wrong
(D)
A. When barPosition is Start (default value), when the vertical attribute is false (default value), the tab is located at the top of the container.
B. When barPosition is Start (default value) and the vertical attribute is true, the tab is located on the left side of the container
C. When barPosition is End, the vertical attribute is When false (default value), the tab is located at the bottom of the container.
D. When the barPosition is End and the vertical attribute is true, the tab is located at the bottom of the container.

30. For example, if you want to implement an advertising pop-up window that contains information such as pictures and text, you can use the following pop-up window to achieve it
(B)
A. AlertDialog
B. @CustomDialog
C. TextPickerDialog
D. TimePickerDialog

31. Regarding the Button component, which of the following styles is a capsule button:
(A)
A. ButtonType.Capsule< a i=3> B. ButtonType.Normal C. ButtonType.Circle D. None of the above


32. In which of the following files can the path configuration information of the page be set?
(A)
A. main_pages.json
B. module.json5
C . app.json5
D. package.json


  • Multiple choice questions

33. Which of the following container components can be scrolled by D
(A,B,D)
A. Scroll
B. List
C. Row
D. Grid
E. Column

34. For components containing text elements, such as Text, Button, TextInput, etc., which of the following attributes can be used:
(A,B,C,D,E)
a> A. fontColor
B. fontSize
C. fontStyle
D. fontWeight
E. fontFamily

35. The following description of the basic components of the ArkTS declarative development paradigm is correct:
(A,B,C,D,E,F)
A. Decorator: Used to decorate classes, structures, methods and variables to give them special meanings. For example, @Entry indicates that this is an entry component.
B. Custom components: reusable UI units that can be combined with other components.
C. UI description: Declarative method to describe the structure of the UI, such as the code block in the build() method.
D. Built-in components: Basic components and layout components built in by default in ArkTS, which developers can call directly, such as Column, Text, Divider, Button, etc.
E. Attribute method: used to configure component attributes, which are set uniformly through attribute methods, such as fontSize(), width(), height(), color(), etc.
F. Event method: used to add the component's response logic to events, and set it uniformly through event methods, such as onClick() following Button.

36.Which of the following component hierarchies are correct?
(A,B,E)
A. Text>Span
B. Button>Column>Image
C. Button>Image>Text
D. Image>Text>Span
E. Column>Row>Button

Module.json5 under 37.entry contains the following information:
(B,C,D)
A. Application package name and version Number information
B. Ability configuration information
C. Device type information
D. Application permission application list

38. Regarding the Tabs component and the TabContent component, the following description is correct
(A,B,C,D)
A. TabContent component Setting the universal width property is not supported, and its width is equal to the barWidth property of the Tabs component.
B. The TabContent component does not support setting the universal height attribute. Its height is determined by the height of the parent component Tabs and the height of the TabBar component.
C. TabsController is used to control Tabs components for tab switching. It does not support one TabsController controlling multiple Tabs components.
D. The tabBar property of the TabContent component supports components generated using the @Builder constructor.

39.Is the life cycle cycle function of Ability trivial?
(A,B,E,F)
A. onCreate
B. onDestroy
C. onPageShow
D. onPageHide
E. onForeground
F. onBackground

40. The correct description of the ForEach(arr, itemGenerator, index) component is:
(B,C,D)
A. In ForEach, you can loop through the logic code, such as console.info('hello')
B. The first parameter must be an array to provide the data source for loop rendering.
C. The second parameter is a lambda function that generates subcomponents for each array item in the data source.
D. The third parameter is an anonymous function used to generate a unique and stable key value for a given array item.

  • Next

【HarmonyOS】HarmonyOS Application Developer Advanced Certification 96 points

おすすめ

転載: blog.csdn.net/weixin_42473228/article/details/134431887