在下面的伪代码中,部门3的员工会收到多少百分比?
if department < 2 then
raise = SMALL_RAISE
endif
if department < 6 then
raise = MEDIUM_RAISE
endif
if department < 10
raise = BIG_RAISE
endif
A:SMALL_RAISE
B:MEDIUM_RAISE
C:BIG_RAISE
D:无法告诉我选择了中等加薪,因为部门&lt; 6是该块中的第一个真实陈述。好吧,根据我的老师,它的大幅提升。为什么会大幅提高? 编辑:
编辑:那为什么这个示例媒体加注?大加注仍然是最后一次真正的考验。
在下面的伪代码中,部门8中的员工会收到多少百分比?
if department < 5 then
raise = SMALL_RAISE
else
if department < 14 then
raise = MEDIUM_RAISE
else
if department < 9
raise = BIG_RAISE
endif
endif
endif
答案 0 :(得分:3)
答案是10
BIG_RAISE,而if
小于else
,它也小于if department < 2 then
raise = SMALL_RAISE /* <-- block not entered, 3 is not < 2 */
endif
if department < 6 then /* 3 is less than 6 */
raise = MEDIUM_RAISE /* <-- block runs and raise is set. */
endif
if department < 10 /* 3 is less than 10 so the block */
raise = BIG_RAISE /* <-- runs and raise is set again. */
endif
,这是最终的测试条件({{1}条件缺乏[Route("Report/MyReport")]
public async Task<IHttpActionResult> getReport() {
string url = "https://localhost:44305/Templates/ReportPage.html";
System.Uri uri = new System.Uri(url);
return Redirect(uri);
}
)。
package pageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class HomePage {
private static WebElement element;
public static void main(String args[], WebDriver driver){
HomePage hp = new HomePage();
hp.SignInButton(driver);
hp.ImageButton(driver);
System.out.println("Yup");
}
public WebElement SignInButton(WebDriver driver){
element = driver.findElement(By.linkText("Sign In"));
System.out.println("Yeua");
return element;
}
public WebElement ImageButton(WebDriver driver){
return element = driver.findElement(By.linkText("Images"));
}
}
答案 1 :(得分:2)
第二个IF
语句将被评估为true,raise
将被设置为MEDIUM_RAISE
。但是,这将被第三个IF
语句覆盖并最终被raise = BIG_RAISE
覆盖。所以最后答案是c(raise = BIG_RAISE
)
答案 2 :(得分:1)
我使用了c#但它应该清除你的困惑。
alert($("#filterDropdowns").find("div").height());
上面的代码输出
public static void Main()
{
var department = 3;
string raise = "NO RAISE";
if (department < 2)
{
Console.WriteLine("SMALL_RAISE");
raise = "SMALL_RAISE";
}
if (department < 6)
{
Console.WriteLine("MEDIUM_RAISE");
raise = "MEDIUM_RAISE";
}
if (department < 10)
{
Console.WriteLine("BIG_RAISE");
raise = "BIG_RAISE";
}
}
答案 3 :(得分:0)
BIG_RAISE,偏离当然8小于14,而8也小于9,如果第一个结束,程序进入第二个if.so答案是BIG_RAISE。