鸿蒙OS试题

关于静态检查描述错误的是:

A.静态检查 可以检测代码中的语法错误和潜在的逻辑错误,也支持检测代码在运行时现的错误,因此静态检查可以替代动态测试。

B.静态检查 是指使用静态代码分析工具对软件的“静态"(不运行的)代码进行分析的一种方法,找出代码中潜在的漏洞。静态代码分析器检查源代码,找出特定的漏洞,并检查代码是否符合各种编码标准。

C.静态分析工 具也在不断改进和升级。使用高级的静态分析工具可以提高代码检测的准确性和效率。例如,一些静态分析工具可以检测代码中的内存泄漏、死锁问题,从而提高代码的质量和可靠性。

D. HarmonyOS应用可以采用ARKTS静态检查工具

一个复杂的项目,该项目不仅包含主入口模块(Entry Module), 还有多个特性的功能模块

(Feature Modules/HSP), 并且这些模块间存在着相互调用关系。为了确保在调试过程中能够完整地测试所有交互逻辑,需要将涉及到的所有模块的HAP包都部署到目标设备上。请从以下选项中选择正确的操作步骤来配置DevEco Studio, 以便一次性部署和调试项目中的多个模块

A.无需特殊配置, DevEco Studio会自动检测到项目中的所有模块依赖,并在每次调试运行时自动部署所有相关HAP包。

B.直接 点击运行按钮,DevEco Studio会弹出对话框询问需要部署哪些模块,从中选择需要的模块后开始调试。

C. 进入“Run> Edit Configurations'菜单,

在“Deploy Multi Hap"选项卡下,勾选“DeployMulti Hap Packages",随后在列表中选择需要部署的模块。

D.在项目结构界面手动个选择每个模块,单独编译并逐一将生成的HAP包通过HDC命令推送到设备上

以下关于应用架构技术选型说法不正确的是()

A. 对于初始版本的应用,功能比较简单,可以考虑采用单HAP加上多个HAR工程构建代码工程。

B.随着业务的发展,应用功能会越来越多,某些功能可以做成动态加载,动态加载的模块采用HAR工程来构建,方便复用和共享。

C.一些应用的扩展能力,比如备份、服务卡片,可以采用ExtensionAbility做成单独的feature HAP包独立分发。

D.元服务和应用可以共用一个代码工程,采用多目标产物构建方式,构建出应用和元服务两个产物,用于上架。

应用发生崩溃,()接口可以获取到崩溃时调用栈

A. hiLog

B. hiTraceMeter

C.hiDebug

D. hiAppEvent

现有一个宽高分别为200px的XComponent组件,其绑定了一个

XComponentController(xcController),依次进行如下操作:

(1)xcController.setXComponentSurfaceRect( {surfaceWidth: 150,surfaceHeight:500})

(2)设置XComponent组件的padding为{ top:5px,left:10px,bottom:15px,right:20px}

(3)将XComponent组件大小改为300pxx300px

(4)给XComponent组件设置一个宽度为2px的边框

(5)xcController.setXComponentSurfaceRect({

offsetX: -20,offsetY:50,surfaceWidth:200,surfaceHeight:-100})之后,调用xcController.getXComponentSurfaceRect()的返回值为

A. { offsetX: 81, offsetY: -89, surfaceWidth: 150, surfaceHeight: 500 }

B. f offsetX: 75, offsetY: -100, surfaceWidth: 150, surfaceHeight: 500 }

c.{ offsetX: 81, offsetY: -89, surfaceWidth: 200, surfaceHeight: 0 }

D. { offsetX: -20, offsetY: 50, surfaceWidth: 200, surfaceHeight: 500 }

在moduleA(HAP类型)中有一个图片名为image.png,在moduleB(HAR类型)也存在一个图片名为image.png,而moduleA依赖于moduleB,那么在moduleA的编译产物hap包中,image.png存在情况是:

A.仅存在moduleA的image.png

B.仅存在moduleB的image.png

C.两者都存在

D.两者都不存在

如下哪些方式可实现图片动态播放?

A.

@Entry

@Component

struct ImageAnimatorExample {

@State iterations: number = 1

build() {

Column({ space: 10 }) {

ImageAnimator()

.images([

{

src: $r('app.media.img1')

},

{

src: $r('app.media.img2')

},

{

src: $r('app.media.img3')

},

{

src: $r('app.media.img4')

}

])

.duration(2000)

.fillMode(FillMode.None).iterations(this.iterations).width(340).height(240)

.margin({ top: 100 })

}.width('100%').height('100%')

}

}

B.

import {AnimationOptions, AnimatedDrawableDescriptor} from '@ohos.arkui.drawableDescriptor'

import image from '@ohos.multimedia.image'

@Entry

@Component

struct ImageExample {

pixelmaps: Array<PixelMap> = [];

options: AnimationOptions = {duration:2000, iterations:1};

@State animated: AnimatedDrawableDescriptor | undefined = undefined;

async aboutToAppear() {

this.pixelmaps = await this.getPixelMaps();

this.animated = new AnimatedDrawableDescriptor(this.pixelmaps, this.options);

}

build() {

Column() {

Row() {

Image(this.animated)

.width('500px').height('280px')

}.height('50%')

Row() {

Button('once').width(100).padding(5).onClick(() => {

this.options = {duration:2000, iterations:1};

this.animated = new AnimatedDrawableDescriptor(this.pixelmaps, this.options);

}).margin(5)

}

}.width('50%')

}

private async getPixmapFromMedia(resource: Resource) {

let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({

bundleName: resource.bundleName,

moduleName: resource.moduleName,

id: resource.id

})

let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength))

let createPixelMap: image.PixelMap = await imageSource.createPixelMap({

desiredPixelFormat: image.PixelMapFormat.RGBA_8888

})

await imageSource.release()

return createPixelMap

}

private async getPixelMaps() {

Mypixelmaps.push(await this.getPixmapFromMedia($r('app.media.icon'))) //对应资源图片名后缀为png

return Mypixelmaps;

}

}

C.

import {AnimationOptions, AnimatedDrawableDescriptor} from '@ohos.arkui.drawableDescriptor'

import image from '@ohos.multimedia.image'

@Entry

@Component

struct ImageExample {

pixelmaps: Array<PixelMap> = [];

options: AnimationOptions = {duration:2000, iterations:1};

@State animated: AnimatedDrawableDescriptor | undefined = undefined;

async aboutToAppear() {

this.pixelmaps = await this.getPixelMaps();

this.animated = new AnimatedDrawableDescriptor(this.pixelmaps, this.options);

}

build() {

Column() {

Row() {

Image(this.animated)

.width('500px').height('280px')

}.height('50%')

Row() {

Button('once').width(100).padding(5).onClick(() => {

this.options = {duration:2000, iterations:1};

this.animated = new AnimatedDrawableDescriptor(this.pixelmaps, this.options);

}).margin(5)

}

}.width('50%')

}

private async getPixmapListFromMedia(resource: Resource) {

let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({

bundleName: resource.bundleName,

moduleName: resource.moduleName,

id: resource.id

})

let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength))

let createPixelMap: Array<image.PixelMap> = await imageSource.createPixelMapList({

desiredPixelFormat: image.PixelMapFormat.RGBA_8888

})

await imageSource.release()

return createPixelMap

}

private async getPixelMaps() {

let Mypixelmaps:Array<PixelMap> = await this.getPixmapListFromMedia($r('app.media.icon'))//对应资源图片名后缀为gif

return Mypixelmaps;

}

}

D.

@Entry

@Component

struct ImageExample {

build() {

Column({ space: 10 }) {

Image($r('app.media.earth')) //对应资源图片名后缀为gif

.width(100)

.height(100)

}

}

}

当前动态import支持导入的模块类型有哪些?

A.动态import支持加载OHPM模块

B.动态import支持加载本地HAR模块

C.动态import支持加载远程HAR模块

D.动态import支持加载HSP模块

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

星宇工作室

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

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

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

打赏作者

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

抵扣说明:

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

余额充值