has number of output layer of DNN any effect in speed of find the optimal answer of DNN?
If you mean by the number of outputs is the number of classes,  then the answer is yes. Increasing the number of outputs will increase the number of parameters that you need to tune. The last set of layers in the dnn are fully connected and they contribute the most in the number of parameters, usually the sizes of these fully connected layers  depend on the number of classes. The more classes the larger these fully connected layers and thus the more parameters