Computer Science Interview Questions and Answers YASH PAL, 13 March 202222 August 2025 Computer Science Interview Questions and Answers – In this article, we are going to learn about the basic and advanced Interview questions and answers related to computer science.These types of questions have a high probability that can be asked in any computer science-related exam like in your University Exams, Competition exams, Hackathons, and Technical Quiz competitions. so be prepared and read all the questions in a proper manner.Which of the following is false?The languages accepted by FAs are regular languagesEvery DFA is an NFAThere are some NFAs for which no DFA can be constructedIf L is accepted by an NFA with (ε) transitionAnswer – (3) Every DFA is an NFAWhich of the following is not true?The set of languages accepted by deterministic and nondeterministic PDAs is not equalL = {WCW^(r)|w in (0 + 1)* & c ∉ {0,1} } can be accepted by a deterministic PDAL = {ww^(r)|w in (0 + 1)*} can be accepted by a deterministic PDAL{0^n 1^n | n >= 0} can be accepted by a deterministic PDAAnswer – (3) L = {ww^(r)|w in (0 + 1)*} can be accepted by a deterministic PDALet r1 = ab*c* & r2 = (a * b ∨ c)* and r3 = (a ∨ b ∨ c)* Then which of the following is truew = ac belongs to L(r2) and L(r3) but not L(r1)w = ac belongs to L(r3) onlyw = ac belongs to L(r1), L(r2) and L(r3)w = ac belongs to L(r1) and L(r3) but not L(r2)Answer – (4) w = ac belongs to L(r1) and L(r3) but not L(r2)Which of the following statements is true?The complement of a language is always regular.The intersection of regular languages is regular.The complement of a regular language is regular.(i) & (ii) only(ii) & (iii) only(i) & (iii) onlyAll of the aboveAnswer – (2) (ii) & (iii) onlyWhich of the following is not true?CFLs are closed under union and concatenation.Regular languages are closed under union and intersection.CFLs are not closed under intersection and complementation.If L is a CFL and R is a regular set then L ∩ R is not a CFL.Answer – (4) If L is a CFL and R is a regular set then L ∩ R is not a CFLContext-free languages and regular languages are both closed under the operations (s) ofUnionIntersectionConcatenation(i) and (ii) only(ii) and (iii) only(i) and (iii) onlyall of the aboveAnswer – (3) (i) and (iii) onlyLet ∑ = {a, b} r1 = a(a ∨ b)* r2 = b(a ∨ b)* Which of the following is true?L(r1) = L(r2) = ∑*L(r1) ⋂ L(r2) = {λ}L(r1) ⋃ L(r2) = ∑*L(r1) ⋃ L(r2) ⋃ {λ} = ∑*Answer – (4) L(r1) ⋃ L(r2) ⋃ {λ} = ∑*Which of the following statements is true?abcd ∈ L((b*a*)*(d*c*)*)abcd ∈ L((d*c*b*a*)*)abcd ∈ L((a*b*a*c*d*)*)(i) and (iii) only(ii) and (iii) only(i) and (ii) onlyall of the aboveAnswer – (4) all of the aboveWhich of the following are regular languages?The language {WIW ∈ {a, b}*, W has an odd number of b’s}The language {WIW ∈ {a, b}*, W has an even number of b’s}The language {WIW ∈ {a, b}*, W has an even number of b’s and an odd number of a’s}(i) and (ii) only(i) only(ii) onlyall of the aboveAnswer – (4) all of the aboveWhich of the following regular expression corresponds to the language of all strings over the alphabet {a, b} that contains exactly two a’Saaab*ab*ab*a(i) and (ii) only(ii) and (iii) only(i) and (iii) onlyNone of theseAnswer – (4) None of theseWhich of the following regular expression corresponds to the language of all strings over the alphabet {a, b} that do not end with ab?(a + b)* (aa + ba + bb)(a + b)* (aa + ba + bb) + a + b + λb* ab* ab* aa b*Answer – (2) (a + b)* (aa + ba + bb) + a + b + λWhat is regular expression corresponding to the language of strings of even lengths over the alphabet of {a,b}(aa + bb + ba + ab)*(aa + bb)*(ab + bb + ba)*a*b*a*b*Answer – (1) (aa + bb + ba + ab)*How many minimum numbers of states will be there in the DFA accepting all strings (over the alphabet {a,b}) that do not contain two consecutive a’s2345Answer – (2) 3How many minimum a number of states are required in the DFA (over the alphabet {a, b}) accepting all the strings with the number of a’S divisible by 4 and number of b’S divisible by 5?209715Answer – (1) 20Which of the following definitions below generates the same language as L where L = {x^n y^n| n >= 1}?E -> xEy | xyxy | (x+ y+)x+ y+(i) only(i) and (ii)(ii) and (iii)(i) and (iii) onlyAnswer – (1) (i) onlyLet X = {0, 1}, L = X* and R = {0^n 1^n/n>0} then the language L ⋃ R and R respectivelyRegular, RegularNone regular, RegularRegular, Not regularNot regular, Not regularAnswer – (3) Regular, Not regularHow many states does the DFA constructed for The set of all strings ending with “00”, have?2345Answer – (2) 3Which of the following identifies are correct?rs* = rss*(r*s*) = (r + s)*(r + s)* = r* + s* (r*s*)* = (r + s)*Answer – (4) (r*s*)* = (r + s)*Let L1 and L2 be regular sets defined over alphabet ∑*. Mark the false statementL1 ∪ L2 is regularL1 ∩ L2 is not regular∑* – L1 is regularL1* is regularAnswer – (2) L1 ∩ L2 is not regularWhich of the following languages are context-freeL1 = {a^mb^mc^n | m >= 1 and n >= 1}L2 = {a^mb^mc^n | n >= m}L3 = {a^mb^mc^m | m >= 1}only L1L2 and L3only L2L3Answer – (1) only L1Note – More questions and answers will be added from time to time Computer Science Tutorials Interview questions answers computer scienceinterview preparation