Question mark

Updated: 06/30/2019 by Computer Hope
Question mark

The question mark ( ? ) is found on the same key as the forward slash on US keyboards. It is used in written language to denote a question or a request for an answer to something. Some languages, like Spanish, use two question marks for these types of sentences: one at the beginning and an inverted question mark at the end.

Where is the question mark on the keyboard?

Below is an overview of a computer keyboard with the question mark key highlighted in blue.

Question mark key

How to create a question mark

Creating the question mark symbol on a U.S. keyboard

On English PC and Mac keyboards, the question mark is on the same key as the forward slash key, to the left of the right Shift key. Pressing and holding down the Shift key while pressing the question mark key creates a question mark.

Creating the question mark symbol on a smartphone or tablet

To create a quote symbol on a smartphone or tablet open the keyboard and go into the numbers (123) and then (#+=) or symbols (sym) section and then press your finger on the '?' symbol.

What is a question mark used for on a computer?

Below is a listing of all the different ways a question mark can be used on a computer.

Using a question mark in a wildcard

In computing, the question mark can be used as a wildcard character, a substitute for any one character. For example, if a search was run for word?.txt, the results could return word1.txt, word2.txt, and words.txt.

Question marks in an Internet web address

Internet web addresses or URLs can utilize a question mark to allow for query strings to be added to the URL. Other web pages can then retrieve the values in the query string(s) for further uses. For example, a web address could be http://www.page.com?val1=1234. Programming code on the "www.page.com" web page could retrieve the "1234" value from the "val1" variable. It could then use that value for other purposes, including calculations, displaying on the web page, etc.

Programming

Some programming languages, such as C#, POSIX, Perl, Python, BASIC, and Ruby utilize the question mark for various functions. For example, in Perl you could use the question mark in a regular expression to do an extended pattern match. In the example below, if the variable $example is either "question" or "question mark" it will be true and print "Question or question mark found" when the script is executed.

if ($example =~ /question( mark)?/i) { print "Question or question mark found"; }

Using a question mark in a command line command

Finally, with MS-DOS commands the question mark can be used as a part of a switch to display the help for any command. For example, typing dir /? would give additional help about each of the dir command switches.

/?, Keyboard terms