In this article - Why is There a Question Mark Icon in the Dock on Mac? - it says this:
How to Fix a Question Mark Icon in Mac Dock
To fix the question mark icon, you must find the original item that it was linked to, and drag it back into the Mac Dock:
- Hit Command+Spacebar to open Spotlight on Mac (or click the magnifying glass icon in the menu bar)
- Search for the name or the file/folder to find it on the Mac
- Select the Spotlight result with the app/file and hold down the Command key and hit return to open the containing folder
- Drag the app or file/folder into the Mac Dock as usual
- Remove the question mark icon from the Dock as you would remove any other item
It’s also possible that you will not find the app you are looking for when searching with Spotlight, in which case you’ll need reinstall the app, whether from the Mac App Store, the app developer, or where ever the app is available or where from originally obtained.
But what if you don’t know what the original item was?