\documentclass[a4paper]{article}
\usepackage{multicol}
\usepackage[insidebox,noshuffle,separateanswersheet,postcorrect]{automultiplechoice}
\usepackage{tikz}
\geometry{paper=a4paper,hmargin=1.5cm,headheight=2.5cm,headsep=.3cm,footskip=1cm,top=3.5cm,bottom=2.5cm}

\begin{document}
    
% font and look styling
\def\AMCbeginQuestion#1#2{\par\noindent{\textbf{Q. \ifthenelse{#1<10}{\phantom{0}}{}#1 \hspace{0.5ex}}}#2\hspace*{2ex}}
\def\AMCformQuestion#1{\par\noindent{\textbf{Q. \ifthenelse{#1<10}{\phantom{0}}{}#1 \hspace{0.5ex}}}}

\AMCboxStyle{shape=oval}
\def\AMCchoiceLabel#1{\scriptsize\Alph{#1}}
\def\AMCformAnswer#1{\hspace{\AMCformHSpace} #1}

\def\AMCanswer#1#2{#1\hspace{0.4em}}
\AMCformHSpace=0.5em



\newcommand{\detailsBox}{%
%
\hfill\namefield{\fbox{
\begin{minipage}{\linewidth}
\vspace{.5cm}
Name: \hrulefill
\vspace{.4cm}

Class: \hrulefill
Test Name: \hrulefill
Date: \hrulefill
Invigilators Sign: \hrulefill
\vspace{.5cm}
\end{minipage}
}}\hfill
 \vspace{.5cm}
\noindent\hrulefill%
}





\onecopy{1}{%
{\centering \textbf{\textcolor{red}{pagerRef01}}}\par
\noindent
%
\detailsBox
% NameBox Ends
%
%
%
%
\begin{multicols}{3}\columnseprule=0.4pt%
    \foreach \subject in {Physics, Chemistry, Mathematics}{%
        \centering\Large\underline{\subject}%
            \foreach \quesno in {1,2,...,10}{%
                \begin{question}{\subject\quesno}%
                    \begin{choicescustom}%
                        \wrongchoice{}%
                        \wrongchoice{}%
                        \wrongchoice{}%
                        \wrongchoice{}%
                    \end{choicescustom}%
                \end{question}%
            }%
            \foreach \quesno in {1,2,...,10}{%
                \begin{question}{\subject\quesno}%
                    \AMCOpen{dots=true,lineup=true}{\wrongchoice[w]{w}\scoring{0}\correctchoice[c]{c}\scoring{2}}%
                \end{question}
            }%
    }%
\end{multicols}%
\clearpage

\AMCformBegin
{\centering \textbf{\textcolor{red}{pagerRef02-AnswerSheet}}}\par

%
\noindent\detailsBox

\begin{multicols}{3}\columnseprule=0.4pt%
  \AMCform
\end{multicols}




}%
\end{document}