Help on Lisp programming question.

Can anyone help me answer this programming question?

  • I have yet another question I need help with. To check whether a char variable ch is an uppercase letter, you write ________. (ch >= 'A' || ch <= 'Z') (ch >= 'A' && ch <= 'Z') ('A' <= ch <= 'Z') (ch >= 'A' && ch >= 'Z')

  • Answer:

    Behind the scenes, each character has a numerical value. Here is a link to a table: http://www.asciitable.com/. In this case, ch has to be greater than or equal to 65 (A) and less than or equal to 90 (Z). So: (ch >= 'A' && ch <= 'Z') is the correct answer. It can't be the first option since C++ has short-circuit evaluation for boolean statements, and a lower case letter could be accepted.

_prototyp at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Behind the scenes, each character has a numerical value. Here is a link to a table: http://www.asciitable.com/. In this case, ch has to be greater than or equal to 65 (A) and less than or equal to 90 (Z). So: (ch >= 'A' && ch <= 'Z') is the correct answer. It can't be the first option since C++ has short-circuit evaluation for boolean statements, and a lower case letter could be accepted.

Caramel

It's B, but you need to do your own homework. It basically means the character value is greater than or equal to A and it's less than or equal to Z. So it has to be between A-Z (uppercase)

Scott

If you are checking for capitalization, I would define all of the uppercase alphabet and make if statements.

Shawn

It's B, but you need to do your own homework. It basically means the character value is greater than or equal to A and it's less than or equal to Z. So it has to be between A-Z (uppercase)

If you are checking for capitalization, I would define all of the uppercase alphabet and make if statements.

Shawn

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.