MCQ Questions
Q.1.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is a upper-case letter.
  • 0%
    (x>='0' && x<='7')
  • 0%
    (x>='0' && x<='9')
  • 0%
    (x>='A' && x<='Z')
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z')
Q.2.
Assume that c is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if c is what is called a whitespace character (that is a space or a tab or a newline-- none of which result in ink being printed on paper).
  • 0%
    ((x>='A' && x<='Z') || (x>='a' && x<='z'))
  • 0%
    !(c == ' ' || c== '\n' || c == '\t')
  • 0%
    !(x >= 'A' && x <='Z')
  • 0%
    (c == ' ' || c== '\n' || c == '\t')
Q.3.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is a decimal digit (0-9).
  • 0%
    (x>='a' && x<='z')
  • 0%
    (x>='0' && x<='9')
  • 0%
    (x>='0' && x<='7')
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z')
Q.4.
What's the difference in ASCII value between '3' and '0'? (consult a table of ASCII values):
  • 0%
    3
  • 0%
    6
  • 0%
    4
  • 0%
    c == ' '
Q.5.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is a lower-case letter.
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z')
  • 0%
    (x>='a' && x<='z')
  • 0%
    (x>='0' && x<='7')
  • 0%
    (x>='0' && x<='9')
Q.6.
Assume that c is a char variable that has been declared and already given a value . Write an expression whose value is true if (c == '\n')and only if c is an newline character .
  • 0%
    !(x >= 'A' && x <='Z')
  • 0%
    c == ' '
  • 0%
    (c == '\n')
  • 0%
    (c=='\t')
Q.7.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is an octal (Base 8) digit (0-7).
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z')
  • 0%
    (x>='0' && x<='7')
  • 0%
    (x>='A' && x<='Z')
  • 0%
    (x>='0' && x<='9')
Q.8.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is an hexadecimal (Base 16) digit (0-9 plus A-F or a-f).
  • 0%
    ( ( x>='0' && x<='9') || ( x>='a' && x<='f' ) || ( x>='A' && x<='F') )
  • 0%
    ((x>='A' && x<='Z') || (x>='a' && x<='z'))
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z')
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z') || (x>='0' && x<='9')
Q.9.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is NOT a letter.
  • 0%
    ((x>='A' && x<='Z') || (x>='a' && x<='z'))
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z')
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z') || (x>='0' && x<='9')
  • 0%
    (x>='a' && x<='z')
Q.10.
Assume that c is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if c is a tab character .
  • 0%
    (c=='\t')
  • 0%
    (c == '\n')
  • 0%
    c == ' '
  • 0%
    (x>='A' && x<='Z')
Q.11.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is NOT a upper-case letter.
  • 0%
    (x>='0' && x<='9')
  • 0%
    !(x >= 'A' && x <='Z')
  • 0%
    (x>='a' && x<='z')
  • 0%
    !((x >= 'A' && x <='Z') || (x >= 'a' && x <='z'))
Q.12.
Assume that x is a char variable that has been declared and already given a value . Write an expression whose value is true if and only if x is alphanumeric , that is either a letter or a decimal digit.
  • 0%
    ( ( x>='0' && x<='9') || ( x>='a' && x<='f' ) || ( x>='A' && x<='F') )
  • 0%
    ((x>='A' && x<='Z') || (x>='a' && x<='z'))
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z') || (x>='0' && x<='9')
  • 0%
    (x>='A' && x<='Z') || (x>='a' && x<='z')
Q.13.
What's the difference in ASCII value between 'E' and 'A'? (consult a table of ASCII values):http://www.asciitable.com
  • 0%
    4
  • 0%
    3
  • 0%
    c == ' '
  • 0%
    6