practice_exam_2018

pdf

School

Royal Melbourne Institute of Technology *

*We aren’t endorsed by this school

Course

1107

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

2

Uploaded by ChefLionPerson918

Report
COSC 1105/1107 - Computing Theory Mock Exam (100 marks) Page 1 of 2 DISCLAIMER: This is a mock exam for practice purposes only. It may not represent the real exam, may have mistakes, or under-developed solutions. Doing well/bad on this exam does not guarantee success/failure on the real exam. The sample questions do not cover the entire course examination syllabuses. Students are strongly advised to study each and every part of the syllabus. Use this exam to find your strengths and weaknesses and to see how long it takes to do certain problems. One of the main obstacles of any CT exam is time management. Questions are not worth equal marks; attempt the easiest questions first. GOOD LUCK! Question 1: Complexity .. ... . ... 15 marks (@) (3 marks) Briefly explain the difference between approximation and heuristic algorithms. In which problems would you use such algorithms? (b) (2 marks) Itis known that 3SAT is an NP-complete problem. What does that mean? (c) (2 marks) Can a decision problem be NP-hard but not in NP? Briefly explain your answer. (d) (4 marks) Prove that 4SAT is NP-complete. (e) (4 marks) Prove thatif f(n) O(g(n)), then 10 x f(n) O(g(n)). Question 2: Chomsky Hierarchy ................. PP 21 marks (a) Classify the languages below as either regular (R); context-free but not regular (CF); or recursively enumerable but not context-free (RE). You must give a brief (one sentence) justification of your choice. i. (2 marks) {a*b*c* |i > 0} i. (2marks) {wicws | w1, wz {a,b}*} U{widws | wi,ws {a,b}*} ek i. (2 marks) {wcwiws | w, w1, ws (a | b)*, lw| # |wi| + |wa|} Y. 1 (b) For each of the following statements, is the statement true or false? Briefly explain each answer in one or two sentences. i. (2 marks) Regular expressions are as powerful as non-deterministic push-down automatas. ii. (2 marks) Context-sensitive languages can be recognised by a TM with semi-infinite tape. iti. (2 marks) Non-deterministic Turing Machines are more powerful than deterministic ones. iv. (2 marks) Context-sensitive grammars are more powerful than PDAs. (¢) (7 marks) Show, using the Pumping Lemma, that the language L = {(a | ¢)"b™ | n < m} is not regular. Question 3: Nondeterministic Finite Automata (NFAS) .. ... 23 marks Consider the NFA M below over the alphabet 3 of English letters. Note that e stands for the empty string. (a) (3 marks) Provide two strings accepted by M and one string rejected by M. (b) (3 marks) Describe informally the language L(M) of M. (c) (3 marks) Briefly explain how the language of M changes if g3 is made a final state. (d) (6 marks) Using the subset construction, build a Deterministic Finite Automaton (DFA) for the language of M. You can use abbreviations on transitions, such as a-z or %5 \ {h}. Question 3 continues on the next page. ..
COSC 1105/1107 - Computing Theory Mock Exam | Page 2 of 2 (e) (8 marks) A decimal number consists of: (A) an optional + or sign; (B) a string of digits; (C) a decimal point; and (D) another string of digits. Also, either the string of digits in (B) or (D) can be empty, but at least one of the two strings of digits must be nonempty. Finally, the decimal point appears if and only if the string of digits (D) is not empty. Draw the state diagram of an NFA which accepts decimal numbers. For example, the NFA should accept 132.424, 18888, and .87, but should reject 32.3.23, 187., and .98.1. You can use abbreviations such as 0-9 on transitions if you wish. Question 4: Pushdown AUtOIMAata . .. ... ...o.uuiiiiii 10 marks Consider the pushdown automaton M below (—X means popping X from the stack; +X means pushing X to the stack. The empty string is denoted ). o+ X, b+Y p—y a—X,—X FOEOSNO (a) (3 marks) Trace the execution of M with inputs aabcbcaa, aabcbea, and abcbcaaa. (b) (4 marks) Describe the language of /M in set notation and informally. (¢) (3 marks) How does the language of M change if we replace the transition from ¢ to gz with 0 (q1,¢€ €) = (g2,¢€) and we add the transition §(gs, €, €) = (g1, €) in M?. In one to three sentences, briefly explain your answer. Question 5: Turing Machines . ... ... ..... ooiiiiiii i e 16 marks Consider the Turing machine M = ({qo, 1, g2, 43},10, 1, B}, #, 0, qo, {qgs}) where transition ¢ is defined as: ) 0 1 + qo (Q2707R> (Q1717R) (Q?n#)L) q1 (Q2717R> (QO717R> <Q37#7L> q2 (QO707R) (Q1707R) (Q37#7L> d3 (a) (2 marks) Draw the Turing Machine M. (b) (4 marks) What is the outcome of the computation of M with the inputs 600001100104 (the state 1s written immediately to the left of the symbol being read)? Briefly explain your answer. There is no need to give traces. (¢c) (3 marks) Describe informally the result of a computation in M. (d) (7 marks) Provide a Turing machine M which given a string w over (0, 1)* behaves as follows: e If w contains an odd number of 1’s and an odd number of 0’s, then M converts w into the binary successor of w, i.e. M adds 1 to the binary number represented by w. e Otherwise, M converts all the 1’s to O’s. For example, given the strings 100101, 10011 and 11111, your machine should terminate with outputs 100110, 00000 and 00000 respectively. You may use any notation for Turing machines and any variety of Turing machine that you wish. Question 6: Languages and Computability .. ... 15 marks (a) (2 marks) What is a decision problem? What decision is made in the case of a 3SAT problem? (b) (4 marks) Explain what a Universal Turing machine U is and what U(U, (M, w)) would be equal to. (¢) (2 marks) Could there be an undecidable NP-complete problem? Justify your answer. (d) (7 marks) Prove that the problem of deciding any Turing Machine halts for some input is undecidable. End of mock exam paper
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: What is the center of the following hyperbola? (x-3)² (x + 2)² 4 A B с D (3,-2) = 1 (-3,2) (7,2)…
Q: Calculate the total cost, proceeds, and gain (or loss) (in $) for the stock market transaction.
Q: Answer in brief sentences in your own words please thank you! 1. Soon after the bolus reaches the…
Q: For each of the following lists of vectors in R3, determine whether the first vector can be…
Q: Let A = {p ∈ Z|p = 2r - 6} where r ∈ Z, and let B = {s ∈ Z|s = 4t - 4} where t ∈ Z. Show |A| = |B|.
Q: fiberoptics cable is a cable made out of glass that transports information as electromagnetic waves…
Q: A-how did protestant emphasis  on the family differ from catholicism? B-what were the…
Q: Which of the following abbreviated electron configuration is correct for the element or ion shown…
Q: A cord is used to vertically lower an initially stationary block of mass M = 2.5 kg at a constant…
Q: Plane x + 2y = 5 carries charge ps = 6 nC/m². Determine E at (-1, 0, 1).
Q: In a certain country, the true probability of a baby being a girl is 0.478. Among the next eight…
Q: Prove or disprove that for any x ∈ N, x(x+1)/2 ∈ N (where N = {0, 1, 2, 3, ….}
Q: If f(x)=4x-1 and g(x)=2x-4, what is (fog)(x)? A (fog)(x)=8x-17 B (fog)=8x²-18x+4 C (fog)(x)=8x-16 D…
Q: Which bond is the most polar? Hint: Consider the electronegativity of each element. Br-Br O C-P B-O…
Q: 9–18 ■ Radicals and Exponents Write each radical expressionusing exponents and each exponential…
Q: Consider a tripeptide (a peptide that's only 3 amino acids long) composed of one molecule each of…
Q: P108 35. (a) How does tissue healing by fibrosis differ from healing by regeneration? (b) Which is…
Q: he accompanying table describes the random variable]x, the numbers of adults in groups of five who…
Q: Since immigration has increased the U.S. racial hierarchy has weakened When people live in cultural…
Q: 5.1 INSTRUCTIONS QUESTION - why is it necessary to study Pop-Culture?
Q: Steven uses the quadratic formula to find the zeros of the quadratic function f(x) = x² - 2x - 4.…
Q: Solve for x. Each figure is a parallelogram. Q 13x + 4 R 53° T 58° S