У Германии есть президент?
why not u?
You mean "У Германии"?
Consider a country a group of people. Among these people (inside the group, "в") there is a president. This group of people also has a flag ("у неё-у группы-есть флаг").
Есть ли в Германии президент?
"Имеет ли Германия президента" is correct?