So, in exam, lets say they are asking to create pods in a particular namespace. . . .

karthi Mahadev:
So, in exam, lets say they are asking to create pods in a particular namespace.
and if I do
kubectl config set-context --current --namespace="targetnamespace"

and run command

kubectl create deployment testdeploy --image=nginx

will it be considered as correct ?

Mohamed Ayman:
You can simply do that by using this option -n namespace name
For example
$kubectl create deployment test -n <namespacename>