【问题标题】:Salesforce Platform Developer 1 ExamSalesforce 平台开发人员 1 考试
【发布时间】:2020-02-17 13:10:58
【问题描述】:

我正在为我的 PD1 证书做准备,并通过以下链接回答问题: https://www.proprofs.com/quiz-school/quizshow.php?title=developer-i_18b7&q=102

我遇到过以下问题,我确信这些问题的答案是正确的。请有人就以下 6 个问题给我建议。

第一季度。

关于变量作用域,哪三个陈述是准确的?选择 3 个答案

A.如果子块是静态的,则子块可以重用父块的变量名

B.如果子块不是静态的,则子块可以重用父块的变量名

C.并行块可以重用相同的变量名

D.变量可以在块中的任何位置声明

E.必须先声明变量,然后才能在块中引用它

网站正确答案:B、C、D

我确信 E 应该是正确的。想不出一个实例,您可以在不先声明变量的情况下引用它。

第二季度。

开发人员希望在 visualforce 页面上显示机会阶段名称字段的所有选项列表条目以及机会对象的所有可用记录类型。开发人员应该执行哪两个操作来获取控制器中可用的选项列表值和记录类型?选择 2 个答案

A.使用recordtype.sobjecttype.getdescribe().getrecordtypeinfos()返回的schema.recordtypeinfo

B.使用机会.sobjecttype.getdescribe().getpicklistvalue()返回的schema.picklistentry

C.使用机会.sobjecttype.getdescribe().getrecordtypeinfos()返回的schema.recordtypeinfo

D.使用机会.stagename.getdescribe().getpicklistvalue()返回的schema.picklistentry

网站正确答案:B、C

只是想确认这是否正确。因此,对于您通过以下方式查询的选项列表和记录类型:object.sobjecttype.getdescribe().get...

第三季度。

开发人员使用调用 apex 助手类的自定义控制器创建了一个 visualforce 页面。助手类中的方法达到了调控器限制。交易结果如何?

A.保存自定义控制器所做的所有更改

B.自定义控制器再次调用helper类方法

C.事务中的所有更改都会回滚

D.助手类创建一个保存点并继续

网站答案:B

我会说 C 作为州长限制异常是不可恢复的

第四季度。

开发人员使用以下代码块创建自定义控制器和自定义 visualforce 页面:

public class mycontroller{ 

public string mystring{ get{ If(mystring ==null){mystring='a';} return 
mystring;  }
public string getmystring(){ return 'getmystring'; }    
public string getstringmethod(){ if(mystring==null){ mystring='b'; }   
return mystring;  }
}

 <apex:page controller="mycontroller">   {!stringmethod},{!mystring}, 
 {!mystring} </apex:page> 

用户在访问自定义页面时会看到什么?

A.一个,一个,一个

B.甲,乙,乙

C. B,a,getmystring

D. A,b,getmystring

网站答案:A

谁能给我解释一下?不确定这个

Q5.

帐户对象有一个自定义百分比字段,评级,定义为长度为 2,小数点后为 0。一个帐户记录在其评级字段中的值为 50%,并在使用 SOQL 从数据库中检索后在下面的顶点代码中进行处理

public void processaccount(){     
 decimal acctscore = acc.rating__c * 100;
}

这段代码执行后acctscore的值是多少?

A. 50

B. 5000

C. 5

D. 500

网站答案:D

我对此进行了测试,得到了 5000。我错了吗?

Q6.

给定下面的代码,哪三个语句可以用来创建控制器变量?

Public class accountlistcontroller{ 
 public list<account>getaccounts(){  return controller.getrecords();   }
}

选择 3 个答案

一个。

Apexpages.standardcontroller controller= new 
apexpages.standardcontroller([select id from account]);

B.

Apexpages.standardsetcontroller controller=new 
apexpages.standardsetcontroller(database.getquerylocator('select id from 
account'));

C.

Apexpages.standardcontroller controller= new 
apexpages.standardcontroller(database.getquerylocator('select id from 
account'));

D.

Apexpages.standardsetcontroller controller = new 
apexpages.standardsetcontroller (database.getquerylocator([select id 
from account]));

E.

Apexpages.standardsetcontroller controller = new 
apexpages.standardsetcontroller (database.query('select id from 
account'));

网站答案:A、D、E

不知道为什么 C 不正确。如果你想要一个记录列表,你需要 StandardSet。

【问题讨论】:

    标签: salesforce apex


    【解决方案1】:

    根据您在此处提到的选项:::

    选项 a、b、d、e 在匿名窗口中测试时正确。

    选项 c 不正确,因为带有 getquerylocator 的标准控制器给出了以下错误。 构造函数未定义:[ApexPages.StandardController].(Database.QueryLocator)

    a: 是的 Apexpages.standardsetcontroller controller=new apexpages.standardsetcontroller(database.getquerylocator('select id from account limit 1'));

    b: 是的 Apexpages.standardcontroller controller= new apexpages.standardcontroller([select id from account limit 1]);

    c: 假的 Apexpages.standardcontroller controller= new apexpages.standardcontroller(database.getquerylocator('select id from account limit 1'));

    d: 真的 Apexpages.standardsetcontroller controller=new apexpages.standardsetcontroller(database.query('select id from account limit 1')); system.debug('控制器'+控制器);

    e: 真 Apexpages.standardsetcontroller controller = new apexpages.standardsetcontroller (database.getquerylocator([select id from account limit 1]));

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-07
      • 2011-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-11
      相关资源
      最近更新 更多