在开发过程中,我们可以将每个功能模块作为一个独立的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;
}
以下关于ArkTS线程实例间传输实现方式描述正确的是
import { taskpool, worker } from '@kit.ArkTS';
@Sendable
class A {}
let a: A = new A();
@Concurrent
function foo(a: A) {}
let task: taskpool.Task = new taskpool.Task(foo, a)
let w = new worker.ThreadWorker("entry/ets/workers/Worker.ets")
taskpool.execute(task).then(() => {});
w.postMessageWithSharedSendable(a);
task.setCloneList([a]);
taskpool.execute(task).then(() => {});
w.postMessage(a);
A.
taskpool.execute(task).then(() => {});,TaskPool 共享传输实现方式
B.
task.setCloneList([a]);
taskpool.execute(task).then(() => {});,TaskPool 共享传输实现方式
C.
w.postMessage(a);,Worker 共享传输实现方式
D.w.postMessageWithSharedSendable(a);,Worker 共享传输实现方式
Image组件以下哪些方式可显示图片?
A.
@Entry
@Component
struct ImageExample {
build() {
Column({ space: 10 }) {
Image($r('app.media.earth'))
.width(100)
.height(100)
}
}
}
B.
@Entry
@Component
struct ImageExample {
build() {
Column({ space: 10 }) {
Image("https://www.example.com/xxx.png")
.width(100)
.height(100)
}
}
}
C.
import image from '@ohos.multimedia.image'
@Entry
@Component
struct ImageExample {
@State imagePixelMap: image.PixelMap | undefined = undefined
async aboutToAppear() {
this.imagePixelMap = await this.getPixmapFromMedia($r('app.media.app_icon'))
}
build() {
Column() {
Image(this.imagePixelMap)
.width(200)
.height(200)
}
}
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
}
}
D.
import { DrawableDescriptor } from '@ohos.arkui.drawableDescriptor'
@Entry
@Component
struct ImageExample {
private resManager = getContext().resourceManager
build() {
Row() {
Column() {
Image((this.resManager.getDrawableDescriptor($r('app.media.drawable').id) as DrawableDescriptor))
}.height('50%')
}.width('50%')
}
}
在基于Stage模型开发的应用项目代码下,都存在一个app.json5配置文件,用于配置应用的全局信息,以下app.json5配置文件错误的是
A.
{
"app": {
"bundleName": "com.example.myapplication",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.2",
"icon": "$media:app_icon",
"label": "app_name",
"bundleType": "app"
}
}
B.
{
"app": {
"bundleName": "com.example.myapplication",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.2",
"icon": "$media:app_icon",
"label": "$string:app_name",
"bundleType": "app"
}
}
C.
{
"app": {
"bundleName": "com.example.myapplication",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.2",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
D.
{
"app": {
"bundleName": "com.example.myapplication",
"vendor": "example", "versionCode": 1000000,
"icon": "$media:app_icon",
"label": "$string:app_name",
"bundleType": "app"
}
}
某个应用的启动框架配置文件详细信息如下,以下说法正确的是:
{
"startupTasks": [
{
"name": "StartupTask_001",
"srcEntry": "./ets/startup/StartupTask_001.ets",
"dependencies": [
"StartupTask_002",
"StartupTask_003"
],
"runOnThread": "taskpool",
"waitOnMainThread": false
},
{
"name": "StartupTask_002",
"srcEntry": "./ets/startup/StartupTask_002.ets",
"dependencies": [
"StartupTask_004"
],
"runOnThread": "taskpool",
"waitOnMainThread": false
},
{
"name": "StartupTask_003",
"srcEntry": "./ets/startup/StartupTask_003.ets",
"runOnThread": "taskpool",
"waitOnMainThread": false
},
{
"name": "StartupTask_004",
"srcEntry": "./ets/startup/StartupTask_004.ets",
"runOnThread": "taskpool",
"waitOnMainThread": false
},
{
"name": "StartupTask_005",
"srcEntry": "./ets/startup/StartupTask_005.ets",
"runOnThread": "mainThread",
"waitOnMainThread": true
},
{
"name": "StartupTask_006",
"srcEntry": "./ets/startup/StartupTask_006.ets",
"runOnThread": "mainThread",
"waitOnMainThread": false,
"excludeFromAutoStart": true
}
],
"configEntry": "./ets/startup/StartupConfig.ets"
}
A.
StartupTask_006会在AbilityStage的onCreate前初始化完成
B.
StartupTask_005会在主线程执行
C.
StartupTask_001会在StartupTask_004之后执行;
D.
StartupTask_003会在StartupTask_004之后执行
Grid() {
ForEach(this.numbers, (day: string) => {
ForEach(this.numbers, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
.backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
}, (day: string) => day)
}, (day: string) => day)
}
.columnsTemplate('1fr '.repeat(this.columns))
.columnsGap(10)
.rowsGap(10)
.width('90%')
.scrollBar(BarState.Off)
.backgroundColor(0xFAEEE0)
.height('100%')
.cachedCount(3)
// 切换列数item位置重排动画
.animation({
duration: 300,
curve: Curve.Smooth
})
.xxxx?(
PinchGesture()
.onActionEnd((event: GestureEvent) => {
console.info('end scale:' + event.scale)
// 手指分开,减少列数以放大Item,触发阈值可以自定义,示例为2
if (event.scale > 2) {
this.columns--
} else if (event.scale < 0.6) {
this.columns++
}
// 可以根据设备屏幕宽度设定最大和最小列数,此处以最小1列最大4列为例
this.columns = Math.min(4, Math.max(1, this.columns));
AppStorage.setOrCreate('columnsCount', this.columns)
})
)
如果想让grid上的捏合手势手势生效,而不跟grid上的滚动手势形成冲突,.xxxx?手势接口应该怎么配置?
A.
parallelGesture
B.
gesture
C.
priorityGesture
D.
GesureGroup
通过如下openLink的接口启动,如下哪些配置的UIAbility不可能被拉起
import { hilog } from '@kit.PerformanceAnalysisKit';
import { UIAbility, common, OpenLinkOptions } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
export default class MyAbility extends UIAbility {
onForeground() {
let link: string = "https://www.example.com"
let openLinkOptions: OpenLinkOptions = {
appLinkingOnly: true,
parameters: {demo_key: "demo_value"}
};
try {
this.context.openLink(
link,
openLinkOptions,
(err, result) => {
hilog.error(DOMAIN, TAG, 'openLink callback error.code:' + JSON.stringify(err));
}
).then(()=>{
hilog.info(DOMAIN, TAG, 'open link success.');
}).catch((err: BusinessError)=>{
hilog.error(DOMAIN, TAG, 'open link failed, errCode ' + JSON.stringify(err.code));
})
}
catch (e) {
hilog.error(DOMAIN, TAG, 'exception occured, errCode ' + JSON.stringify(e.code));
}
}
}
A.
{
"name": "TargetAbility",
"skills": [
{
"actions":[
"ohos.want.action.viewData",
],
"entities":[
"entity.system.browsable",
],
"uris":[
{
"scheme": "https",
"host": "www.test.com",
"port": "8080",
"path": "path",
"autoVerify": ture
}
]
}
]
}
B.
{
"name": "TargetAbility",
"skills": [
{
"actions":[
"ohos.want.action.sendData",
],
"entities":[
"entity.system.browsable",
],
"uris":[
{
"scheme": "https",
"host": "www.test.com",
"port": "8080",
"path": "path",
"autoVerify": ture
}
]
}
]
}
C.
{
"name": "TargetAbility",
"skills": [
{
"actions":[
"ohos.want.action.vieData",
],
"entities":[
"entity.system.browsable",
],
"uris":[
{
"scheme": "http",
"host": "www.test.com",
"port": "8080",
"path": "path"
}
]
}
]
}
D.
{
"name": "TargetAbility",
"skills": [
{
"actions":[
"ohos.want.action.sendData",
],
"entities":[
"entity.system.browsable",
],
"uris":[
{
"scheme": "http",
"host": "www.test.com",
"port": "8080",
"path": "path",
"autoVerify": ture
}
]
}
]
}