Are there parts of DNA that do not have genes?
Most the genome is not coding for proteins. Here is a pie chart of what the human genome is made of



As you can see, only 1.5% of the human genome codes for proteins. The term gene is often a bit vaguely defined but if we assume that a gene is all the exons, all the introns and all the regulatory sequences, then 25.5% of the human genome are genes. So, yes many "parts of the genome" do not contain genes.

Now, it is worth highlighting that there is a very high correlation between the genome size and the number of protein-coding genes among lineages. Consider the below graph based on data from NCBI genome reports and styled after Koonin (2011).



There is a high correlation but there are also important outliers. See for example the eukaryotes (green dots) at the bottom right of the graph (probably mainly polyploid plants) that have very big genomes but relatively few protein-coding genes.

So, even though there is a strong correlation, it was quite obvious to me that the answer your teacher was expecting was no, because most of the genome is not coding and despite an existing correlation between genome size and number of genes among lineages there exists species with a very high density of genes and others with a very low density of genes in their genome.