Are there any simple way to perform repetition inside a tabular environment?
This is what I intended to do:
\documentclass[a4paper,10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{ifthen}
\newcommand\encircle[1]{%
\tikz[baseline=(X.base)]
\node (X) [draw, shape=circle, inner sep=0] {\strut #1};}
\begin{document}
\renewcommand{\arraystretch}{1.25}
\pagestyle{empty}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\newcounter{qno}
\setcounter{qno}{1}
\whiledo{\value{qno} < 41}{
\theqno.
& \encircle{a}
& \encircle{b}
& \encircle{c}
& \encircle{d}
& \encircle{e}
\\
\hline
\stepcounter{qno}
}
\end{tabular}
\end{document}
But it produces an compilation error, a blank page, and a table with three extra lines at the end.
I am aware of a possible solution, but I was wondering if there is any solution that do no require redefining things.

tabular(x)(*) to handle his content. It should be fully available at the whole when TeX start to parsing it, which not the case if the loop is inside the tabular. – Jhor Jun 24 '18 at 17:55