题目
题目

Spr25_CS003C_37772 Ch. 3 Quiz (Remotely Proctored)

单项选择题

Which of the following statements is the best choice to validate user input when entering a marital status as a single letter?

选项
A.if maritalStatus == "S" or maritalStatus == "M" :
B.if maritalStatus == "s" or maritalStatus == "m" :
C.if (maritalStatus == "s" or maritalStatus == "m" or maritalStatus == "S" or maritalStatus == "M") :
D.if maritalStatus == "s" or "S" or "m" or "M" :
查看解析

查看解析

标准答案
Please login to view
思路分析
Question restated: Which of the following statements is the best choice to validate user input when entering a marital status as a single letter? Option 1: if maritalStatus == "S" or maritalStatus == "M" : This checks for uppercase S or M only. If the user enters lowercase s or m, this will fail. It is incomplete because it ignores valid lowercase inputs. Option......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!