Question mark

Updated: 09/12/2023 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 Shift while pressing ? inserts a question mark.

Tip

To properly type a question mark, use your left pinky to press the left Shift and your right pinky to press ? on the keyboard. Typing this key this way helps keep your fingers on the home row.

Tip

Doing the Alt code Alt+63 can also create 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, access the numbers (123) and then (#+=) or symbols (sym) section, then tap 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

An Internet web address or URL (uniform resource locator) can utilize a question mark to include query strings in the URL. Other web pages can then retrieve 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 (portable operating system interface for Unix), Perl, Python, BASIC (Beginner's All-purpose Symbolic Instruction Code), 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's true and prints "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.

What is the other symbol on the question mark key?

On U.S. keyboards, the question mark key is shared with the forward slash key, which may be next to or below the backslash symbol.

/?, Keyboard terms, Punctuation, Typography terms