鸿蒙OS试题

依次点击A、B、C、D四个按钮,其中不会触发UI刷新的是:

@Entry

@Component

struct Index {

@State count: number = 0;

@State @Watch('onValueChange') value: number = 50;

onValueChange() {

this.count = this.value;

}

build() {

Column() {

Text(`${this.count}`)

Button("A")

.onClick(() => {

this.count = 0;

})

Button("B")

.onClick(() => {

for (let i = 0; i < 1000; i++) {

this.count = i;

}

for (let i = 1000; i > 0; i--) {

this.count = i;

}

this.count--;

})

Button("C")

.onClick(() => {

this.value = 100;

})

Button("D")

.onClick(() => {

setInterval(()=>{

this.count++;

}, 1000)

})

}

}

}

A.B

B.D

C.A

D.C

在开发过程中,我们可以将每个功能模块作为一个独立的Module进行开发。关于Module,下列选项说法正确的是?

A.Shared类型的Module:动态共享库。HSP中的代码和资源可以独立编译,运行时在一个进程中代码也只会存在一份。

B.HAR类型的Module:静态共享库。HAR中的代码和资源跟随使用方编译,如果有多个使用方,它们的编译产物中会存在多份相同拷贝。

C.feature类型的Module:应用的动态特性模块,编译后生成feature类型的HAP。一个应用中可以包含一个或多个feature类型的HAP,也可以不包含。

D.entry类型的Module:应用的主模块,包含应用的入口界面、入口图标和主功能特性,编译后生成entry类型的HAP。每一个应用分发到同一类型的设备上的应用程序包,可以包含一个或多个entry类型的HAP。

处于安全因素考虑,ArkTS不支持以下哪些语法。

A.

with()

B.

eval()

C.

new Function('a', 'b', 'return a + b')

D.

Object.entries()

下面关于混淆的描述正确的是

A.在工程build-profile.json5中的obfuscation.ruleOptions.files字段中配置该工程的混淆配置,该配置仅在编译该工程时生效。

B.支持顶层作用域名称、属性名称、文件名称等多种混淆功能

C.可以在HAR模块工程的build-profile.json5中的obfuscation.consumerFiles字段中配置导出的混淆配置,该配置仅在编译依赖该HAR的模块时生效。

D.修改应用混淆配置,新配置需要重新全量编译应用才能生效

以下哪些方式可以实现ArkWeb同层渲染能力 ()

A.

Web(...).enableNativeEmbedMode(true).registerNativeEmbedRule("object", "test")

<object id="view" type="test/contents" width="100%" height="100%" style="background-color:red"/>

B.

Web(...).enableNativeEmbedMode(true).registerNativeEmbedRule("native", "test")

<object id="view" type="native/contents" width="100%" height="100%" style="background-color:red"/>

C.

Web(...).enableNativeEmbedMode(true)

<object id="view" type="native/contents" width="100%" height="100%" style="background-color:red"/>

D.

Web(...).enableNativeEmbedMode(true)

<embed id="view" type="native/contents" width="100%" height="100%" style="background-color:red"/>

下面代码符合ArkTS编程规范的是

A.

for (let idx = 0; idx <5;++idx) console.log(idx);

B.

if(condition) {

console.log('success');}

c.

let maxcount =1Qy

let iscompleted =false;

let pointx = 0;

let pointy = 0;

D.

let maxcount = 10,iscompleted =false;

let pointx,pointy;

pointx = 10; pointY =0;

在使用DevEco Studio的Profiler进行Harmony0S应用或服务内存管理优化时,以下哪个描述最准确地概述了“Allocation Insight"功能在识别和解决内存问题中的作用

A.Allocation Insight通过分析应用服务运行时的内存分配及使用情况,辅助定位内存泄漏、内存抖动和溢出问题,支持优化内存使用

B.Allocation Insight主要关注于内存碎片整理,减少内存分配的不连续性问题,对内存泄漏和溢出问题的检测不是其主要功能

C.Allocation Insight详细展示应用运行时的每条语句柄分配记录,便于开发者逐一检查内存使用,但不提供内存泄漏的自动识别功能

D.Allocation Insight仅提供内存分配总量的概览,帮助开发者宏观了解内存使用趋势,但对于具体泄漏或抖动问题无能为力

关于自动化测试描述正确的是:

A.Fuzz测试就是通过构造不规则的输入,从而触发程序的某种bug;Fuzz测试属于白盒测试。Fuzz测试

也叫做模糊测试,通过输入非法字段,并观察软件是否异常来实现。一方面可以通过向软件输入非法字段,另一方面也可以通过向网络服务发送异常报文。

B.自动化测试因提高效率,减少重复工作的特性而被广泛采用;自动化测可以替代手动测试在处理复

杂、难以预测的用户交互或特殊边界条件。

C.XTS子系统是认证测试套件的集合,当前包括acts(application compatibility test suite)应用兼容

性测试套件,后续会拓展dcts(device compatibility test suite)设备兼容性测试套件等。

D. DT(开发者测试)就是UT,可看护的范围包括边界值问题、空指针或赋值错误,内部业务逻辑问题等

等。

下面关于方舟字节码文件格式描述正确的是

A.方舟字节码文件中不包含字节码文件内容的adler32校验和

B.方舟字节码文件中数据类型uint16_t表示16-bit无符号整数,采用小端字节序

C.方舟字节码文件中数据类型uint32_t表示32-bit无符号整数,采用大端字节序

D.方舟字节码文件是ArKTS/TS/JS编译后的二进制产物

在基于Stage模型开发的应用项目代码下,每个模块都存在一个module.json5配置文件,用于配置模块的基本信息,以下module.json5配置文件正确的是

A.

{

"module": {

"name": "aName",

"type": "har",

"deviceTypes": [

"default", "tablet" ]

}

}

B.

{

"module": {

"name": "cName",

"type": "hsp",

"description": "$string:desc",

"deviceTypes": [

"default",

"tablet"

],

"deliveryWithInstall": true,

"pages": "$profile:main_pages"

}

}

C.

{

"module": {

"name": "bName",

"type": "shared",

"deviceTypes": [

"default",

"tablet"

],

"deliveryWithInstall": true,

"pages": "$profile:main_pages"

}

}

D.

{

"module": {

"name": "application",

"type": "feature",

"description": "$string:module_desc",

"mainElement": "ApplicationAbility",

"deviceTypes": [

"default",

"tablet"

],

"deliveryWithInstall": true,

"installationFree": false,

"pages": "$profile:main_pages",

"abilities": [

{

"name": "ApplicationAbility",

"srcEntry": "./ets/applicationability/ApplicationAbility.ets",

"description": "$string:ApplicationAbility_desc",

"icon": "$media:icon",

"label": "$string:ApplicationAbility_label",

"startWindowIcon": "$media:startIcon",

"startWindowBackground": "$color:start_window_background",

"exported": true

}

]

}

}

以下napi代码有问题的是

A.

struct CallbackContext {

napi_env env = nullptr;

napi_ref callbackRef = nullptr;

int32_t retData = 0;

};

void callbackTest(CallbackContext *context)

{

uv_loop_s *loop = nullptr;

napi_get_uv_event_loop(context->env, &loop);

uv_work_t *work = new uv_work_t;

context->retData = 1;

work->data = (void *)context;

uv_queue_work(

loop, work, [](uv_work_t *work) {},

// using callback function back to JS thread

[](uv_work_t *work, int status)

{

CallbackContext *context = (CallbackContext *)work->data;

napi_value callback = nullptr;

napi_get_reference_value(context->env, context->callbackRef, &callback);

napi_value retArg;

napi_create_int32(context->env, context->retData, &retArg);

napi_value ret;

napi_call_function(context->env, nullptr, callback, 1, &retArg, &ret);

napi_delete_reference(context->env, context->callbackRef);

if (work != nullptr) {

delete work;

}

delete context;

}

);

}

B.

napi_ref g_ref = nullptr;

/***** excute in main thread *****/

static napi_value DemoInMainThread(napi_env env, napi_callback_info info)

{

napi_value string = nullptr;

napi_create_string_utf8(env, "bar", NAPI_AUTO_LENGTH, &string);

napi_create_reference(env, string, 1, &g_ref);

return string;

}

/***** excute in worker thread *****/

static napi_value DemoInWorkerThread(napi_env env, napi_callback_info info)

{

napi_value string = nullptr;

napi_get_reference_value(env, g_ref, &string);

napi_value object = nullptr;

napi_create_object(env, &object);

napi_set_named_property(env, object, "foo", string);

return object;

}

C.

static napi_value Demo(napi_env env, napi_callback_info info)

{

constexpr size_t arrSize = 1000;

napi_value arrBuffer = nullptr;

void *data = nullptr;

napi_create_arraybuffer(env, arrSize * sizeof(int32_t), &data, &arrBuffer);

int32_t *i32Buffer = reinterpret_cast<int32_t *>(data);

for (int i = 0; i < arrSize; i++) {

i32Buffer[i] = i;

}

return arrBuffer;

}

D.

static napi_value Demo(napi_env env, napi_callback_info info)

{

size_t argc = 1;

napi_value args[1] = {nullptr};

napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);

napi_value sizeObj = nullptr;

napi_handle_scope scope = nullptr;

napi_open_handle_scope(env, &scope);

napi_call_function(env, nullptr, args[0], 0, nullptr, &sizeObj);

napi_close_handle_scope(env, scope);

int64_t width = 0;

napi_value result = nullptr;

napi_get_element(env, sizeObj, 0, &result);

napi_get_value_int64(env, result, &width);

return result;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

星宇工作室

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

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

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

打赏作者

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

抵扣说明:

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

余额充值