S-V-O+吗 can express yes-or-no question.
Tā shuō hànyŭ ma?
1. 他 说 汉语 吗?
Does he speak Chinese?
Nĭ chī là ma?
2. 你 吃 辣 吗?
Do you eat spicy food?
However, when we do not need “吗,” if you want to ask question, you should know the below rules.
1). When you meet “X不X” structure, do not use “吗.”
For examples:
Tā shuō bu shuō hànyŭ?
他 说 不 说 汉语?
Does she speak Chinese?
Nĭ chī bu chī là?
你 吃 不 吃 辣?
Do you eat spicy food?
2). When you use question words, do not use “吗.”
For examples:
Nĭ jiào shénme míngzi?
你 叫 什么 名字?
What is your name?
Nĭ chī shénme cài?
你 吃 什么 菜?
What food do you eat?
“什么” is a question word, so you do not need “吗.”
3). When you use “还是”(háishì, or) to express alternative question, do not use “吗.”
For examples:
Tā shuō hànyŭ háishì yīngyŭ?
他 说 汉语 还是 英语?
Does he speak Chinese or English?
Nĭ chī mĭfàn háishì miàntiáo?
你 吃 米饭 还是 面条?
Do you eat rice or noodle?