Filter 7
Filter 7
Table of Contents 1
Contributors 5
1 CO and Architecture (2) 6
1.1 Computer Organisation (2) 6
Answer Keys 6
2 Compiler Design (124) 7
2.1 Ambiguous Grammar (1) 7
2.2 Annotated Parse Trees (1) 7
2.3 Bottom Up Parses (1) 7
2.4 Cnf (1) 7
2.5 Context Free Grammars (7) 7
2.6 Cyk Algorithm (1) 9
2.7 Dependency Graph (1) 9
2.8 First Follow (2) 9
2.9 Goto Function (1) 9
2.10 Goto Funtion (1) 10
2.11 Infix Expressions (1) 10
2.12 Introduction (10) 10
2.13 Left Recursion (4) 12
2.14 Lexeme (1) 13
2.15 Lexemes (2) 13
2.16 Lexical Analyzer (3) 13
2.17 Ll1parser Slr1parser (2) 14
2.18 Lr Parser (4) 14
2.19 Lr0item (1) 15
2.20 Nfa Dfa (1) 15
2.21 Parse Tree (9) 16
2.22 Postfix Notation (1) 18
2.23 Predictive Parser (2) 18
2.24 Recursive Descent Parser (2) 19
2.25 Specification Of Tokens (1) 19
2.26 Strings (2) 19
2.27 Syntax Directed Translation (11) 20
2.28 Three Address Code (20) 23
2.29 Ullman (25) 28
2.30 Viable Prefix (1) 34
2.31 Yacc (4) 34
Answer Keys 34
3 Computer Networks (17) 36
3.1 Peter Linz Edition5 (17) 36
Answer Keys 38
4 Discrete Mathematics: Combinatory (416) 39
4.1 Binomial Theorem (39) 39
4.2 Counting (260) 43
4.3 Generating Functions (1) 79
4.4 Pigeonhole Principle (47) 79
4.5 Recurrence (69) 85
Answer Keys 95
5 Discrete Mathematics: Graph Theory (1) 98
5.1 Kenneth Rosen (1) 98
Answer Keys 98
6 Discrete Mathematics: Mathematical Logic (222) 99
6.1 First Order Logic (1) 99
6.2 Kenneth Rosen (35) 99
6.3 Logical Reasoning (1) 104
6.4 Propositional Logic (184) 105
Answer Keys 132
7 Discrete Mathematics: Set Theory & Algebra (236) 134
7.1 Kenneth Rosen (234) 134
7.2 Probability (1) 165
Answer Keys 165
8 Engineering Mathematics: Probability (89) 167
8.1 Conditional Probability (8) 167
8.2 Gravner (50) 168
8.3 Normal Distribution (1) 174
8.4 Probability (2) 174
8.5 Random Variable (27) 175
Answer Keys 178
9 Operating System (600) 180
9.1 Bankers Algorithm (1) 180
9.2 Bitmaps (1) 180
9.3 Contiguous Allocation (1) 180
9.4 Cylinders (2) 181
9.5 Deadlock (24) 181
9.6 Deadlock Detection Algorithm (1) 186
9.7 Deadlock Prevention Avoidance Detection (37) 186
9.8 Dining Philosophers Problem (1) 194
9.9 Disk Block (1) 194
9.10 Disk Controller (1) 194
9.11 Disk Scheduling (7) 194
9.12 Disk Space (1) 195
9.13 Disks (12) 196
9.14 File Allocation Table (2) 198
9.15 File Organization (1) 198
9.16 File System (53) 198
9.17 Fsm (1) 206
9.18 Galvin (90) 206
9.19 Hard Disk (1) 219
9.20 I Node (1) 220
9.21 Input Output (50) 220
9.22 Instruction Format (1) 229
9.23 Interrupt Driven (1) 229
9.24 Introduction (73) 230
9.25 Inverted Page Table (1) 238
9.26 Io System (17) 238
9.27 Kernel Mode (1) 241
9.28 Kernel User Mode (1) 241
9.29 Lru (1) 241
9.30 Memory (1) 241
9.31 Memory Management (5) 241
9.32 Memory Mapped (2) 242
9.33 Monitors (1) 243
9.34 Multi Programming (1) 243
9.35 Multilevel Paging (1) 243
9.36 Multiplexing (1) 243
9.37 Multiprocessors (2) 243
9.38 Multithreaded (2) 244
9.39 Mutual Exclusion (1) 244
9.40 Page Fault (10) 245
9.41 Page Replacement (14) 247
9.42 Page Table (6) 250
9.43 Paging (8) 251
9.44 Physical Address (2) 252
9.45 Preemptable Nonpreemptable (1) 253
9.46 Process (18) 253
9.47 Process And Threads (53) 257
9.48 Program (2) 264
9.49 Race Conditions (1) 264
9.50 Resource Allocation (2) 265
9.51 Round Robin (2) 265
9.52 Segmentation (2) 265
9.53 Semaphores (1) 266
9.54 Shared System (1) 266
9.55 Starvation (1) 266
9.56 System Call (7) 266
9.57 Threads (15) 267
9.58 Timesharing System (1) 269
9.59 Tlb (8) 269
9.60 Trap Instruction (1) 271
9.61 Unix (8) 271
9.62 Virtual Address Space (1) 272
9.63 Virtual Machines (1) 272
9.64 Virtual Memory (31) 272
9.65 Working Directory (1) 277
Answer Keys 278
10 Theory of Computation (776) 282
10.1 Ambiguous Grammar (1) 282
10.2 Cfg (3) 282
10.3 Closure Property (31) 282
10.4 Cnf (3) 286
10.5 Computability (1) 287
10.6 Context Free Grammars (97) 287
10.7 Countable Uncountable Set (2) 302
10.8 Dfa Nfa (1) 302
10.9 Dpda (1) 302
10.10 Enumerated Language (1) 303
10.11 Finite State Transducer (2) 303
10.12 Fst (2) 303
10.13 Gnf (5) 303
10.14 Grammar (27) 304
10.15 Graph (4) 308
10.16 Homomorphism (1) 308
10.17 Inherently Ambiguous (4) 309
10.18 Legitimate Turing Machine (1) 309
10.19 Michael Sipser (103) 309
10.20 Nfa Dfa (26) 324
10.21 Non Determinism (1) 328
10.22 Npda (27) 328
10.23 Parse Trees (1) 333
10.24 Perfect Shuffle (2) 333
10.25 Peter Linz Edition4 (147) 333
10.26 Peter Linz Edition5 (154) 353
10.27 Pigeonhole Principle (1) 375
10.28 Polynomials (1) 375
10.29 Post Correspondence Problem (5) 375
10.30 Post Corresponding Problem (1) 376
10.31 Prefix (1) 376
10.32 Prefix Closed (1) 376
10.33 Prefix Free Language (1) 376
10.34 Pumping Lemma (45) 376
10.35 Pushdown Automata (11) 382
10.36 Recursive And Recursively Enumerable Languages (1) 384
10.37 Recursive Recursively Enumerable Languages (18) 384
10.38 Reduction (5) 387
10.39 Regular Grammar (17) 387
10.40 Rice Theorem (3) 389
10.41 Rotational Closure Of Language (1) 390
10.42 Scarnes Cut (1) 390
10.43 Sets (3) 390
10.44 Shuffle (1) 391
10.45 Simplification (1) 391
10.46 State Diagram (7) 391
10.47 Suffix Operation (1) 393
10.48 Synchronizable Dfa (1) 393
10.49 Transducer (1) 393
Answer Keys 394
Contributors
User , Answers User Added User Done
abhishek kumar 67, 64 Lakshman Patel 425 Jeet Rajput 80
Jeet Rajput 40, 82 Pooja Khatri 116 abhishek kumar 32
Deepak Poonia 28, 10 Naveen Kumar 111 aditi19 22
HABIB MOHAMMAD 27, 2 Akash Dinkar 48 Lakshman Patel 17
KHAN GO Editor 21 Mk Utkarsh 12
Muktinath Vishwakarma 23, 5 Rishi yadav 15 srestha 9
aditi19 20, 37 Mk Utkarsh 11 Arjun Suresh 7
Dhananjay Kumar Sharma 17, 2 aditi19 5 ankitgupta.1729 6
Mohit Kumar 13, 135 Mohit Kumar 5
Desert_Warrior 12, 3 Himanshu Gupta 5
Mk Utkarsh 11, 12 Muthoju Sai Theja Chary 4
Prashant Singh 10, 4 Aanchal Satpuri 4
prashant jha 8, 5 Rishi yadav 4
ankitgupta.1729 8, 9 Chinmay Jain 4
srestha 8, 13 Shaik Masthan 3
Subham Mishra 7, 25 Muktinath Vishwakarma 3
Manoj Kumar 6, 1 Subham Mishra 3
Gaurab Ghosh 6, 1 Sachin Singh Thakur 2
Rishabh Gupta 6, 1 Keval Malde 2
Prateek Dwivedi 5, 1 vishnu_m7 2
Aakash Preetam 5, 4 Deepak Poonia 2
Arpit Tripathi 4, 1 Garrett McClure 2
Ravijha 4, 2 Spidey_guy 1
Tushar Patil 4, 3 Sudeshna Chaudhuri 1
Keval Malde 4, 4 Naveen Kumar 1
Lakshman Patel 4, 22 Utkarsh Joshi 1
Sayan Bose 3, 1 Shashank Rustagi 1
shekhar chauhan 3, 1 Gaurav Shukla 1
Rounak Agarwal 3, 1 Gurdeep 1
ANIKET KUMAR 3, 1 Washeef 1
Kunal ghanghav 3, 1 ThinkBig 1
Aakanksha Rani 3, 2 Ram Swaroop1 1
shaheena 3, 3 Pravin Paikrao 1
Debdeep Paul Chaudhuri 3, 3 Prateek Dwivedi 1
Sachin Singh Thakur 3, 11 Dhananjay Kumar Sharma 1
Himanshu Gupta 3, 13 Swpril ahuja 1
tdk93 2, 1 Kapil Phulwani 1
DEVWRITT ARYA 2, 1 DEVWRITT ARYA 1
pawan sahu 2, 1 Shubhi Tiwari 1
sasuke 2, 1 Sathuri Bharath Kumar 1
rahul sharma 2, 1 Goud
Gaurav Kumar 2, 1 nocturnal123 1
ABHIJEET MISHRA 2, 1 Shivani Gaikawad 1
Anuj Mishra 2, 1 Akash Dinkar 1
Ayush sahni 2, 1 Aboveallplayer 1
Harshitkmr 2, 1 DIBAKAR MAJEE 1
PrakharSrivastava 2, 1 aerox goat 1
Washeef 2, 1 reboot 1
Wilbred Anto 2, 1 Debashish Deka 1
Venky8 2, 1 AngshukN 1
AngshukN 2, 1 Na462 1
Aboveallplayer 2, 2 Soumya Jain 1
Gaurav Shukla 2, 2 Desert_Warrior 1
Suvasish Dutta 2, 3 Anup patel 1
KUSHAGRA गु ा 2, 3 janakyMurthy 1
Pritish C 2, 3 Gaurav Kumar 1
Hira 2, 4 Lakshay Kakkar 1
Chinmay Jain 2, 33 chirudeepnamini 1
Suvasish Dutta 1
HABIB MOHAMMAD 1
KHAN
Tushar Patil 1
Subarna Das 1
Debdoot Roy Chowdhury 1
lokendra14 1
KUSHAGRA गु ा 1
krish71 1
Anshita Shrivastava 1
1 CO and Architecture (2)
1.1.1 Computer Organisation: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 14 (Page No. 82)
https://gateoverflow.in/324337
A computer has a pipeline with four stages. Each stage takes the same time to do its work,
namely, 1 nsec. How many instructions per second can this machine execute?
tanenbaum operating-system computer-organisation introduction machine-instructions pipelining descriptive
1.1.2 Computer Organisation: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 11 (Page No. 430)
https://gateoverflow.in/324826
A computer has a three-stage pipeline as shown in Fig. 1-7(a). On each clock cycle, one new
instruction is fetched from memory at the address pointed to by the PC and put into the pipeline and the PC advanced.
Each instruction occupies exactly one memory word. The instructions already in the pipeline are each advanced one stage.
When an interrupt occurs, the current PC is pushed onto the stack, and the PC is set to the address of the interrupt handler. Then
the pipeline is shifted right one stage and the first instruction of the interrupt handler is fetched into the pipeline. Does this
machine have precise interrupts? Defend your answer.
Answer Keys
1.1.1 N/A 1.1.2 N/A
2 Compiler Design (124)
2.1.1 Ambiguous Grammar: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 9 (Page No. 259)
https://gateoverflow.in/318980
The following is an ambiguous grammar:
S → AS ∣ b
A → SA ∣ a
Construct for this grammar its collection of sets of LR(0) items. If we try to build an LR-parsing table for the grammar, there
are certain conflicting actions. What are they? Suppose we tried to use the parsing table by nondeterministically choosing a
possible action whenever there is a conflict. Show all the possible sequences of actions on input abab.
2.2.1 Annotated Parse Trees: Ullman (Compiler Design) Edition 2 Exercise 5.2 Question 2 (Page No. 317)
https://gateoverflow.in/319932
For the SDD of Fig. 5.8, give annotated parse trees for the following expressions:
a. int a,b,c.
b. float w,x,y,z.
2.3.1 Bottom Up Parses: Ullman (Compiler Design) Edition 2 Exercise 4.5 Question 3 (Page No. 241)
https://gateoverflow.in/318967
Give bottom-up parses for the following input strings and grammars:
2.4.1 Cnf: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 8 (Page No. 232) https://gateoverflow.in/318960
A grammar is said to be in Chomsky Normal Form (CNF) if every production is either of the form A → BC or of the
form
A → a , where A, B, and C are nonterminals, and a is a terminal. Show how to convert any grammar into a CNF grammar for
the same language (with the possible exception of the empty string - no CNF grammar can generate ϵ).
ullman compiler-design cnf grammar descriptive
2.5.1 Context Free Grammars: Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 1 (Page No. 51)
https://gateoverflow.in/317581
Consider the context-free grammar
S → SS+ ∣ SS ∗ ∣ a
2.5.2 Context Free Grammars: Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 2 (Page No. 51)
https://gateoverflow.in/317585
What language is generated by the following grammars? In each case justify your answer.
a. S → 0S1 ∣ 01 b. S → +SS ∣ −SS ∣ a
c. S → S(S)S ∣ ϵ d. S → aSbS ∣ bSaS ∣ ϵ
e. S → a ∣ S + S ∣ SS ∣ S ∗ ∣ (S)
ullman compiler-design context-free-grammars
2.5.3 Context Free Grammars: Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 3 (Page No. 51)
https://gateoverflow.in/317586
Which of the grammars are ambiguous?
a. S → 0S1 ∣ 01 b. S → +SS ∣ −SS ∣ a
c. S → S(S)S ∣ ϵ d. S → aSbS ∣ bSaS ∣ ϵ
e. S → a ∣ S + S ∣ SS ∣ S ∗ ∣ (S)
ullman compiler-design context-free-grammars ambiguous
2.5.4 Context Free Grammars: Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 4 (Page No. 51 - 52)
https://gateoverflow.in/317587
Construct unambiguous context-free grammars for each of the following languages. In each case
show that your grammar is correct.
2.5.5 Context Free Grammars: Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 6 (Page No. 52)
https://gateoverflow.in/317589
Construct a context-free grammar for roman numerals.
ullman compiler-design context-free-grammars
2.5.6 Context Free Grammars: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 3 (Page No. 207)
https://gateoverflow.in/318751
Design grammars for the following languages:
a. The set of all strings of 0′ s and 1′ s such that every 0 is immediately followed by at least one 1.
b. The set of all strings of 0′ s and 1′ s that are palindromes; that is, the string reads the same backward as forward.
c. The set of all strings of 0′ s and 1′ s with an equal number of 0′ s and 1′ s.
d. The set of all strings of 0′ s and 1′ s with an unequal number of 0′ s and 1′ s.
e. The set of all strings of 0′ s and 1′ s in which 011 does not appear as a substring.
f. The set of all strings of 0′ s and 1′ s of the form xy, where x ≠ y and x and y are of the same length.
2.5.7 Context Free Grammars: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 10 (Page No. 233)
https://gateoverflow.in/318962
Show how, having filled in the table as in Question 4.4.9, we can in O(n) time recover a parse
tree for a1 a2 ⋅ ⋅ ⋅ an . Hint: modify the table so it records, for each nonterminal A in each table entry Tij , some pair of
nonterminals in other table entries that justified putting A in Tij .
ullman compiler-design context-free-grammars descriptive
2.6.1 Cyk Algorithm: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 9 (Page No. 232)
https://gateoverflow.in/318961
Every language that has a context-free grammar can be recognized in at most O(n3 ) time for
strings of length n. A simple way to do so,called the Cocke- Younger-Kasami (or CYK) algorithm is based on dynamic
programming. That is, given a string a1 a2 ⋅ ⋅ ⋅ an , we construct an n-by-n table T such that Tij is the set of nonterminals that
generate the substring ai ai+1 ⋅ ⋅ ⋅ aj . If the underlying grammar is in CNF (see \question 4.4.8), then one table entry can be
filled in in O(n) time, provided we fill the entries in the proper order: lowest value of j − i first. Write an algorithm that
correctly fills in the entries of the table, and show that your algorithm takes O(n3 ) time. Having filled in the table, how do
you determine whether $a_{l}a_{2}\cdot\cdot\cdot a_{n} is in the language?
ullman compiler-design context-free-grammars cyk-algorithm descriptive
2.7.1 Dependency Graph: Ullman (Compiler Design) Edition 2 Exercise 5.2 Question 1 (Page No. 317)
https://gateoverflow.in/319931
What are all the topological sorts for the dependency graph of Fig. 5.7?
2.8.1 First Follow: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 3 (Page No. 231)
https://gateoverflow.in/318953
Compute FIRST and FOLLOW for the grammar of S → SS+ ∣ SS∗ ∣ a
2.8.2 First Follow: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 4 (Page No. 231)
https://gateoverflow.in/318954
Compute FIRST and FOLLOW for each of the grammars of
a. S → 0S1 ∣ 01
b. S → +SS ∣ ∗SS ∣ a
c. S → S(S)S ∣ ϵ
d. S → S + S ∣ SS ∣ (S) ∣ S∗ ∣ a
e. S → (L) ∣ a and L → L, S ∣ S
f. S → aSbS ∣ bSaS ∣ ϵ
g. The following grammar for boolean expressions:
2.9.1 Goto Function: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 4 (Page No. 258)
https://gateoverflow.in/318973
For each of the (augmented) grammars of Question 4.2.2(a) − (g) :
a. Construct the SLR sets of items and their GOTO function.
b. Indicate any action conflicts in your sets of items.
c. Construct the SLR-parsing table, if one exists.
2.10.1 Goto Funtion: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 2 (Page No. 258)
https://gateoverflow.in/318971
Construct the SLR sets of items for the (augmented) grammar of Question 4.2.1. Compute the
GOTO function for these sets of items. Show the parsing table for this grammar. Is the grammar SLR?
ullman compiler-design slr-item goto-funtion descriptive
2.11.1 Infix Expressions: Ullman (Compiler Design) Edition 2 Exercise 5.3 Question 2 (Page No. 323)
https://gateoverflow.in/319940
Give an SDD to translate infix expressions with + and ∗ into equivalent expressions without
redundant parentheses. For example, since both operators associate from the left, and ∗ takes precedence over
+, ((a ∗ (b + c)) ∗ (d)) translates into a ∗ (b + c) ∗ d.
ullman compiler-design syntax-directed-translation infix-expressions
2.12.1 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.1 Question 1 (Page No. 3)
https://gateoverflow.in/310021
What is the difference between a compiler and an interpreter?
ullman compiler-design introduction
2.12.2 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.1 Question 2 (Page No. 3)
https://gateoverflow.in/310022
What are the advantages of
2.12.3 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.1 Question 3 (Page No. 3)
https://gateoverflow.in/310023
What advantages are there to a language processing system in which the compiler produces
assembly language rather than machine language?
ullman compiler-design introduction
2.12.4 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.1 Question 4 (Page No. 3)
https://gateoverflow.in/310024
A compiler that translates a high-level language into another high-level language is called a
source-to-source translator. What advantages are there to using C as a target language for a compiler?
ullman compiler-design introduction
2.12.5 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.1 Question 5 (Page No. 3)
https://gateoverflow.in/310025
Describe some of the tasks that an assembler needs to perform.
ullman compiler-design introduction descriptive
2.12.6 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.3 Question 1 (Page No. 14 - 15)
https://gateoverflow.in/317573
Indicate which of the following terms:
1. C
2. C++
3. Cobol
4. Fortran
5. Java
6. Lisp
7. ML
8. Perl
9. Python
10. VB.
2.12.7 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.6 Question 1 (Page No. 35 - 36)
https://gateoverflow.in/317574
For the block-structured C code, indicate the values assigned to w, x, y, and z.
int w,x,y,z;
int i = 4; int j = 5;
{
int j = 7;
i = 6;
w = i + j;
}
x = i + j;
{
int i = 8;
y = i + j;
}
z = i + j;
2.12.8 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.6 Question 2 (Page No. 35 - 36)
https://gateoverflow.in/317576
For the block-structured C code, indicate the values assigned to w, x, y and z.
int w,x,y,z;
int i = 3; int j = 4;
{
int i = 5;
w = i + j;
}
x = i + j;
{
int j = 6;
i = 7;
y = i + j;
}
z = i + j;
2.12.9 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.6 Question 3 (Page No. 35 - 36)
https://gateoverflow.in/317577
For the block-structured code, assuming the usual static scoping of declarations, give the scope
for each of the twelve declarations.
{
int w,x,y,z; /* Block B1 */
{
int x,z; /* Block B2 */
{
int w,x; /* Block B3 */
}
}
{
int w,x; /* Block B4 */
{
int y,z; /* Block B5 */
}
}
}
2.12.10 Introduction: Ullman (Compiler Design) Edition 2 Exercise 1.6 Question 4 (Page No. 36)
https://gateoverflow.in/317579
What is printed by the following C code?
#define a (x+1)
int x = 2;
void b() {x = a; printf("%d\n",x);}
void c() {int x = 1; printf("%d\n"),a;}
void main() {b(); c();}
2.13.1 Left Recursion: Ullman (Compiler Design) Edition 2 Exercise 4.3 Question 1 (Page No. 216)
https://gateoverflow.in/318948
The following is a grammar for regular expressions over symbols a and b only, using + in place
of ∣ for union, to avoid conflict with the use of vertical bar as a metasymbol in grammars:
2.13.2 Left Recursion: Ullman (Compiler Design) Edition 2 Exercise 4.3 Question 2 (Page No. 216 - 217)
https://gateoverflow.in/318949
Repeat Exercise 4.3.1 on the following grammars:
a. S → SS+ ∣ SS ∗ ∣ a b. S → 0S1 ∣ 01 bex
c. S → S(S)S ∣ ϵ d. S → (L) ∣ a and L → L, S ∣ S bter
e. The following grammar for boolean bfactor → not bfactor ∣ (bexpr) ∣ true ∣ false
expressions
2.13.3 Left Recursion: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 1 (Page No. 231)
https://gateoverflow.in/318951
For each of the following grammars, devise predictive parsers and show the parsing tables. You
may left-factor and/or eliminate left-recursion from your grammars first.
a. S → 0S1 ∣ 01
b. S → +SS ∣ ∗SS ∣ a
c. S → S(S)S ∣ ϵ
d. S → S + S ∣ SS ∣ (S) ∣ S∗ ∣ a $.
e. S → (L) ∣ a and L → L, S ∣ S
f. The following grammar for boolean expressions:
Rewrite this SDT so the underlying grammar is not left recursive, and yet the same value of B. val is computed for the entire
input string.
2.14.1 Lexeme: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 4 (Page No. 125)
https://gateoverflow.in/318183
Most languages are case sensitive, so keywords can be written only one way, and the regular
expressions describing their lexeme is very simple. However, some languages, like SQL, are case insensitive, so a
keyword can be written either in lowercase or in uppercase, or in any mixture of cases. Thus, the SQL keyword SELECT can
also be written select, Select, or sElEcT, for instance. Show how to write a regular expression for a keyword in a case-
insensitive language. Illustrate the idea by writing the expression for "select" in SQL.
ullman compiler-design regular-expressions lexeme descriptive
2.15.1 Lexemes: Ullman (Compiler Design) Edition 2 Exercise 3.1 Question 1 (Page No. 114)
https://gateoverflow.in/317650
Divide the following C + + program:
float limitedSquare(x) float x {
/* returns x-squared, but never more than 100 */
return (x<=-10.0 || x>=10.0)?100:x*x;
}
into appropriate lexemes, using the discussion of Section 3.1.2 as a guide. Which lexemes should get associated lexical values?
What should those values be?
2.15.2 Lexemes: Ullman (Compiler Design) Edition 2 Exercise 3.1 Question 2 (Page No. 114 - 115)
https://gateoverflow.in/317651
Tagged languages like HTML or XML are different from conventional programming languages
in that the punctuation (tags) are either very numerous (as in HTML) or a user-definable set (as in XML). Further, tags
can often have parameters. Suggest how to divide the following HTML document:
Here is a photo of <B>my house</B>:
<P><IMG SRC = "house. gif"><BR>
See <A HREF = "morePix. htmll">More Pictures</A> if you
liked that one. <P>
into appropriate lexemes. Which lexemes should get associated lexical values,and what should those values be?
2.16.1 Lexical Analyzer: Ullman (Compiler Design) Edition 2 Exercise 2.6 Question 1 (Page No. 84 - 85)
https://gateoverflow.in/317597
Extend the lexical analyzer in Section 2.6.5 to remove comments, defined as follows:
a. A comment begins with // and includes all characters until the end of that line.
b. A comment begins with /∗ and includes all characters through the next occurrence of the character sequence ∗/.
2.16.3 Lexical Analyzer: Ullman (Compiler Design) Edition 2 Exercise 2.6 Question 3 (Page No. 85)
https://gateoverflow.in/317599
Extend the lexical analyzer in Section 2.6.5 to recognize floating point numbers such as
2., 3.14, and .5.
ullman compiler-design lexical-analyzer
2.17.1 Ll1parser Slr1parser: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 5 (Page No. 258)
https://gateoverflow.in/318974
Show that the following grammar:
S → AaAb ∣ BbBa
A→ϵ
A→ϵ
is LL(1) but not SLR(1).
2.17.2 Ll1parser Slr1parser: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 6 (Page No. 258)
https://gateoverflow.in/318976
Show that the following grammar:
S → SA ∣ A
A→a
is SLR(1) but not LL(1).
2.18.1 Lr Parser: Ullman (Compiler Design) Edition 2 Exercise 4.5 Question 2 (Page No. 240 - 241)
https://gateoverflow.in/318966
Repeat Question 4.5.1 for the grammar S → S S+ ∣ S S∗ ∣ a of Exercise 4.2.1 and the
following right-sentential forms:
a. SSS + a ∗ +.
b. SS + a ∗ a+.
c. aaa ∗ a + +.
2.18.2 Lr Parser: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 7 (Page No. 258)
https://gateoverflow.in/318978
Consider the family of grammars Gn , defined by:
S → Ai bi for 1 ≤ i ≤ n
Ai → aj Ai ∣ aj for 1 ≤ i, j ≤ n and i ≠ j
Show that:
What does this analysis say about how large LR parsers can get?
ullman compiler-design grammar parsing lr-parser descriptive
2.18.3 Lr Parser: Ullman (Compiler Design) Edition 2 Exercise 4.7 Question 1 (Page No. 278)
https://gateoverflow.in/318981
Construct the
2.18.4 Lr Parser: Ullman (Compiler Design) Edition 2 Exercise 4.8 Question 2 (Page No. 286 - 287)
https://gateoverflow.in/318987
In Fig. 4.56 is a grammar for certain statements, similar to that discussed in Question 4.4.12.
Again, e and s are terminals standing for conditional expressions and "other statements," respectively.
a. Build an LR parsing table for this grammar, resolving conflicts in the usual way for the dangling-else problem.
b. Implement error correction by filling in the blank entries in the parsing table with extra reduce-actions or suitable error-
recovery routines.
c. Show the behavior of your parser on the following inputs:
2.19.1 Lr0item: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 8 (Page No. 259)
https://gateoverflow.in/318979
We suggested that individual items could be regarded as states of a nondeterministic finite
automaton, while sets of valid items are the states of a deterministic finite automaton (see the box on "Items as States of
an NFA" in Section 4.6.5). For the grammar S → SS+ ∣ SS∗ ∣ a of Question 4.2.1:
a. Draw the transition diagram (NFA) for the valid items of this grammar according to the rule given in the box cited above.
b. Apply the subset construction (Algorithm 3.20) to your NFA from part (a). How does the resulting DFA compare to the
set of LR(0) items for the grammar?
c. Show that in all cases, the subset construction applied to the NFA that comes from the valid items for a grammar produces
the LR(0) sets of items.
2.20.1 Nfa Dfa: Ullman (Compiler Design) Edition 2 Exercise 5.2 Question 6 (Page No. 317)
https://gateoverflow.in/319938
Implement Algorithm 3.23, which converts a regular expression into a nondeterministic finite
automaton, by an L-attributed SDD on a top-down parsable grammar. Assume that there is a token char representing
any character, and that char. lexval is the character it represents. You may also assume the existence of a function new() that
returns a new state, that is, a state never before returned by this function. Use any convenient notation to specify the transitions
of the NFA .
ullman compiler-design syntax-directed-translation regular-expressions nfa-dfa parsing
2.21.1 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 2.3 Question 1 (Page No. 60)
https://gateoverflow.in/317591
Construct a syntax-directed translation scheme that translates arithmetic expressions from infix
notation into prefix notation in which an operator appears before its operands; e.g., −xy is the prefix notation for
x − y. Give annotated parse trees for the inputs 9 − 5 + 2 and 9 − 5 ∗ 2.
ullman compiler-design syntax-directed-translation parse-tree
2.21.2 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 2.3 Question 2 (Page No. 60)
https://gateoverflow.in/317592
Construct a syntax-directed translation scheme that translates arithmetic expressions from
postfix notation into infix notation. Give annotated parse trees for the inputs 95 − 2∗ and 952 ∗ −.
2.21.3 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 1 (Page No. 206)
https://gateoverflow.in/318242
Consider the context-free grammar:
S → SS+ ∣ SS ∗
2.21.4 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 2 (Page No. 206 - 207)
https://gateoverflow.in/318748
Repeat Question 4.2.1 for each of the following grammars and strings:
2.21.5 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 5.1 Question 1 (Page No. 309 - 310)
https://gateoverflow.in/319928
For the SDD(SYNTAX-DIRECTED DEFINITIONS ) of Fig. 5.1, give annotated parse trees for the following expressions:
a. (3 + 4) ∗ (5 + 6)n.
b. 1 ∗ 2 ∗ 3 ∗ (4 + 5)n.
c. (9 + 8 ∗ (7 + 6) + 5) ∗ 4n.
2.21.6 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 5.1 Question 2 (Page No. 310)
https://gateoverflow.in/319929
Extend the SDD of Fig. 5.4 to handle expressions as in Fig. 5.1.
2.21.7 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 5.1 Question 3 (Page No. 310)
https://gateoverflow.in/319930
For the SDD(SYNTAX-DIRECTED DEFINITIONS ) of Fig. 5.4, give annotated parse trees for the following expressions:
1. (3 + 4) ∗ (5 + 6)n.
2. 1 ∗ 2 ∗ 3 ∗ (4 + 5)n.
3. (9 + 8 ∗ (7 + 6) + 5) ∗ 4n.
2.21.8 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 5.2 Question 4 (Page No. 317)
https://gateoverflow.in/319935
This grammar generates binary numbers with a "decimal" point:
S → L. L ∣ L
L → LB ∣ B
B→0∣1
Design an L-attributed SDD to compute S. val, the decimal-number value of an input string. For example, the translation of
string 101.101 should be the decimal number 5.625. Hint: use an inherited attribute L. side that tells which side of the
decimal point a bit is on.
2.21.9 Parse Tree: Ullman (Compiler Design) Edition 2 Exercise 5.2 Question 5 (Page No. 317)
https://gateoverflow.in/319936
This grammar generates binary numbers with a "decimal" point:
S → L. L ∣ L
L → LB ∣ B
B→0∣1
Design an S-attributed SDD to compute S. val, the decimal-number value of an input string. For example, the translation of
string 101.101 should be the decimal number 5.625.
2.22.1 Postfix Notation: Ullman (Compiler Design) Edition 2 Exercise 5.3 Question 1 (Page No. 323)
https://gateoverflow.in/319939
Below is a grammar for expressions involving operator + and integer or floating-point
operands. Floating-point numbers are distinguished by having a decimal point.
E→E+T ∣T
T → num. num ∣ num
2.23.1 Predictive Parser: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 12 (Page No. 233)
https://gateoverflow.in/318964
In Fig. 4.24 is a grammar for certain statements. You may take e and s to be terminals standing
for conditional expressions and "other statements," respectively. If we resolve the conflict regarding expansion of the
optional "else" (nonterminal stmtTail) by preferring to consume an else from the input whenever we see one, we can build a
predictive parser for this grammar. Using the idea of synchronizing symbols described in Section 4.4.5:
2.23.2 Predictive Parser: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 2 (Page No. 231)
https://gateoverflow.in/318952
Is it possible, by modifying the grammar in any way, to construct a predictive parser for the
language of S → SS+ ∣ SS∗ ∣ a (postfix expressions with operand a)?
2.24.1 Recursive Descent Parser: Ullman (Compiler Design) Edition 2 Exercise 2.4 Question 1 (Page No. 68)
https://gateoverflow.in/317596
Construct recursive-descent parsers, starting with the following grammars:
a. S → +SS ∣ −SS ∣ a
b. S → S(S)S ∣ ϵ
c. S → 0S1 ∣ 01
2.24.2 Recursive Descent Parser: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 5 (Page No. 231 - 232)
https://gateoverflow.in/318955
The grammar S → a S a ∣ a a generates all even-length strings of a′ s. We can devise a
recursive-descent parser with backtrack for this grammar. If we choose to expand by production S → a a first, then
we shall only recognize the string aa. Thus, any reasonable recursive-descent parser will try S → a S a first.
a. Show that this recursive-descent parser recognizes inputs aa, aaaa, and aaaaaaaa, but not aaaaaa.
b. What language does this recursive-descent parser recognize?
The following exercises are useful steps in the construction of a "Chomsky Normal Form" grammar from arbitrary grammars,
as defined in Question 4.4.8.
2.25.1 Specification Of Tokens: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 1 (Page No. 125)
https://gateoverflow.in/318179
Consult the language reference manuals to determine
i. the sets of characters that form the input alphabet (excluding those that may only appear in character strings or comments),
ii. the lexical form of numerical constants, and
iii. the lexical form of identifiers, for each of the following languages:
f. Lisp g. SQL
ullman compiler-design lexical-analysis specification-of-tokens descriptive
2.26.1 Strings: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 3 (Page No. 125) https://gateoverflow.in/318182
2.26.2 Strings: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 5 (Page No. 125 - 126)
https://gateoverflow.in/318184
Write regular definitions for the following languages:
a. All strings of lowercase letters that contain the five vowels in order.
b. All strings of lowercase letters in which the letters are in ascending lexicographic order.
c. Comments, consisting of a string surrounded by /* and */, without an intervening */, unless it is inside double-quotes (").
d. All strings of digits with no repeated digits. Hint: Try this problem first with a few digits, such as {0, 1, 2}.
e. All strings of digits with at most one repeated digit.
f. All strings of a's and b's with an even number of a's and an odd number of b's.
g. The set of Chess moves, in the informal notation, such as p − k4 or kbp × qn.
h. All strings of a's and b's that do not contain the substring abb.
i. All strings of a's and b's that do not contain the subsequence abb.
2.27.1 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 2.3 Question 3 (Page No. 60)
https://gateoverflow.in/317593
Construct a syntax-directed translation scheme that translates integers into roman numerals.
ullman compiler-design syntax-directed-translation
2.27.2 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 2.3 Question 4 (Page No. 60)
https://gateoverflow.in/317594
Construct a syntax-directed translation scheme that translates roman numerals into integers.
ullman compiler-design syntax-directed-translation
2.27.3 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 2.3 Question 5 (Page No. 60)
https://gateoverflow.in/317595
Construct a syntax-directed translation scheme that translates postfix arithmetic expressions into
equivalent infix arithmetic expressions.
ullman compiler-design syntax-directed-translation
2.27.4 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.2 Question 3 (Page No. 317)
https://gateoverflow.in/319933
Suppose that we have a production A → BCD . Each of the four nonterminals A, B, C, and D
have two attributes: s is a synthesized attribute, and i is an inherited attribute. For each of the sets of rules below, tell
whether
a. A. s = B. i + C. s. b. A. s = B. i + C. s and D. i = A. i + B. s.
c. A. s = B. s + D. s d. A. s = D. i, B. i = A. s + C. s, C. i = B. s, and
D. i = B. i + C. i.
ullman compiler-design syntax-directed-translation
2.27.5 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.3 Question 3 (Page No. 323)
https://gateoverflow.in/319941
Give an SDD to differentiate expressions such as x ∗ (3 ∗ x + x ∗ x) involving the operators +
and ∗, the variable x, and constants. Assume that no simplification occurs, so that, for example, 3 ∗ x will be translated
into 3 ∗ 1 + 0 ∗ x.
ullman compiler-design syntax-directed-translation
2.27.6 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 1 (Page No. 336)
https://gateoverflow.in/319942
We mentioned in Section 5.4.2 that it is possible to deduce, from the LR state on the parsing
stack, what grammar symbol is represented by the state. How would we discover this information?
ullman compiler-design syntax-directed-translation grammar descriptive
2.27.7 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 2 (Page No. 336 - 337)
https://gateoverflow.in/319943
Rewrite the following SDT:
A → A{a}B ∣ AB{b} ∣ 0
B → B{c}A ∣ BA{d} ∣ 1
so that the underlying grammar becomes non-left-recursive. Here, a, b, c, and d are actions, and 0 and 1 are terminals.
2.27.8 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 4 (Page No. 337)
https://gateoverflow.in/319947
Write L-attributed SDD's analogous to that of Example 5.19 for the following productions, each
of which represents a familiar flow-of-control construct, as in the programming language C. You may need to generate
a three address statement to jump to a particular label L, in which case you should generate goto L.
a. S → f(C)S1 else S2
b. S → do S1 while (C)
c. S →′ {′ L′ }′ ; L → LS ∣ ϵ
Note that any statement in the list can have a jump from its middle to the next statement, so it is not sufficient simply to
generate code for each statement in order.
2.27.9 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 5 (Page No. 337)
https://gateoverflow.in/319948
Write L-attributed SDT's analogous to that of Example 5.19 for the following productions, each
of which represents a familiar flow-of-control construct, as in the programming language C. You may need to generate
a three address statement to jump to a particular label L, in which case you should generate goto L.
1. S → f(C)S1 else S2
2. S → do S1 while (C)
3. S →′ {′ L′ }′ ; L → LS ∣ ϵ
Note that any statement in the list can have a jump from its middle to the next statement, so it is not sufficient simply to
generate code for each statement in order.
2.27.10 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 6 (Page No. 337)
https://gateoverflow.in/319950
Modify the SDD of Fig. 5.25 to include a synthesized attribute B. le , the length of a box. The
length of the concatenation of two boxes is the sum of the lengths of each. Then add your new rules to the proper
positions in the SDT of Fig. 5.26.
ullman compiler-design syntax-directed-translation grammar descriptive
2.27.11 Syntax Directed Translation: Ullman (Compiler Design) Edition 2 Exercise 5.4 Question 7 (Page No. 337)
https://gateoverflow.in/319951
Modify the SDD of Fig. 5.25 to include superscripts denoted by operator sup between boxes. If
box B2 is a superscript of box B1 , then position the baseline of B2 0.6 times the point size of B1 above the baseline
of B1 . Add the new production and rules to the SDT of Fig. 5.26.
ullman compiler-design syntax-directed-translation grammar descriptive
2.28.1 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 2.8 Question 1 (Page No. 105)
https://gateoverflow.in/317602
For-statements in C and Java have the form:
for (exprl ; expr2 ; expr3 )stmt
The first expression is executed before the loop; it is typically used for initializing the loop index. The second expression is a
test made before each iteration of the loop; the loop is exited if the expression becomes 0. The loop itself can be thought of as
the statement {strmt expr3 ; }. The third expression is executed at the end of each iteration; it is typically used to increment
the loop index. The meaning of the for-statement is similar to expr1 ; while(expr2) {stmt expr3 ; }
Define a class For for for-statements, similar to class If in Fig. 2.43
2.28.2 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 2.8 Question 2 (Page No. 105)
https://gateoverflow.in/317603
The programming language C does not have a boolean type. Show how a C compiler might
translate an if-statement into three-address code.
ullman compiler-design three-address-code
2.28.3 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.1 Question 1 (Page No. 362)
https://gateoverflow.in/320005
Construct the DAG for the expression
((x + y) − ((x + y) ∗ (x − y))) + ((x + y) ∗ (x − y))
ullman compiler-design three-address-code dag descriptive
2.28.4 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.1 Question 2 (Page No. 363)
https://gateoverflow.in/320006
Construct the DAG and identify the value numbers for the subexpressions of the following
expressions, assuming + associates from the left.
a. a + b + (a + b)
b. a + b + a + b
c. a + a + ((a + a + a + (a + a + a + a))
ullman compiler-design three-address-code dag descriptive
2.28.5 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.2 Question 1 (Page No. 370)
https://gateoverflow.in/320007
Translate the arithmetic expression a + −(b + c) into:
2.28.6 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.2 Question 2 (Page No. 370)
https://gateoverflow.in/320008
Translate the following arithmetic expression into:
i. a = b[i] + c[j]
ii. a[i] = b ∗ c − b ∗ d
iii. x = f(y + 1) + 2
iv. x = ∗p + &y
2.28.7 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.2 Question 3 (Page No. 370)
https://gateoverflow.in/320009
Show how to transform a three-address code sequence into one in which each defined variable
gets a unique variable name.
ullman compiler-design three-address-code intermediate-code descriptive
2.28.8 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.3 Question 1 (Page No. 378)
https://gateoverflow.in/320010
Determine the types and relative addresses for the identifiers in the following sequence of
declarations:
float x;
record { float x; float y; } p;
record { int tag; float x; float y; } q;
2.28.9 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.3 Question 2 (Page No. 378)
https://gateoverflow.in/320012
Extend the handling of field names in Fig. 6.18 to classes and single-inheritance class
hierarchies.
a. Give an implementation of class Enu that allows linked symbol tables, so that a subclass can either redefine a field name
or refer directly to a field name in a superclass.
b. Give a translation scheme that allocates a contiguous data area for the fields in a class, including inherited fields. Inherited
fields must maintain the relative addresses they were assigned in the layout for the superclass.
2.28.10 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 1 (Page No. 384)
https://gateoverflow.in/320013
Add to the translation of Fig. 6.19 rules for the following productions:
E → E1 ∗ E2
E → +E1 (unary plus)
2.28.11 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 2 (Page No. 384)
https://gateoverflow.in/320014
Add to the translation of Fig. 6.19 rules for the following productions:
E → E1 ∗ E2
E → +E1 (unary plus)
2.28.12 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 3 (Page No. 385)
https://gateoverflow.in/320015
Use the translation of Fig. 6.22 to translate the following assignments:
a. x = a[i] + b[j]
b. x = a[i][j] + b[i][j]
c. x = a[b[i][j]][c[[k]]
ullman compiler-design intermediate-code three-address-code descriptive
2.28.13 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 4 (Page No. 385)
https://gateoverflow.in/320016
Revise the translation of Fig. 6.22 for array references of the Fortran style, that is,
id[E1 , E2 , ⋅ ⋅ ⋅, En ] for an n−dimensional array.
2.28.14 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 5 (Page No. 385 - 386)
https://gateoverflow.in/320019
Generalize formula (6.7) to multidimensional arrays, and indicate what values can be stored in
the symbol table and used to compute offsets. Consider the following cases:
a. An array A of two dimensions, in row-major form. The first dimension has indexes running from l1 to hl , and the second
dimension has indexes from l2 to h2 . The width of a single array element is w.
b. The same as (a), but with the array stored in column-major form.
c. An array A of k dimensions, stored in row-major form, with elements of
d. size w. The jth dimension has indexes running from lj to hj .The same as (c) but with the array stored in column-major
form.
2.28.15 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 6 (Page No. 386)
https://gateoverflow.in/320020
An integer array A[i, j] has index i ranging from 1 to 10 and index j ranging from 1 to 20.
Integers take 4 bytes each. Suppose array A is stored starting at byte 0. Find the location of:
a. A[4, 5]
b. A[10, 8]
c. A[3, 17]
2.28.16 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 7 (Page No. 386)
https://gateoverflow.in/320021
An integer array A[i, j] has index i ranging from 1 to 10 and index j ranging from 1 to 20.
Integers take 4 bytes each. Suppose array A is stored starting at byte 0. Find the location of:
a. A[4, 5]
b. A[10, 8]
c. A[3, 17]
2.28.17 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 8 (Page No. 386)
https://gateoverflow.in/320024
A real array A[i, j, k] has index i ranging from 1 to 4, index j ranging from 0 to 4, and index k
ranging from 5 to 10. Reals take 8 bytes each. Suppose array A is stored starting at byte 0. Find the location of:
a. A[3, 4, 5]
b. A[1, 2, 7]
c. A[4, 3, 9]
2.28.18 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.4 Question 9 (Page No. 386)
https://gateoverflow.in/320025
A real array A[i, j, k] has index i ranging from 1 to 4, index j ranging from 0 to 4, and index k
ranging from 5 to 10. Reals take 8 bytes each. Suppose array A is stored starting at byte 0. Find the location of:
a. A[3, 4, 5]
b. A[1, 2, 7]
c. A[4, 3, 9]
2.28.19 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.5 Question 1 (Page No. 398)
https://gateoverflow.in/320026
Assuming that function widen in Fig. 6.26 can handle any of the types in the hierarchy of Fig.
6.25(a), translate the expressions below. Assume that c and d are characters, s and t are short integers, i and j are
integers, and x is a float.
a. x = s + c
b. i = s + c
c. x = (s + c) ∗ (t + d)
2.28.20 Three Address Code: Ullman (Compiler Design) Edition 2 Exercise 6.5 Question 2 (Page No. 399)
https://gateoverflow.in/320030
As in Ada, suppose that each expression must have a unique type, but that from a subexpression,
by itself, all we can deduce is a set of possible types. That is, the application of function E1 to argument E2 ,
represented by E → El (E2 ) , has the associated rule
Describe an SDD that determines a unique type for each subexpression by using an attribute type to synthesize a set of
possible types bottom-up, and, once the unique type of the overall expression is determined, proceeds top-down to determine
attribute unique for the type of each subexpression.
ullman compiler-design intermediate-code three-address-code descriptive
2.29.1 Ullman: Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 5 (Page No. 52) https://gateoverflow.in/317588
Show that all binary strings generated by the following grammar have
a. values divisible by 3. Hint. Use induction on the number of nodes in a parse tree.
b. Does the grammar generate all binary strings with values divisible by 3?
2.29.2 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 10 (Page No. 127)
https://gateoverflow.in/318190
The operator ^ matches the left end of a line, and $ matches the right end of a line. The operator
^ is also used to introduce complemented character classes, but the context always makes it clear which meaning is
intended. For example, ^ [^aeiou]* $ matches any complete line that does not contain a lowercase vowel.
2.29.3 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 11 (Page No. 127 - 128)
https://gateoverflow.in/318192
The UNIX shell command sh uses the operators in Fig. 3.9 in filename expressions to describe
sets of file names. For example, the filename expression *.o matches all filenames ending in. o; sort 1. ? matches all
filenames of the form sort. c, where c is any character. Show how sh filename expressions can be replaced by equivalent
regular expressions using only the basic union, concatenation, and closure operators.
2.29.4 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 12 (Page No. 128)
https://gateoverflow.in/318193
SQL allows a rudimentary form of patterns in which two characters have special meaning:
underscore (_) stands for any one character and percent-sign (%) stands for any string of 0 or more characters. In
addition, the programmer may define any character, say e, to be the escape character, so e preceding an e preceding -, %, or
another e gives the character that follows its literal meaning. Show how to express any SQL pattern as a regular expression,
given that we know which character is the escape character.
ullman compiler-design regular-expressions descriptive
2.29.5 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 2 (Page No. 125) https://gateoverflow.in/318181
a. a(a ∣ b)∗ a.
b. ((ϵ ∣ a)b∗ )∗ .
c. (a ∣ b)∗ a(a ∣ b)(a ∣ b).
d. a∗ ba∗ ba∗ ba∗ .
e. (aa ∣ bb)∗ ((ab ∣ ba)(aa ∣ bb)∗ (ab ∣ ba)(aa ∣ bb)∗ )∗ .
2.29.6 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 6 (Page No. 126) https://gateoverflow.in/318186
a. The first ten letters (up to "j" ) in either upper or lower case.
b. The lowercase consonants.
c. The "digits" in a hexadecimal number (choose either upper or lower case for the "digits" above 9).
d. The characters that can appear at the end of a legitimate English sentence (e.g., exclamation point).
The following exercises, up to and including Exercise 3.3.10, discuss the extended regular-expression notation from Lex (the
lexical-analyzer generator that we shall discuss extensively in Section 3.5). The extended notation is listed in Fig. 3.8.
2.29.7 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 7 (Page No. 126) https://gateoverflow.in/318187
2.29.8 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 8 (Page No. 126 - 127)
https://gateoverflow.in/318188
In Lex, a complemented character class represents any character except the ones listed in the
character class. We denote a complemented class by using ^ as the first character; this symbol (caret) is not itself part
of the class being complemented, unless it is listed within the class itself. Thus, [^ A-Za-z] matches any character that is not an
uppercase or lowercase letter, and [^\^] represents any character but the caret (or newline, since newline cannot be in any
character class). Show that for every regular expression with complemented character classes, there is an equivalent regular
expression without complemented character classes.
ullman compiler-design regular-expressions descriptive
2.29.9 Ullman: Ullman (Compiler Design) Edition 2 Exercise 3.3 Question 9 (Page No. 127) https://gateoverflow.in/318189
The regular expression r{m, n} matches from m to n occurrences of the pattern r. For example, a[1, 5] matches a
string of one to five a's. Show that for every regular expression containing repetition operators of this form, there is an
equivalent regular expression without repetition operators.
ullman compiler-design regular-expressions descriptive
2.29.10 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 4 (Page No. 207 - 208)
https://gateoverflow.in/318764
There is an extended grammar notation in common use. In this notation, square and curly braces
in production bodies are metasymbols (like → or ∣) with the following meanings:
i. Square braces around a grammar symbol or symbols denotes that these constructs are optional. Thus, production
A → X[Y ]Z has the same effect as the two productions A → XY Z and A → XZ .
ii. Curly braces around a grammar symbol or symbols says that these symbols may be repeated any number of times,
including zero times. Thus,A → X{Y Z} has the same effect as the infinite sequence of productions
A → X, A → XY Z, A → XY ZY Z ,and so on.
Show that these two extensions do not add power to grammars; that is, any language that can be generated by a grammar with
these extensions can be generated by a grammar without the extensions.
2.29.11 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 5 (Page No. 208)
https://gateoverflow.in/318766
Use the braces described in Question 4.2.4 to simplify the following grammar for statement
blocks and conditional statements:
2.29.12 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 6 (Page No. 208)
https://gateoverflow.in/318768
Extend the idea of Question 4.2.4 to allow any regular expression of grammar symbols in the
body of a production. Show that this extension does not allow grammars to define any new languages.
ullman compiler-design grammar descriptive
2.29.13 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 7 (Page No. 208)
https://gateoverflow.in/318769
A grammar symbol X (terminal or nonterminal) is useless if there is no derivation of the form
∗ ∗
S ⇒ wXy ⇒ wxy . That is, X can never appear in the derivation of any sentence.
a. Give an algorithm to eliminate from a grammar all productions containing useless symbols.
b. Apply your algorithm to the grammar:
S→0∣A
A → AB
B→1
2.29.14 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 8 (Page No. 208 - 209)
https://gateoverflow.in/318776
The grammar in Fig. 4.7 generates declarations for a single numerical identifier; these
declarations involve four different, independent properties of numbers.
a. Generalize the grammar of Fig. 4.7 by allowing n options Ai , for some fixed n and for i = 1, 2 ⋅ ⋅⋅, n , where Ai can be
either ai or bi . Your grammar should use only O(n) grammar symbols and have a total length of productions that is
O(n).
b. The grammar of Fig. 4.7 and its generalization in part (a) allow declarations that are contradictory and/or redundant, such
as: declare foo real fixed real floating. We could insist that the syntax of the language forbid such declarations; that is,
every declaration generated by the grammar has exactly one value for each of the n options. If we do, then for any fixed n
there is only a finite number of legal declarations. The language of legal declarations thus has a grammar (and also a
regular expression), as any finite language does. The obvious grammar, in which the start symbol has a production for
every legal declaration has n! productions and a total production length of O(n × n!). You must do better: a total
production length that is (n2n ).
c. Show that any grammar for part (b) must have a total production length of at least 2n .
d. What does part (c) say about the feasibility of enforcing nonredundancy and noncontradiction among options in
declarations via the syntax of the programming language?
2.29.15 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.3 Question 3 (Page No. 217)
https://gateoverflow.in/318950
The following grammar is proposed to remove the "danglingelse ambiguity" discussed in
Section 4.3.2:
2.29.16 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 11 (Page No. 233)
https://gateoverflow.in/318963
Modify your algorithm of Question 4.4.9 so that it will find, for any string, the smallest number
of insert, delete, and mutate errors (each error a single character) needed to turn the string into a string in the language
of the underlying grammar.
ullman compiler-design grammar descriptive
2.29.17 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 6 (Page No. 232)
https://gateoverflow.in/318956
A grammar is ϵ-free if no production body is ϵ (called an ϵ-production).
a. Give an algorithm to convert any grammar into an ϵ-free grammar that generates the same language (with the possible
exception of the empty string - no ϵ-free grammar can generate ϵ).
b. Apply your algorithm to the grammar S → aSbS ∣ bSaS ∣ ϵ . Hint: First find all the nonterminals that are nullable,
meaning that they generate ϵ, perhaps by a long derivation.
2.29.18 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 7 (Page No. 232)
https://gateoverflow.in/318958
A single production is a production whose body is a single nonterminal, i.e., a production of the
form A → A .
a. Give an algorithm to convert any grammar into an ϵ-free grammar, with no single productions, that generates the same
language (with the possible exception of the empty string) Hint: First eliminate ϵ-productions, and then find for which pairs
∗
of nonterminals A and B does A ⇒ B by a sequence of single productions.
b. Apply your algorithm to the grammar
E→E+T ∣T
T →T ∗F ∣F
F → (E) ∣ id
c. Show that, as a consequence of part (a), we can convert a grammar into an equivalent grammar that has no cycles
∗
(derivations of one or more steps in which A ⇒ A for some nonterminal A).
2.29.19 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.5 Question 1 (Page No. 240)
https://gateoverflow.in/318965
For the grammar S → 0 S 1 ∣ 0 1 of Question 4.2.2(a),indicate the handle in each of the
following right-sentential forms:
a. 000111
b. 00S11
2.29.20 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 3 (Page No. 258)
https://gateoverflow.in/318972
Show the actions of your parsing table from Question 4.6.2 on the input aa ∗ a+.
ullman compiler-design parsing descriptive
2.29.21 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.7 Question 2 (Page No. 278)
https://gateoverflow.in/318982
Repeat Exercise 4.7.1 for each of the (augmented) grammars of Exercise 4.2.2(a) − (g).
2.29.22 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.7 Question 3 (Page No. 278)
https://gateoverflow.in/318983
For the grammar of Exercise 4.7.1, use Algorithm 4.63 to compute the collection of LALR sets
of items from the kernels of the LR(0) sets of items.
2.29.23 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.7 Question 4 (Page No. 278)
https://gateoverflow.in/318984
Show that the following grammar
S → Aa ∣ bAc ∣ dc ∣ bda
A→d
is LALR(1) but not SLR(1).
2.29.24 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.7 Question 5 (Page No. 278)
https://gateoverflow.in/318985
Show that the following grammar
S → Aa ∣ bAc ∣ Bc ∣ bBa
A→d
B→d
is LR(1) but not LALR(1).
2.29.25 Ullman: Ullman (Compiler Design) Edition 2 Exercise 4.8 Question 1 (Page No. 285 - 286)
https://gateoverflow.in/318986
The following is an ambiguous grammar for expressions with n binary, infix operators, at n
different levels of precedence:
d. Repeat parts (a) and (c) for the unambiguous grammar, which defines the same set of expressions, shown in Fig. 4.55.
e. How do the counts of the number of sets of items and the sizes of the tables for the two (ambiguous and unambiguous)
grammars compare? What does that comparison tell you about the use of ambiguous expression grammars?
ullman compiler-design grammar ambiguous parsing
2.30.1 Viable Prefix: Ullman (Compiler Design) Edition 2 Exercise 4.6 Question 1 (Page No. 257 - 258)
https://gateoverflow.in/318968
Describe all the viable prefixes for the following grammars:
2.31.1 Yacc: Ullman (Compiler Design) Edition 2 Exercise 4.9 Question 1 (Page No. 297) https://gateoverflow.in/318988
Write a Y acc program that takes boolean expressions as input [as given by the grammar of Question 4.2.2(g)] and
produces the truth value of the expressions.
ullman compiler-design grammar yacc descriptive
2.31.2 Yacc: Ullman (Compiler Design) Edition 2 Exercise 4.9 Question 2 (Page No. 297) https://gateoverflow.in/318990
Write a Y acc program that takes lists (as defined by the grammar of Question 4.2.2(e), but with any single character
as an element, not just a) and produces as output a linear representation of the same list; i.e., a single list of the
elements, in the same order that they appear in the input.
ullman compiler-design grammar yacc descriptive
2.31.3 Yacc: Ullman (Compiler Design) Edition 2 Exercise 4.9 Question 3 (Page No. 297) https://gateoverflow.in/318989
Write a Y acc program that tells whether its input is a palindrome (sequence of characters that read the same forward
and backward).
ullman compiler-design grammar yacc descriptive
2.31.4 Yacc: Ullman (Compiler Design) Edition 2 Exercise 4.9 Question 4 (Page No. 297) https://gateoverflow.in/318991
Write a Y acc program that takes regular expressions (as defined by the grammar of Question 4.2.2(d), but with any
single character as an argument, not just a) and produces as output a transition table for a nondeterministic finite
automaton recognizing the same language.
ullman compiler-design grammar yacc descriptive
Answer Keys
2.1.1 N/A 2.2.1 Q-Q 2.3.1 N/A 2.4.1 N/A 2.5.1 Q-Q
2.5.2 Q-Q 2.5.3 Q-Q 2.5.4 Q-Q 2.5.5 Q-Q 2.5.6 N/A
2.5.7 N/A 2.6.1 N/A 2.7.1 Q-Q 2.8.1 N/A 2.8.2 N/A
2.9.1 N/A 2.10.1 N/A 2.11.1 Q-Q 2.12.1 Q-Q 2.12.2 Q-Q
2.12.3 Q-Q 2.12.4 Q-Q 2.12.5 N/A 2.12.6 Q-Q 2.12.7 Q-Q
2.12.8 Q-Q 2.12.9 Q-Q 2.12.10 Q-Q 2.13.1 N/A 2.13.2 N/A
2.13.3 N/A 2.13.4 N/A 2.14.1 N/A 2.15.1 Q-Q 2.15.2 Q-Q
2.16.1 Q-Q 2.16.2 Q-Q 2.16.3 Q-Q 2.17.1 N/A 2.17.2 N/A
2.18.1 N/A 2.18.2 N/A 2.18.3 N/A 2.18.4 N/A 2.19.1 N/A
2.20.1 Q-Q 2.21.1 Q-Q 2.21.2 Q-Q 2.21.3 N/A 2.21.4 N/A
2.21.5 Q-Q 2.21.6 Q-Q 2.21.7 Q-Q 2.21.8 Q-Q 2.21.9 Q-Q
2.22.1 Q-Q 2.23.1 N/A 2.23.2 N/A 2.24.1 Q-Q 2.24.2 N/A
2.25.1 N/A 2.26.1 N/A 2.26.2 N/A 2.27.1 Q-Q 2.27.2 Q-Q
2.27.3 Q-Q 2.27.4 Q-Q 2.27.5 Q-Q 2.27.6 N/A 2.27.7 N/A
2.27.8 N/A 2.27.9 N/A 2.27.10 N/A 2.27.11 N/A 2.28.1 Q-Q
2.28.2 Q-Q 2.28.3 N/A 2.28.4 N/A 2.28.5 N/A 2.28.6 N/A
2.28.7 N/A 2.28.8 N/A 2.28.9 N/A 2.28.10 N/A 2.28.11 N/A
2.28.12 N/A 2.28.13 N/A 2.28.14 N/A 2.28.15 N/A 2.28.16 N/A
2.28.17 N/A 2.28.18 N/A 2.28.19 N/A 2.28.20 N/A 2.29.1 Q-Q
2.29.2 N/A 2.29.3 N/A 2.29.4 N/A 2.29.5 N/A 2.29.6 N/A
2.29.7 N/A 2.29.8 N/A 2.29.9 N/A 2.29.10 N/A 2.29.11 N/A
2.29.12 N/A 2.29.13 N/A 2.29.14 N/A 2.29.15 N/A 2.29.16 N/A
2.29.17 N/A 2.29.18 N/A 2.29.19 N/A 2.29.20 N/A 2.29.21 N/A
2.29.22 N/A 2.29.23 N/A 2.29.24 N/A 2.29.25 Q-Q 2.30.1 N/A
2.31.1 N/A 2.31.2 N/A 2.31.3 N/A 2.31.4 N/A
3 Computer Networks (17)
3.1.1 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 1 (Page No. 284) https://gateoverflow.in/306318
3.1.2 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 10 (Page No. 284) https://gateoverflow.in/306328
3.1.3 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 11 (Page No. 284) https://gateoverflow.in/306329
3.1.4 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 12 (Page No. 284) https://gateoverflow.in/306331
Let L1 be recursive and L2 recursively enumerable. Show that L2 − L1 is necessarily recursively enumerable.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.5 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 2 (Page No. 284) https://gateoverflow.in/306319
Prove that the set of all languages that are not recursively enumerable is not countable.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.6 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 3 (Page No. 284) https://gateoverflow.in/306321
Let L be a finite language. Show that then L+ is recusively enumerable. Suggest an enumeration procedure for L+
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.7 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 4 (Page No. 284) https://gateoverflow.in/306322
Let L be a context-free language. Show that then L+ is recusively enumerable. Suggest an enumeration procedure for
it.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.8 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 5 (Page No. 284) https://gateoverflow.in/306323
Show that if a language is not recursively enumerable, its complement cannot be recursive.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.9 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 6 (Page No. 284) https://gateoverflow.in/306324
Show that the family of recursively enumerable languages is closed under union.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.10 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 7 (Page No. 284) https://gateoverflow.in/306325
3.1.11 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 8 (Page No. 284) https://gateoverflow.in/306326
Show that the family of recursive languages is closed under union and intersection.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.12 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 9 (Page No. 284) https://gateoverflow.in/306327
Show that the families of recursively enumerable and recursive languages are closed under reversal.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
3.1.13 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 3 (Page No. 321) https://gateoverflow.in/306300
Show that for arbitrary context-free grammars G1 and G2 , the problem ”L(G1 ) ∩ L(G2 ) is context-free” is
undecidable.
peter-linz peter-linz-edition5 theory-of-computation decidability proof difficult
3.1.14 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 4 (Page No. 321) https://gateoverflow.in/306301
Theorem : There exist no algorithms for deciding whether any given context-free grammar is ambiguous.
Show that if the language L(GA ) ∩ L(GB ) in Theorem is regular, then it must be empty. Use this to show that the problem
“L(G) is regular ” is undecidable for context-free G.
peter-linz peter-linz-edition5 theory-of-computation decidability proof difficult
3.1.15 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 8 (Page No. 321) https://gateoverflow.in/306307
Let G1 and G2 be grammars with G1 regular. Is the problem L(G1 ) = L(G2 ) decidable when
(a) G2 is unrestricted,
3.1.16 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.5 Question 1 (Page No. 323) https://gateoverflow.in/306313
3.1.17 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.5 Question 2 (Page No. 323) https://gateoverflow.in/306314
Answer Keys
3.1.1 N/A 3.1.2 N/A 3.1.3 N/A 3.1.4 N/A 3.1.5 N/A
3.1.6 N/A 3.1.7 N/A 3.1.8 N/A 3.1.9 N/A 3.1.10 N/A
3.1.11 N/A 3.1.12 N/A 3.1.13 N/A 3.1.14 N/A 3.1.15 N/A
3.1.16 N/A 3.1.17 N/A
4 Discrete Mathematics: Combinatory (416)
4.1.1 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 1 (Page No. 421) https://gateoverflow.in/338641
4.1.2 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 10 (Page No. 421)
https://gateoverflow.in/338661
Give a formula for the coefficient of xk in the expansion of (x + 1 100 ,
x) where k is an integer.
4.1.3 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 11 (Page No. 421)
https://gateoverflow.in/338662
Give a formula for the coefficient of xk in the expansion of (x2 − 1 100 ,
x) where k is an integer.
4.1.4 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 12 (Page No. 421)
https://gateoverflow.in/338709
The row of Pascal’s triangle containing the binomial coefficients
(10
k ), 0 ≤ k ≤ 10, is: 1 10 45 120 210 252 210 120 45 10 1 Use Pascal’s identity to produce the row
immediately following this row in Pascal’s triangle.
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.5 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 13 (Page No. 421)
https://gateoverflow.in/338710
What is the row of Pascal’s triangle containing the binomial coefficients (k9), 0 ≤ k ≤ 9?
4.1.6 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 14 (Page No. 421)
https://gateoverflow.in/338711
Show that if n is a positive integer, then
1 = (n0) < (n1) < ⋯ < (⌊nn/2⌋) = (⌈nn/2⌉) > … (n−1
n
) > (nn) = 1.
4.1.7 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 15 (Page No. 421)
https://gateoverflow.in/338712
Show that (nk) ≤ 2n for all positive integers n and all integers k with 0 ≤ k ≤ n.
4.1.8 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 16 (Page No. 421)
https://gateoverflow.in/338713
A. Use question 14 and Corollary 1 to show that if n is an integer greater than 1, then (⌊nn/2⌋) ≥ 2n .
2
B. Conclude from part (A) that if n is a positive integer, then (2n
n) ≥ 4n
2n .
4.1.9 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 17 (Page No. 421)
https://gateoverflow.in/338715
Show that if n and k are integers with 1 ≤ k ≤ n, then (nk) ≤ nk .
2k−1
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.10 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 18 (Page No. 421)
https://gateoverflow.in/338716
Suppose that b is an integer with b ≥ 7. Use the binomial theorem and the appropriate row of
Pascal’s triangle to find the base- b expansion of (11)4b [that is, the fourth power of the number (11)b in base- b
notation].
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.11 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 19 (Page No. 421)
https://gateoverflow.in/338717
Prove Pascal’s identity, using the formula for (nr).
4.1.12 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 2 (Page No. 421)
https://gateoverflow.in/338642
Find the expansion of (x + y)5
4.1.13 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 20 (Page No. 421)
https://gateoverflow.in/338718
Suppose and n are integers with 1 ≤ k < n. Prove the hexagon identity
that k
(n−1)( n
k−1 k+1 )(n+1
k ) = (n−1 n n+1
k )(k−1)(k+1), which relates terms in Pascal’s triangle that form a hexagon.
4.1.14 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 21 (Page No. 422)
https://gateoverflow.in/338719
Prove that if n and k are integers with 1 ≤ k ≤ n, then k(nk) = n(n−1
k−1),
A. using a combinatorial proof. [Hint: Show that the two sides of the identity count the number of ways to select a subset with
k elements from a set with n elements and then an element of this subset.]
B. using an algebraic proof based on the formula for (nr) given in Theorem 2 in Section 6.3.
4.1.15 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 22 (Page No. 422)
https://gateoverflow.in/338720
Prove the identity (nr)(kr) = (nk)(n−k
r−k ), whenever n, r, and k are nonnegative integers with
r ≤ n and k ≤ r,
A. using a combinatorial argument.
B. using an argument based on the formula for the number of r-combinations of a set with n elements.
4.1.16 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 23 (Page No. 422)
https://gateoverflow.in/338723
n
(n + 1)(k–1)
Show that if n and k are positive integers, then (n+1
k ) = . Use this identity to
k
construct an inductive definition of the binomial coefficients.
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.17 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 24 (Page No. 422)
https://gateoverflow.in/338724
Show that if p is a prime and k is an integer such that 1 ≤ k ≤ p − 1, then p divides (kp).
2n
(2n+2
n+1 )
Let n be a positive integer. Show that (n+1 ) + (2n
n) = .
2
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.19 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 26 (Page No. 422)
https://gateoverflow.in/338732
(2n+2) 2n n
Let n and k be integers with 1 ≤ k ≤ n. Show that ∑ ( )( ) = n+1 − ( ).
n n
k=1
k k−1 2 n
4.1.20 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 27 (Page No. 422)
https://gateoverflow.in/338733
r
n+k n+r+1
Prove the hockeystick identity ∑ ( )=( ) whenever n and r are positive
k=0
k r
integers,
4.1.21 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 28 (Page No. 422)
https://gateoverflow.in/338735
Show that if n is a positive integer, then (2n n
2 ) = 2 ( 2) + n
2
4.1.22 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 29 (Page No. 422)
https://gateoverflow.in/338736
n
Give a combinatorial proof that ∑ k( ) = n2n−1 . [Hint: Count in two ways the number of
n
k=1
k
ways to select a committee and to then select a leader of the committee.]
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.23 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 3 (Page No. 421)
https://gateoverflow.in/338654
Find the expansion of (x + y)6 .
4.1.24 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 30 (Page No. 422)
https://gateoverflow.in/338737
n 2 2n − 1n
Give a combinatorial proof that ∑ k( ) = n( ). [Hint: Count in two ways the
k=1
k n−1
number of ways to select a committee, with n members from a group of n mathematics professors and n computer science
professors, such that the chairperson of the committee is a mathematics professor.]
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.25 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 31 (Page No. 422)
https://gateoverflow.in/338738
Show that a nonempty set has the same number of subsets with an odd number of elements as it
does subsets with an even number of elements.
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.26 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 32 (Page No. 422)
https://gateoverflow.in/338739
Prove the binomial theorem using mathematical induction.
kenneth-rosen discrete-mathematics counting binomial-theorem proof
4.1.27 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 33 (Page No. 422)
https://gateoverflow.in/338740
In this exercise we will count the number of paths in the xy plane between the origin (0, 0) and
point (m, n), where m and n are nonnegative integers, such that each path is made up of a series of steps, where each
step is a move one unit to the right or a move one unit upward. (No moves to the left or downward are allowed.) Two such
paths from (0, 0) to (5, 3) are illustrated here.
A. Show that each path of the type described can be represented by a bit string consisting of m 0s and n 1s, where a 0
represents a move one unit to the right and a 1 represents a move one unit upward.
B. Conclude from part (A) that there are (m+nn ) paths of the desired type.
4.1.28 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 34 (Page No. 422)
https://gateoverflow.in/338742
Use question 33 to give an alternative proof of Corollary 2 in Section 6.3, which states that
(nk) = (n−k
n
) whenever k is an integer with 0 ≤ k ≤ n. [ Hint: Consider the number of paths of the type described in
question 33 from (0, 0) to (n − k, k) and from (0, 0) to (k, n − k). ]
4.1.29 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 35 (Page No. 422)
https://gateoverflow.in/338743
Use question 33 to prove Theorem 4. [Hint: Count the number of paths with n steps of the type
described in question 33. Every such path must end at one of the points (n − k, k) for k = 0, 1, 2, … , n. ]
4.1.30 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 36 (Page No. 422)
https://gateoverflow.in/338744
Use question 33 to prove Pascal’s identity. [Hint: Show that a path of the type described in
question 33 from (0, 0) to (n + 1 − k, k) passes through either (n + 1 − k, k − 1) or (n − k, k), but not through
both.]
kenneth-rosen discrete-mathematics counting binomial-theorem descriptive
4.1.31 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 37 (Page No. 422)
https://gateoverflow.in/338745
Use question 33 to prove the hockeystick identity from question 27. [Hint: First, note that the
number of paths from (0, 0) to (n + 1, r) equals (n+1+rr ). Second, count the number of paths by summing the number
of these paths that start by going k units upward for k = 0, 1, 2, … , r. ]
4.1.32 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 38 (Page No. 422)
https://gateoverflow.in/338746
n
Give a combinatorial proof that if n is a positive integer then ∑ k2 ( ) = n(n + 1)2n−2 . [Hint: Show that both sides count
n
k=0
k
the ways to select a subset of a set of n elements together with two not necessarily distinct elements from this subset.
Furthermore, express the right-hand side as n(n − 1)2n−2 + n2n−1 . ]
4.1.33 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 39 (Page No. 422 - 423)
https://gateoverflow.in/338747
Determine a formula involving binomial coefficients for the nth term of a sequence if its initial
terms are those listed. [Hint: Looking at Pascal’s triangle will be helpful. Although infinitely many sequences start with
a specified set of terms, each of the following lists is the start of a sequence of the type desired.]
4.1.34 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 4 (Page No. 421)
https://gateoverflow.in/338655
Find the coefficient of x5 y 8 in (x + y)13 .
4.1.35 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 5 (Page No. 421)
https://gateoverflow.in/338656
How many terms are there in the expansion of (x + y)100 after like terms are collected?
4.1.36 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 6 (Page No. 421)
https://gateoverflow.in/338657
What is the coefficient of x7 in (1 + x)11 ?
4.1.37 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 7 (Page No. 421)
https://gateoverflow.in/338658
What is the coefficient of x9 in (2 − x)19 ?
4.1.38 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 8 (Page No. 421)
https://gateoverflow.in/338659
What is the coefficient of x8 y 9 in the expansion of (3x + 2y)17 ?
4.1.39 Binomial Theorem: Kenneth Rosen Edition 7 Exercise 6.4 Question 9 (Page No. 421)
https://gateoverflow.in/338660
What is the coefficient of x101 y 99 in the expansion of (2x − 3y)200 ?
4.2.1 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 1 (Page No. 396) https://gateoverflow.in/338086
There are 18 mathematics majors and 325 computer science majors at a college.
A. In how many ways can two representatives be picked so that one is a mathematics major and the other is a computer
science major?
B. In how many ways can one representative be picked who is either a mathematics major or a computer science major?
kenneth-rosen discrete-mathematics counting descriptive
4.2.2 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 10 (Page No. 396) https://gateoverflow.in/338098
4.2.3 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 11 (Page No. 396) https://gateoverflow.in/338099
How many bit strings of length ten both begin and end with a 1?
kenneth-rosen discrete-mathematics counting descriptive
4.2.4 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 12 (Page No. 396) https://gateoverflow.in/338100
How many bit strings are there of length six or less, not counting the empty string?
kenneth-rosen discrete-mathematics counting descriptive
4.2.5 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 13 (Page No. 396) https://gateoverflow.in/338101
How many bit strings with length not exceeding n, where n is a positive integer, consist entirely of 1s, not counting
the empty string?
kenneth-rosen discrete-mathematics counting descriptive
4.2.6 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 14 (Page No. 396) https://gateoverflow.in/338102
. How many bit strings of length n, where n is a positive integer, start and end with 1s?
kenneth-rosen discrete-mathematics counting descriptive
4.2.7 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 15 (Page No. 396) https://gateoverflow.in/338103
How many strings are there of lowercase letters of length four or less, not counting the empty string?
kenneth-rosen discrete-mathematics counting descriptive
4.2.8 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 16 (Page No. 396) https://gateoverflow.in/338104
How many strings are there of four lowercase letters that have the letter x in them?
kenneth-rosen discrete-mathematics counting descriptive
4.2.9 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 17 (Page No. 396) https://gateoverflow.in/338108
How many strings of five ASCII characters contain the character @ (“at” sign) at least once? [Note: There are 128
different ASCII characters.
kenneth-rosen discrete-mathematics counting descriptive
4.2.10 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 18 (Page No. 396) https://gateoverflow.in/338109
4.2.11 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 19 (Page No. 396) https://gateoverflow.in/338110
An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?
kenneth-rosen discrete-mathematics counting descriptive
4.2.13 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 20 (Page No. 396) https://gateoverflow.in/338111
4.2.14 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 21 (Page No. 396) https://gateoverflow.in/338112
4.2.15 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 22 (Page No. 396) https://gateoverflow.in/338113
4.2.16 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 23 (Page No. 396) https://gateoverflow.in/338114
4.2.17 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 24 (Page No. 396) https://gateoverflow.in/338116
4.2.18 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 25 (Page No. 397) https://gateoverflow.in/338117
4.2.20 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 27 (Page No. 397) https://gateoverflow.in/338386
A committee is formed consisting of one representative from each of the 50 states in the United States, where the
representative from a state is either the governor or one of the two senators from that state. How many ways are there to
form this committee?
kenneth-rosen discrete-mathematics counting descriptive
4.2.21 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 28 (Page No. 397) https://gateoverflow.in/338387
How many license plates can be made using either three digits followed by three uppercase English letters or three
uppercase English letters followed by three digits?
kenneth-rosen discrete-mathematics counting descriptive
4.2.22 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 29 (Page No. 397) https://gateoverflow.in/338388
How many license plates can be made using either two uppercase English letters followed by four digits or two digits
followed by four uppercase English letters?
kenneth-rosen discrete-mathematics counting descriptive
4.2.23 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 3 (Page No. 396) https://gateoverflow.in/338091
A multiple-choice test contains 10 questions. There are four possible answers for each question.
A. In how many ways can a student answer the questions on the test if the student answers every question?
B. In how many ways can a student answer the questions on the test if the student can leave answers blank?
4.2.24 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 30 (Page No. 397) https://gateoverflow.in/338389
How many license plates can be made using either three uppercase English letters followed by three digits or four
uppercase English letters followed by two digits?
kenneth-rosen discrete-mathematics counting descriptive
4.2.25 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 31 (Page No. 397) https://gateoverflow.in/338390
How many license plates can be made using either two or three uppercase English letters followed by either two or
three digits?
kenneth-rosen discrete-mathematics counting descriptive
4.2.26 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 32 (Page No. 397) https://gateoverflow.in/338392
4.2.27 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 33 (Page No. 397) https://gateoverflow.in/338393
4.2.28 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 34 (Page No. 397) https://gateoverflow.in/338394
How many different functions are there from a set with 10 elements to sets with the following numbers of elements?
A. 2 B. 3 C. 4 D. 5
kenneth-rosen discrete-mathematics counting descriptive
4.2.29 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 35 (Page No. 397) https://gateoverflow.in/338395
How many one-to-one functions are there from a set with five elements to sets with the following number of elements?
A. 4 B. 5 C. 6 D. 7
kenneth-rosen discrete-mathematics counting descriptive
4.2.30 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 36 (Page No. 397) https://gateoverflow.in/338396
How many functions are there from the set {1, 2, … , n}, where n is a positive integer, to the set {0, 1}?
4.2.31 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 37 (Page No. 397) https://gateoverflow.in/338398
How many functions are there from the set {1, 2, … , n}, where n is a positive integer, to the set {0, 1}
4.2.32 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 38 (Page No. 397) https://gateoverflow.in/338399
How many partial functions (see Section 2.3) are there from a set with five elements to sets with each of these
number of elements?
A. 1 B. 2 C. 5 D. 9
kenneth-rosen discrete-mathematics counting descriptive
4.2.33 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 39 (Page No. 397) https://gateoverflow.in/338400
How many partial functions (see Definition 13 of Section 2.3) are there from a set with m elements to a set with n
elements, where m and n are positive integers?
kenneth-rosen discrete-mathematics counting descriptive
4.2.34 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 4 (Page No. 396) https://gateoverflow.in/338092
A particular brand of shirt comes in 12 colors, has a male version and a female version, and comes in three sizes for
each sex. How many different types of this shirt are made?
kenneth-rosen discrete-mathematics counting descriptive
4.2.35 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 40 (Page No. 397) https://gateoverflow.in/338401
How many subsets of a set with 100 elements have more than one element?
kenneth-rosen discrete-mathematics counting descriptive
4.2.36 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 41 (Page No. 397) https://gateoverflow.in/338402
A palindrome is a string whose reversal is identical to the string. How many bit strings of length n are palindromes?
kenneth-rosen discrete-mathematics counting descriptive
4.2.37 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 42 (Page No. 397) https://gateoverflow.in/338405
4.2.38 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 43 (Page No. 397) https://gateoverflow.in/338406
4.2.39 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 44 (Page No. 397) https://gateoverflow.in/338407
How many ways are there to seat four of a group of ten people around a circular table where two seatings are
considered the same when everyone has the same immediate left and immediate right neighbor?
kenneth-rosen discrete-mathematics counting descriptive
4.2.40 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 45 (Page No. 397) https://gateoverflow.in/244062
How many ways are there to seat six people around a circular table where two seating are considered the same when
everyone has the same two neighbors without regard to whether they are right or left neighbors?
kenneth-rosen discrete-mathematics counting descriptive
4.2.41 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 46 (Page No. 397) https://gateoverflow.in/338409
In how many ways can a photographer at a wedding arrange 6 people in a row from a group of 10 people, where the
bride and the groom are among these 10 people, if
4.2.42 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 47 (Page No. 397) https://gateoverflow.in/338410
In how many ways can a photographer at a wedding arrange six people in a row, including the bride and groom, if
A. the bride must be next to the groom?
B. the bride is not next to the groom?
C. the bride is positioned somewhere to the left of the groom?
4.2.43 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 48 (Page No. 398) https://gateoverflow.in/338411
How many bit strings of length seven either begin with two 0s or end with three 1s?
kenneth-rosen discrete-mathematics counting descriptive
4.2.44 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 49 (Page No. 398) https://gateoverflow.in/338412
How many bit strings of length 10 either begin with three 0s or end with two 0s?
kenneth-rosen discrete-mathematics counting descriptive
4.2.45 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 5 (Page No. 396) https://gateoverflow.in/338093
Six different airlines fly from New York to Denver and seven fly from Denver to San Francisco. How many different
pairs of airlines can you choose on which to book a trip from New York to San Francisco via Denver, when you pick
an airline for the flight to Denver and an airline for the continuation flight to San Francisco?
kenneth-rosen discrete-mathematics counting descriptive
4.2.46 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 50 (Page No. 398) https://gateoverflow.in/338413
How many bit strings of length 10 contain either five consecutive 0s or five consecutive 1s?
kenneth-rosen discrete-mathematics counting descriptive
4.2.47 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 51 (Page No. 398) https://gateoverflow.in/338424
How many bit strings of length eight contain either three consecutive 0s or four consecutive 1s?
kenneth-rosen discrete-mathematics counting descriptive
4.2.48 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 52 (Page No. 398) https://gateoverflow.in/338425
Every student in a discrete mathematics class is either a computer science or a mathematics major or is a joint major in
these two subjects. How many students are in the class if there are 38 computer science majors (including joint majors),
23 mathematics majors (including joint majors), and 7 joint majors?
kenneth-rosen discrete-mathematics counting descriptive
4.2.49 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 53 (Page No. 398) https://gateoverflow.in/338427
How many positive integers not exceeding 100 are divisible either by 4 or by 6?
kenneth-rosen discrete-mathematics counting descriptive
4.2.50 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 54 (Page No. 398) https://gateoverflow.in/338428
How many different initials can someone have if a person has at least two, but no more than five, different initials?
Assume that each initial is one of the 26 uppercase letters of the English language.
kenneth-rosen discrete-mathematics counting descriptive
4.2.51 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 55 (Page No. 398) https://gateoverflow.in/338429
Suppose that a password for a computer system must have at least 8, but no more than 12, characters, where each
character in the password is a lowercase English letter, an uppercase English letter, a digit, or one of the six special
characters ∗, >, <, !, +, and =.
A. How many different passwords are available for this computer system?
B. How many of these passwords contain at least one occurrence of at least one of the six special characters?
C. Using your answer to part (A), determine how long it takes a hacker to try every possible password, assuming that it takes
one nanosecond for a hacker to check each possible password.
4.2.52 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 56 (Page No. 398) https://gateoverflow.in/338430
The name of a variable in the C programming language is a string that can contain uppercase letters, lowercase letters,
digits, or underscores. Further, the first character in the string must be a letter, either uppercase or lowercase, or an
underscore. If the name of a variable is determined by its first eight characters, how many different variables can be named in
C? (Note that the name of a variable may contain fewer than eight characters.)
kenneth-rosen discrete-mathematics counting descriptive
4.2.53 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 57 (Page No. 398) https://gateoverflow.in/338431
The name of a variable in the JAVA programming language is a string of between 1 and 65, 535 characters, inclusive,
where each character can be an uppercase or a lowercase letter, a dollar sign, an underscore, or a digit, except that the
first character must not be a digit. Determine the number of different variable names in JAVA.
kenneth-rosen discrete-mathematics counting descriptive
4.2.54 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 58 (Page No. 398) https://gateoverflow.in/338432
The International Telecommunications Union (ITU) specifies that a telephone number must consist of a country code
with between 1 and 3 digits, except that the code 0 is not available for use as a country code, followed by a number
with at most 15 digits. How many available possible telephone numbers are there that satisfy these restrictions?
kenneth-rosen discrete-mathematics counting descriptive
4.2.55 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 59 (Page No. 398) https://gateoverflow.in/338433
Suppose that at some future time every telephone in the world is assigned a number that contains a country code 1 to 3
digits long, that is, of the form X, XX, or XXX, followed by a 10-digit telephone number of the form NXX-NXX-
XXXX (as described in Example 8). How many different telephone numbers would be available worldwide under this
numbering plan?
kenneth-rosen discrete-mathematics counting descriptive
4.2.56 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 6 (Page No. 396) https://gateoverflow.in/338094
There are four major auto routes from Boston to Detroit and six from Detroit to Los Angeles. How many major auto
routes are there from Boston to Los Angeles via Detroit?
kenneth-rosen discrete-mathematics counting descriptive
4.2.57 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 60 (Page No. 398) https://gateoverflow.in/338434
A key in the Vigenère cryptosystem is a string of English letters, where the case of the letters does not matter. How
many different keys for this cryptosystem are there with three, four, five, or six letters?
kenneth-rosen discrete-mathematics counting descriptive
4.2.58 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 61 (Page No. 398) https://gateoverflow.in/338435
A wired equivalent privacy (WEP) key for a wireless fidelity (WiFi) network is a string of either 10, 26, or 58
hexadecimal digits. How many different WEP keys are there?
kenneth-rosen discrete-mathematics counting descriptive
4.2.59 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 62 (Page No. 398) https://gateoverflow.in/338437
Suppose that p and q are prime numbers and that n = pq. Use the principle of inclusion-exclusion to find the number
of positive integers not exceeding n that are relatively prime to n.
kenneth-rosen discrete-mathematics counting descriptive
4.2.60 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 63 (Page No. 398) https://gateoverflow.in/338438
Use the principle of inclusion–exclusion to find the number of positive integers less than 1, 000, 000 that are not
divisible by either 4 or by 6.
kenneth-rosen discrete-mathematics counting descriptive
4.2.61 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 64 (Page No. 398) https://gateoverflow.in/338439
Use a tree diagram to find the number of bit strings of length four with no three consecutive 0s.
kenneth-rosen discrete-mathematics counting descriptive
4.2.62 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 65 (Page No. 398) https://gateoverflow.in/338456
How many ways are there to arrange the letters a, b, c, and d such that a is not followed immediately by b?
kenneth-rosen discrete-mathematics counting descriptive
4.2.63 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 66 (Page No. 398) https://gateoverflow.in/338457
Use a tree diagram to find the number of ways that the World Series can occur, where the first team that wins four
games out of seven wins the series.
kenneth-rosen discrete-mathematics counting descriptive
4.2.64 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 67 (Page No. 398) https://gateoverflow.in/338458
Use a tree diagram to determine the number of subsets of {3, 7, 9, 11, 24} with the property that the sum of the
elements in the subset is less than 28.
kenneth-rosen discrete-mathematics counting descriptive
4.2.65 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 68 (Page No. 398) https://gateoverflow.in/338459
A. Suppose that a store sells six varieties of soft drinks: cola, ginger ale, orange, root beer, lemonade, and cream soda. Use a
tree diagram to determine the number of different types of bottles the store must stock to have all varieties available in all
size bottles if all varieties are available in 12-ounce bottles, all but lemonade are available in 20-ounce bottles, only cola
and ginger ale are available in 32-ounce bottles, and all but lemonade and cream soda are available in 64-ounce bottles?
B. Answer the question in part (A) using counting rules.
4.2.66 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 69 (Page No. 398) https://gateoverflow.in/338460
A. Suppose that a popular style of running shoe is available for both men and women. The woman’s shoe comes in sizes
6, 7, 8, and 9, and the man’s shoe comes in sizes 8, 9, 10, 11, and 12. The man’s shoe comes in white and black, while
the woman’s shoe comes in white, red, and black. Use a tree diagram to determine the number of different shoes that a
store has to stock to have at least one pair of this type of running shoe for all available sizes and colors for both men and
women.
B. Answer the question in part (A) using counting rules.
4.2.67 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 7 (Page No. 396) https://gateoverflow.in/338095
4.2.68 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 70 (Page No. 398) https://gateoverflow.in/338461
Use the product rule to show that there are 2 2n different truth tables for propositions in n variables.
kenneth-rosen discrete-mathematics counting descriptive
4.2.69 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 71 (Page No. 399) https://gateoverflow.in/338462
Use mathematical induction to prove the sum rule for m tasks from the sum rule for two tasks.
kenneth-rosen discrete-mathematics counting descriptive
4.2.70 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 72 (Page No. 399) https://gateoverflow.in/338463
Use mathematical induction to prove the product rule for m tasks from the product rule for two tasks.
kenneth-rosen discrete-mathematics counting descriptive
4.2.71 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 73 (Page No. 399) https://gateoverflow.in/338464
How many diagonals does a convex polygon with n sides have? (Recall that a polygon is convex if every line segment
connecting two points in the interior or boundary of the polygon lies entirely within this set and that a diagonal of a
polygon is a line segment connecting two vertices that are not adjacent.)
kenneth-rosen discrete-mathematics counting descriptive
4.2.72 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 74 (Page No. 399) https://gateoverflow.in/338465
Data are transmitted over the Internet in datagrams, which are structured blocks of bits. Each datagram contains header
information organized into a maximum of 14 different fields (specifying many things, including the source and
destination addresses) and a data area that contains the actual data that are transmitted. One of the 14 header fields is the header
length field (denoted by HLEN), which is specified by the protocol to be 4 bits long and that specifies the header length in
terms of 32-bit blocks of bits. For example, if HLEN = 0110, the header is made up of six 32-bit blocks. Another of the 14
header fields is the 16-bit-long total length field (denoted by TOTAL LENGTH), which specifies the length in bits of the entire
datagram, including both the header fields and the data area. The length of the data area is the total length of the datagram
minus the length of the header.
A. The largest possible value of TOTAL LENGTH (which is 16 bits long) determines the maximum total length in octets
(blocks of 8 bits) of an Internet datagram. What is this value?
B. The largest possible value of HLEN (which is 4 bits long) determines the maximum total header length in 32-bit blocks.
What is this value? What is the maximum total header length in octets?
C. The minimum (and most common) header length is 20 octets. What is the maximum total length in octets of the data area
of an Internet datagram?
D. How many different strings of octets in the data area can be transmitted if the header length is 20 octets and the total length
is as long as possible?
4.2.73 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 8 (Page No. 396) https://gateoverflow.in/338096
How many different three-letter initials with none of the letters repeated can people have?
kenneth-rosen discrete-mathematics counting descriptive
4.2.74 Counting: Kenneth Rosen Edition 7 Exercise 6.1 Question 9 (Page No. 396) https://gateoverflow.in/338097
How many different three-letter initials are there that begin with an A?
kenneth-rosen discrete-mathematics counting descriptive
4.2.75 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 1 (Page No. 413) https://gateoverflow.in/338548
4.2.76 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 10 (Page No. 413) https://gateoverflow.in/338562
There are six different candidates for governor of a state. In how many different orders can the names of the candidates
be printed on a ballot?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.77 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 11 (Page No. 413) https://gateoverflow.in/338564
4.2.78 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 12 (Page No. 413) https://gateoverflow.in/338569
4.2.79 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 13 (Page No. 413) https://gateoverflow.in/338570
A group contains n men and n women. How many ways are there to arrange these people in a row if the men and
women alternate?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.80 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 14 (Page No. 413) https://gateoverflow.in/338571
In how many ways can a set of two positive integers less than 100 be chosen?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.81 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 15 (Page No. 413) https://gateoverflow.in/338572
In how many ways can a set of five letters be selected from the English alphabet?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.82 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 16 (Page No. 413) https://gateoverflow.in/338573
How many subsets with an odd number of elements does a set with 10 elements have?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.83 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 17 (Page No. 413) https://gateoverflow.in/338574
How many subsets with more than two elements does a set with 100 elements have?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.84 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 18 (Page No. 413) https://gateoverflow.in/338575
A coin is flipped eight times where each flip comes up either heads or tails. How many possible outcomes
A. are there in total? B. contain exactly three heads?
C. contain at least three heads? D. contain the same number of heads and
tails?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.85 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 19 (Page No. 413) https://gateoverflow.in/338576
A coin is flipped 10 times where each flip comes up either heads or tails. How many possible outcomes
A. are there in total? B. contain exactly two heads?
C. contain at most three tails? D. contain the same number of heads and
tails?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.86 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 2 (Page No. 413) https://gateoverflow.in/338550
How many different permutations are there of the set {a, b, c, d, e, f, g}?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.87 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 20 (Page No. 413) https://gateoverflow.in/338577
4.2.88 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 21 (Page No. 414) https://gateoverflow.in/338578
4.2.89 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 22 (Page No. 414) https://gateoverflow.in/338579
4.2.90 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 23 (Page No. 414) https://gateoverflow.in/338580
How many ways are there for eight men and five women to stand in a line so that no two women stand next to each
other? [Hint: First position the men and then consider possible positions for the women.]
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.91 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 24 (Page No. 414) https://gateoverflow.in/338581
How many ways are there for 10 women and six men to stand in a line so that no two men stand next to each other?
[Hint: First position the women and then consider possible positions for the men.]
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.92 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 25 (Page No. 414) https://gateoverflow.in/338582
One hundred tickets, numbered 1, 2, 3, … , 100, are sold to 100 different people for a drawing. Four different prizes
are awarded, including a grand prize (a trip to Tahiti). How many ways are there to award the prizes if
4.2.93 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 26 (Page No. 414) https://gateoverflow.in/338595
A. How many ways are there to choose 10 players to take the field?
B. How many ways are there to assign the 10 positions by selecting players from the 13 people who show up?
C. Of the 13 people who show up, three are women. How many ways are there to choose 10 players to take the field if at least
one of these players must be a woman?
4.2.94 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 27 (Page No. 414) https://gateoverflow.in/338596
A. How many ways are there to choose four members of the club to serve on an executive committee?
B. How many ways are there to choose a president, vice president, secretary, and treasurer of the club, where no person can
hold more than one office?
4.2.95 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 28 (Page No. 414) https://gateoverflow.in/338598
A professor writes 40 discrete mathematics true/false questions. Of the statements in these questions, 17 are true. If the
questions can be positioned in any order, how many different answer keys are possible?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.96 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 29 (Page No. 414) https://gateoverflow.in/338599
How many 4-permutations of the positive integers not exceeding 100 contain three consecutive integers
k, k + 1, k + 2, in the correct order
A. where these consecutive integers can perhaps be separated by other integers in the permutation?
B. where they are in consecutive positions in the permutation?
4.2.97 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 3 (Page No. 413) https://gateoverflow.in/338551
4.2.98 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 30 (Page No. 414) https://gateoverflow.in/338601
Seven women and nine men are on the faculty in the mathematics department at a school.
A. How many ways are there to select a committee of five members of the department if at least one woman must be on the
committee?
B. How many ways are there to select a committee of five members of the department if at least one woman and at least one
man must be on the committee?
4.2.99 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 31 (Page No. 414) https://gateoverflow.in/338602
The English alphabet contains 21 consonants and five vowels. How many strings of six lowercase letters of the English
alphabet contain
A. exactly one vowel? B. exactly two vowels?
C. at least one vowel? D. at least two vowels?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.100 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 32 (Page No. 414) https://gateoverflow.in/338604
How many strings of six lowercase letters from the English alphabet contain
A. the letter a?
B. the letters a and b?
C. the letters a and b in consecutive positions with a preceding b, with all the letters distinct?
D. the letters a and b, where a is somewhere to the left of b in the string, with all the letters distinct?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.101 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 33 (Page No. 414) https://gateoverflow.in/338605
Suppose that a department contains 10 men and 15 women. How many ways are there to form a committee with six
members if it must have the same number of men and women?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.102 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 34 (Page No. 414) https://gateoverflow.in/338606
Suppose that a department contains 10 men and 15 women. How many ways are there to form a committee with six
members if it must have more women than men?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.103 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 35 (Page No. 414) https://gateoverflow.in/338607
How many bit strings contain exactly eight 0s and 10 1s if every 0 must be immediately followed by a 1?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.104 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 36 (Page No. 414) https://gateoverflow.in/338608
How many bit strings contain exactly five 0s and 14 1s if every 0 must be immediately followed by two 1s?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.105 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 37 (Page No. 414) https://gateoverflow.in/338609
How many bit strings of length 10 contain at least three 1s and at least three 0s?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.106 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 38 (Page No. 414) https://gateoverflow.in/338611
How many ways are there to select 12 countries in the United Nations to serve on a council if 3 are selected from a
block of 45, 4 are selected from a block of 57, and the others are selected from the remaining 69 countries?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.107 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 39 (Page No. 415) https://gateoverflow.in/338630
How many license plates consisting of three letters followed by three digits contain no letter or digit twice?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.108 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 4 (Page No. 413) https://gateoverflow.in/338553
4.2.109 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 40 (Page No. 415) https://gateoverflow.in/338631
A circular r-permutation of n people is a seating of r of these n people around a circular table, where seatings are
considered to be the same if they can be obtained from each other by rotating the table.
Find the number of circular 3-permutations of 5 people.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.110 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 41 (Page No. 415) https://gateoverflow.in/338632
A circular r-permutation of n people is a seating of r of these n people around a circular table, where seatings are
considered to be the same if they can be obtained from each other by rotating the table.
Find a formula for the number of circular r-permutations of n people.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.111 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 42 (Page No. 415) https://gateoverflow.in/338634
Find a formula for the number of ways to seat r of n people around a circular table, where seatings are considered the
same if every person has the same two neighbors without regard to which side these neighbors are sitting on.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.112 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 43 (Page No. 415) https://gateoverflow.in/338635
How many ways are there for a horse race with three horses to finish if ties are possible? [Note: Two or three horses
may tie.]
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.113 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 44 (Page No. 415) https://gateoverflow.in/338636
How many ways are there for a horse race with four horses to finish if ties are possible? [Note: Any number of the four
horses may tie.)
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.114 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 45 (Page No. 415) https://gateoverflow.in/338637
There are six runners in the 100-yard dash. How many ways are there for three medals to be awarded if ties are
possible? (The runner or runners who finish with the fastest time receive gold medals, the runner or runners who finish
with exactly one runner ahead receive silver medals, and the runner or runners who finish with exactly two runners ahead
receive bronze medals.)
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.115 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 46 (Page No. 415) https://gateoverflow.in/338639
This procedure is used to break ties in games in the championship round of the World Cup soccer tournament. Each
team selects five players in a prescribed order. Each of these players takes a penalty kick, with a player from the first
team followed by a player from the second team and so on, following the order of players specified. If the score is still tied at
the end of the 10 penalty kicks, this procedure is repeated. If the score is still tied after 20 penalty kicks, a sudden-death
shootout occurs, with the first team scoring an unanswered goal victorious.
A. How many different scoring scenarios are possible if the game is settled in the first round of 10 penalty kicks, where the
round ends once it is impossible for a team to equal the number of goals scored by the other team?
B. How many different scoring scenarios for the first and second groups of penalty kicks are possible if the game is settled in
the second round of 10 penalty kicks?
C. How many scoring scenarios are possible for the full set of penalty kicks if the game is settled with no more than 10 total
additional kicks after the two rounds of five kicks for each team?
4.2.116 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 5 (Page No. 413) https://gateoverflow.in/338555
F. P(10, 9)
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.117 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 6 (Page No. 413) https://gateoverflow.in/338556
4.2.118 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 7 (Page No. 413) https://gateoverflow.in/338558
4.2.119 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 8 (Page No. 413) https://gateoverflow.in/338559
In how many different orders can five runners finish a race if no ties are allowed?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.120 Counting: Kenneth Rosen Edition 7 Exercise 6.3 Question 9 (Page No. 413) https://gateoverflow.in/338561
How many possibilities are there for the win, place, and show (first, second, and third) positions in a horse race with 12
horses if all orders of finish are possible?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.121 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 1 (Page No. 432) https://gateoverflow.in/338748
In how many different ways can five elements be selected in order from a set with three elements when repetition is
allowed?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.122 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 10 (Page No. 432) https://gateoverflow.in/338757
A croissant shop has plain croissants, cherry croissants, chocolate croissants, almond croissants, apple croissants, and
broccoli croissants. How many ways are there to choose
A. a dozen croissants?
B. three dozen croissants?
C. two dozen croissants with at least two of each kind?
D. two dozen croissants with no more than two broccoli croissants?
E. two dozen croissants with at least five chocolate croissants and at least three almond croissants?
F. two dozen croissants with at least one plain croissant, at least two cherry croissants, at least three chocolate croissants, at
least one almond croissant, at least two apple croissants, and no more than three broccoli croissants?
4.2.123 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 11 (Page No. 432) https://gateoverflow.in/338758
How many ways are there to choose eight coins from a piggy bank containing 100 identical pennies and 80 identical
nickels?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.124 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 12 (Page No. 432) https://gateoverflow.in/338759
How many different combinations of pennies, nickels, dimes, quarters, and half dollars can a piggy bank contain if it
has 20 coins in it?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.125 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 13 (Page No. 432) https://gateoverflow.in/338760
A book publisher has 3000 copies of a discrete mathematics book. How many ways are there to store these books in
their three warehouses if the copies of the book are indistinguishable?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.126 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 14 (Page No. 432) https://gateoverflow.in/338761
How many solutions are there to the equation x1 + x2 + x3 + x4 = 17, where x1 , x2 , x3 , and x4 are nonnegative
integers?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.127 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 15 (Page No. 432) https://gateoverflow.in/338767
How many solutions are there to the equation x1 + x2 + x3 + x4 + x5 = 21, where xi, i = 1, 2, 3, 4, 5, is a
nonnegative integer such that
A. x1 ≥ 1?
B. xi ≥ 2 for i = 1, 2, 3, 4, 5?
C. 0 ≤ x1 ≤ 10?
D. 0 ≤ x1 ≤ 3, 1 ≤ x2 < 4, and x3 ≥ 15?
4.2.128 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 16 (Page No. 432) https://gateoverflow.in/338768
A. xi > 1 for i = 1, 2, 3, 4, 5, 6?
B. x1 ≥ 1, x2 ≥ 2, x3 ≥ 3, x4 ≥ 4, x5 > 5, and x6 ≥ 6?
C. x1 ≤ 5?
D. x1 < 8 and x2 > 8?
4.2.129 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 17 (Page No. 432) https://gateoverflow.in/338769
How many strings of 10 ternary digits (0, 1, or 2) are there that contain exactly two 0s, three 1s, and five 2s?
4.2.130 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 18 (Page No. 432) https://gateoverflow.in/338770
How many strings of 20-decimal digits are there that contain two 0s, four 1s, three 2s, one 3, two 4s, three 5s, two
7s, and three 9s?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.131 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 19 (Page No. 432) https://gateoverflow.in/338772
Suppose that a large family has 14 children, including two sets of identical triplets, three sets of identical twins, and two
individual children. How many ways are there to seat these children in a row of chairs if the identical triplets or twins
cannot be distinguished from one another?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.132 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 2 (Page No. 432) https://gateoverflow.in/338749
In how many different ways can five elements be selected in order from a set with five elements when repetition is
allowed?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.133 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 20 (Page No. 432) https://gateoverflow.in/338773
How many solutions are there to the inequality x1 + x2 + x3 ≤ 11, where x1 , x2 , and x3 are nonnegative integers?
[Hint: Introduce an auxiliary variable x4 such that x1 + x2 + x3 + x4 = 11.]
How many ways are there to distribute six indistinguishable balls into nine distinguishable bins?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.135 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 22 (Page No. 432) https://gateoverflow.in/338776
How many ways are there to distribute 12 indistinguishable balls into six distinguishable bins?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.136 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 23 (Page No. 432) https://gateoverflow.in/338777
How many ways are there to distribute 12 distinguishable objects into six distinguishable boxes so that two objects are
placed in each box?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.137 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 24 (Page No. 432) https://gateoverflow.in/338778
How many ways are there to distribute 15 distinguishable objects into five distinguishable boxes so that the boxes have
one, two, three, four, and five objects in them, respectively.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.138 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 25 (Page No. 433) https://gateoverflow.in/338779
How many positive integers less than 1, 000, 000 have the sum of their digits equal to 19?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.139 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 26 (Page No. 433) https://gateoverflow.in/338782
How many positive integers less than 1, 000, 000 have exactly one digit equal to 9 and have a sum of digits equal to
13?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.140 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 27 (Page No. 433) https://gateoverflow.in/338783
There are 10 questions on a discrete mathematics final exam. How many ways are there to assign scores to the
problems if the sum of the scores is 100 and each question is worth at least 5 points?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.141 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 28 (Page No. 433) https://gateoverflow.in/338784
4.2.142 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 29 (Page No. 433) https://gateoverflow.in/338785
How many different bit strings can be transmitted if the string must begin with a 1 bit, must include three additional 1
bits (so that a total of four 1 bits is sent), must include a total of 12 0 bits, and must have at least two 0 bits following
each 1 bit?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.143 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 3 (Page No. 432) https://gateoverflow.in/338750
How many different strings can be made from the letters in MISSISSIPPI, using all the letters?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.145 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 31 (Page No. 433) https://gateoverflow.in/338787
How many different strings can be made from the letters in ABRACADABRA, using all the letters?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.146 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 32 (Page No. 433) https://gateoverflow.in/338788
How many different strings can be made from the letters in AARDVARK, using all the letters, if all three As must be
consecutive?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.147 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 33 (Page No. 433) https://gateoverflow.in/338789
How many different strings can be made from the letters in ORONO, using some or all of the letters?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.148 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 34 (Page No. 433) https://gateoverflow.in/338790
How many strings with five or more characters can be formed from the letters in SEERESS?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.149 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 35 (Page No. 433) https://gateoverflow.in/338806
How many strings with seven or more characters can be formed from the letters in EVERGREEN?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.150 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 36 (Page No. 433) https://gateoverflow.in/338807
How many different bit strings can be formed using six 1s and eight 0s?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.151 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 37 (Page No. 433) https://gateoverflow.in/338808
A student has three mangos, two papayas, and two kiwi fruits. If the student eats one piece of fruit each day, and only
the type of fruit matters, in how many different ways can these fruits be consumed?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.152 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 38 (Page No. 433) https://gateoverflow.in/338836
A professor packs her collection of 40 issues of a mathematics journal in four boxes with 10 issues per box. How many
ways can she distribute the journals if
4.2.153 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 39 (Page No. 433) https://gateoverflow.in/338837
How many ways are there to travel in xyz space from the origin (0, 0, 0) to the point (4, 3, 5) by taking steps one unit
in the positive x direction, one unit in the positive y direction, or one unit in the positive z direction? (Moving in the
negative x, y, or z direction is prohibited, so that no backtracking is allowed.)
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.154 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 4 (Page No. 432) https://gateoverflow.in/338751
Every day a student randomly chooses a sandwich for lunch from a pile of wrapped sandwiches. If there are six kinds
of sandwiches, how many different ways are there for the student to choose sandwiches for the seven days of a week if
the order in which the sandwiches are chosen matters?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.155 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 40 (Page No. 433) https://gateoverflow.in/338838
How many ways are there to travel in xyzw space from the origin (0, 0, 0, 0) to the point (4, 3, 5, 4) by taking steps
one unit in the positive x, positive y, positive z, or positive w direction?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.156 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 41 (Page No. 433) https://gateoverflow.in/338841
How many ways are there to deal hands of seven cards to each of five players from a standard deck of 52 cards?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.157 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 42 (Page No. 433) https://gateoverflow.in/338842
In bridge, the 52 cards of a standard deck are dealt to four players. How many different ways are there to deal bridge
hands to four players?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.158 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 43 (Page No. 433) https://gateoverflow.in/338843
How many ways are there to deal hands of five cards to each of six players from a deck containing 48 different cards?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.159 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 44 (Page No. 433) https://gateoverflow.in/338844
In how many ways can a dozen books be placed on four distinguishable shelves
4.2.160 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 45 (Page No. 433) https://gateoverflow.in/338846
4.2.161 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 46 (Page No. 433) https://gateoverflow.in/338847
A shelf holds 12 books in a row. How many ways are there to choose five books so that no two adjacent books are
chosen? [Hint: Represent the books that are chosen by bars and the books not chosen by stars. Count the number of
sequences of five bars and seven stars so that no two bars are adjacent.]
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.162 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 47 (Page No. 433) https://gateoverflow.in/338848
Use the product rule to prove Theorem 4, by first placing objects in the first box, then placing objects in the second
box, and so on.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.163 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 48 (Page No. 433) https://gateoverflow.in/338850
Prove Theorem 4 by first setting up a one-to-one correspondence between permutations of n objects with ni
indistinguishable objects of type i, i = 1, 2, 3, … , k, and the distributions of n objects in k boxes such that ni objects
are placed in box i, i = 1, 2, 3, … , k and then applying Theorem 3.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.164 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 49 (Page No. 433 - 434) https://gateoverflow.in/338851
In this exercise we will prove Theorem 2 by setting up a one-to-one correspondence between the set of r-combinations
with repetition allowed of S = {1, 2, 3, … , n} and the set of r-combinations of the set T = {1, 2, 3, … n + r − 1}.
A. Arrange the elements in an r-combination, with repetition allowed, of S into an increasing sequence x1 ≤ x2 ≤ ⋯ ≤ xr .
Show that the sequence formed by adding k − 1 to the kth term is strictly increasing. Conclude that this sequence is made
up of r distinct elements from T.
B. Show that the procedure described in (A) defines a one-to-one correspondence between the set of r-combinations, with
repetition allowed, of S and the r-combinations of T. [Hint: Show the correspondence can be reversed by associating to
t h e r-combination {x1 , x2 , … , xr } of T, with 1 ≤ x1 < x2 < ⋯ < xr ≤ n + r − 1, the r-combination
with repetition allowed from S, formed by subtracting k − 1 from the kth element.]
C. Conclude that there are C(n + r − 1, r) r-combinations with repetition allowed from a set with n elements.
4.2.165 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 5 (Page No. 432) https://gateoverflow.in/338752
How many ways are there to assign three jobs to five employees if each employee can be given more than one job?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.166 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 50 (Page No. 434) https://gateoverflow.in/338855
How many ways are there to distribute five distinguishable objects into three indistinguishable boxes?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.167 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 51 (Page No. 434) https://gateoverflow.in/338856
How many ways are there to distribute six distinguishable objects into four indistinguishable boxes so that each of the
boxes contains at least one object?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.168 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 52 (Page No. 434) https://gateoverflow.in/338858
How many ways are there to put five temporary employees into four identical offices?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.169 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 53 (Page No. 434) https://gateoverflow.in/338860
How many ways are there to put six temporary employees into four identical offices so that there is at least one
temporary employee in each of these four offices?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.170 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 54 (Page No. 434) https://gateoverflow.in/338861
How many ways are there to distribute five indistinguishable objects into three indistinguishable boxes?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.171 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 55 (Page No. 434) https://gateoverflow.in/338862
How many ways are there to distribute six indistinguishable objects into four indistinguishable boxes so that each of the
boxes contains at least one object?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.172 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 56 (Page No. 434) https://gateoverflow.in/338863
How many ways are there to pack eight identical DVDs into five indistinguishable boxes so that each box contains at
least one DVD?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.173 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 57 (Page No. 434) https://gateoverflow.in/338864
How many ways are there to pack nine identical DVDs into three indistinguishable boxes so that each box contains at
least two DVDs?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.174 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 58 (Page No. 434) https://gateoverflow.in/338865
How many ways are there to distribute five balls into seven boxes if each box must have at most one ball in it if
4.2.175 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 59 (Page No. 434) https://gateoverflow.in/338866
How many ways are there to distribute five balls into three boxes if each box must have at least one ball in it if
4.2.176 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 6 (Page No. 432) https://gateoverflow.in/338753
How many ways are there to select five unordered elements from a set with three elements when repetition is allowed?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.177 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 60 (Page No. 434) https://gateoverflow.in/338867
Suppose that a basketball league has 32 teams, split into two conferences of 16 teams each. Each conference is split
into three divisions. Suppose that the North Central Division has five teams. Each of the teams in the North Central
Division plays four games against each of the other teams in this division, three games against each of the 11 remaining teams
in the conference, and two games against each of the 16 teams in the other conference. In how many different orders can the
games of one of the teams in the North Central Division be scheduled?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.178 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 61 (Page No. 434) https://gateoverflow.in/338868
Suppose that a weapons inspector must inspect each of five different sites twice, visiting one site per day. The inspector
is free to select the order in which to visit these sites, but cannot visit site X, the most suspicious site, on two
consecutive days. In how many different orders can the inspector visit these sites?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.179 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 62 (Page No. 434) https://gateoverflow.in/338869
How many different terms are there in the expansion of (x1 + x2 + ⋯ + xm )n after all terms with identical sets of
exponents are added?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.180 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 63 (Page No. 434) https://gateoverflow.in/338870
4.2.181 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 64 (Page No. 434) https://gateoverflow.in/338872
4.2.182 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 65 (Page No. 434) https://gateoverflow.in/338874
4.2.183 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 66 (Page No. 434) https://gateoverflow.in/338875
4.2.184 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 7 (Page No. 432) https://gateoverflow.in/338754
How many ways are there to select three unordered elements from a set with five elements when repetition is allowed?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.185 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 8 (Page No. 432) https://gateoverflow.in/338755
How many different ways are there to choose a dozen donuts from the 21 varieties at a donut shop?
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.186 Counting: Kenneth Rosen Edition 7 Exercise 6.5 Question 9 (Page No. 432) https://gateoverflow.in/338756
A bagel shop has onion bagels, poppy seed bagels, egg bagels, salty bagels, pumpernickel bagels, sesame seed bagels,
raisin bagels, and plain bagels. How many ways are there to choose
A. six bagels?
B. a dozen bagels?
C. two dozen bagels?
D. a dozen bagels with at least one of each kind?
E. a dozen bagels with at least three egg bagels and no more than two salty bagels?
4.2.188 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 10 (Page No. 438) https://gateoverflow.in/338887
Show that Algorithm 1 produces the next larger permutation in lexicographic order.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.189 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 11 (Page No. 438) https://gateoverflow.in/338888
Show that Algorithm 3 produces the next larger r-combination in lexicographic order after a given r-combination.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.190 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 12 (Page No. 438) https://gateoverflow.in/338889
4.2.191 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 13 (Page No. 438) https://gateoverflow.in/338890
4.2.192 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 14 (Page No. 438) https://gateoverflow.in/338900
The remaining exercises in this section develop another algorithm for generating the permutations of {1, 2, 3, … , n}.
This algorithm is based on Cantor expansions of integers. Every nonnegative integer less than n! has a unique Cantor
expansion a11! + a22! + ⋯ + an−1(n−1)! where ai is a nonnegative integer not exceeding i, for i = 1, 2, … n − 1. The
integers a1 , a2 , … , an−1 are called the Cantor digits of this integer. Given a permutation of {1, 2, … , n}, let
ak−1 , k = 2, 3, … n, be the number of integers less than k that follow k in the permutation. For instance, in the permutation
43215, a1 is the number of integers less than 2 that follow 2, so a1 = 1. Similarly, for this example
a2 = 2, a3 = 3, and a4 = 0. Consider the function from the set of permutations of {1, 2, 3, … , n} to the set of nonnegative
integers less than n! that sends a permutation to the integer that has a1 , a2 , … , an−1 , defined in this way, as its Cantor digits.
Find the Cantor digits a1 , a2 , … , an−1 that correspond to these permutations.
A. 246531
B. 12345
C. 654321
4.2.193 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 15 (Page No. 438) https://gateoverflow.in/338901
Show that the correspondence described in the preamble is a bijection between the set of permutations of
{1, 2, 3, … , n} and the nonnegative integers less than n!.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.194 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 16 (Page No. 439) https://gateoverflow.in/338903
The remaining exercises in this section develop another algorithm for generating the permutations of {1, 2, 3, … , n}.
This algorithm is based on Cantor expansions of integers. Every nonnegative integer less than n! has a unique Cantor
expansion a11! + a22! + ⋯ + an−1(n−1)! where ai is a nonnegative integer not exceeding i, for i = 1, 2, … n − 1. The
integers a1 , a2 , … , an−1 are called the Cantor digits of this integer. Given a permutation of {1, 2, … , n}, let
ak−1 , k = 2, 3, … n, be the number of integers less than k that follow k in the permutation. For instance, in the permutation
43215, a1 is the number of integers less than 2 that follow 2, so a1 = 1. Similarly, for this example
a2 = 2, a3 = 3, and a4 = 0. Consider the function from the set of permutations of {1, 2, 3, … , n} to the set of nonnegative
integers less than n! that sends a permutation to the integer that has a1 , a2 , … , an−1 , defined in this way, as its Cantor digits.
Find the permutations of {1, 2, 3, 4, 5} that correspond to these integers with respect to the correspondence between Cantor
expansions and permutations as described in the preamble to question 14.
A. 3
B. 89
C. 111
4.2.195 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 17 (Page No. 438) https://gateoverflow.in/338902
The remaining exercises in this section develop another algorithm for generating the permutations of {1, 2, 3, … , n}.
This algorithm is based on Cantor expansions of integers. Every nonnegative integer less than n! has a unique Cantor
expansion a11! + a22! + ⋯ + an−1(n−1)! where ai is a nonnegative integer not exceeding i, for i = 1, 2, … n − 1. The
integers a1 , a2 , … , an−1 are called the Cantor digits of this integer. Given a permutation of {1, 2, … , n}, let
ak−1 , k = 2, 3, … n, be the number of integers less than k that follow k in the permutation. For instance, in the permutation
43215, a1 is the number of integers less than 2 that follow 2, so a1 = 1. Similarly, for this example
a2 = 2, a3 = 3, and a4 = 0. Consider the function from the set of permutations of {1, 2, 3, … , n} to the set of nonnegative
integers less than n! that sends a permutation to the integer that has a1 , a2 , … , an−1 , defined in this way, as its Cantor digits.
Develop an algorithm for producing all permutations of a set of n elements based on the correspondence described in the
preamble to question 14.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.196 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 2 (Page No. 438) https://gateoverflow.in/338879
4.2.197 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 3 (Page No. 438) https://gateoverflow.in/338880
The name of a file in a computer directory consists of three uppercase letters followed by a digit, where each letter is
either A, B, or C, and each digit is either 1 or 2. List the name of these files in lexicographic order, where we order
letters using the usual alphabetic order of letters.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.198 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 4 (Page No. 438) https://gateoverflow.in/338881
Suppose that the name of a file in a computer directory consists of three digits followed by two lowercase letters and
each digit is 0, 1, or 2, and each letter is either a or b. List the name of these files in lexicographic order, where we
order letters using the usual alphabetic order of letters.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.199 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 5 (Page No. 438) https://gateoverflow.in/338882
Find the next larger permutation in lexicographic order after each of these permutations.
F. 31528764
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.200 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 6 (Page No. 438) https://gateoverflow.in/338883
. Find the next larger permutation in lexicographic order after each of these permutations.
F. f23587416
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.201 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 7 (Page No. 438) https://gateoverflow.in/338884
Use Algorithm 1 to generate the 24 permutations of the first four positive integers in lexicographic order.
kenneth-rosen discrete-mathematics counting combinatory descriptive
4.2.202 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 8 (Page No. 438) https://gateoverflow.in/338885
Use Algorithm 2 to list all the subsets of the set {1, 2, 3, 4}.
4.2.203 Counting: Kenneth Rosen Edition 7 Exercise 6.6 Question 9 (Page No. 438) https://gateoverflow.in/338886
4.2.204 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 1 (Page No. 510) https://gateoverflow.in/338904
Use mathematical induction to verify the formula derived in Example 2 for the number of moves required to complete
the Tower of Hanoi puzzle.
kenneth-rosen discrete-mathematics counting descriptive
4.2.205 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 10 (Page No. 511) https://gateoverflow.in/338913
A. Find a recurrence relation for the number of bit strings of length n that contain the string 01.
B. What are the initial conditions?
C. How many bit strings of length seven contain the string 01?
4.2.206 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 11 (Page No. 511) https://gateoverflow.in/338953
A. Find a recurrence relation for the number of ways to climb n stairs if the person climbing the stairs can take one stair or two
stairs at a time.
B. What are the initial conditions?
C. In how many ways can this person climb a flight of eight stairs?
4.2.207 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 12 (Page No. 511) https://gateoverflow.in/338954
A. Find a recurrence relation for the number of ways to climb n stairs if the person climbing the stairs can take one, two, or
three stairs at a time.
B. What are the initial conditions?
C. In many ways can this person climb a flight of eight stairs?
4.2.208 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 13 (Page No. 511) https://gateoverflow.in/338955
A string that contains only 0s, 1s, and 2s is called a ternary string.
A. Find a recurrence relation for the number of ternary strings of length n that do not contain two consecutive 0s.
B. What are the initial conditions?
C. How many ternary strings of length six do not contain two consecutive 0s?
A. Find a recurrence relation for the number of ternary strings of length n that contain two consecutive 0s.
B. What are the initial conditions?
C. How many ternary strings of length six contain two consecutive 0s?
4.2.210 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 15 (Page No. 511) https://gateoverflow.in/338957
1. Find a recurrence relation for the number of ternary strings of length n that do not contain two consecutive 0s or two
consecutive 1s.
2. What are the initial conditions?
3. How many ternary strings of length six do not contain two consecutive 0s or two consecutive 1s?
4.2.211 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 16 (Page No. 511) https://gateoverflow.in/338958
A. Find a recurrence relation for the number of ternary strings of length n that contain either two consecutive 0s or two
consecutive 1s.
B. What are the initial conditions?
C. How many ternary strings of length six contain two consecutive 0s or two consecutive 1s?
4.2.212 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 17 (Page No. 511) https://gateoverflow.in/338959
A. Find a recurrence relation for the number of ternary strings of length n that do not contain consecutive symbols that are the
same.
B. What are the initial conditions?
C. How many ternary strings of length six do not contain consecutive symbols that are the same?
4.2.213 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 18 (Page No. 511) https://gateoverflow.in/338961
A. Find a recurrence relation for the number of ternary strings of length n that contain two consecutive symbols that are the
same.
B. What are the initial conditions?
C. How many ternary strings of length six contain consecutive symbols that are the same?
4.2.214 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 19 (Page No. 511) https://gateoverflow.in/338963
Messages are transmitted over a communications channel using two signals. The transmittal of one signal requires 1
microsecond, and the transmittal of the other signal requires 2 microseconds.
A. Find a recurrence relation for the number of different messages consisting of sequences of these two signals, where each
signal in the message is immediately followed by the next signal, that can be sent in n microseconds.
B. What are the initial conditions?
C. How many different messages can be sent in 10 microseconds using these two signals?
A. Find a recurrence relation for the number of permutations of a set with n elements.
B. Use this recurrence relation to find the number of permutations of a set with n elements using iteration
4.2.216 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 20 (Page No. 511) https://gateoverflow.in/338965
A bus driver pays all tolls, using only nickels and dimes, by throwing one coin at a time into the mechanical toll
collector.
A. Find a recurrence relation for the number of different ways the bus driver can pay a toll of n cents (where the order in
which the coins are used matters).
B. In how many different ways can the driver pay a toll of 45 cents?
4.2.217 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 21 (Page No. 511) https://gateoverflow.in/338978
A. Find the recurrence relation satisfied by Rn , where Rn is the number of regions that a plane is divided into by n lines, if
no two of the lines are parallel and no three of the lines go through the same point.
B. Find Rn using iteration.
4.2.218 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 22 (Page No. 511) https://gateoverflow.in/338979
A. a) Find the recurrence relation satisfied by Rn , where Rn is the number of regions into which the surface of a sphere is
divided by n great circles (which are the intersections of the sphere and planes passing through the center of the sphere), if
no three of the great circles go through the same point.
B. b) Find Rn using iteration.
4.2.219 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 23 (Page No. 511) https://gateoverflow.in/338981
A. Find the recurrence relation satisfied by Sn , where Sn is the number of regions into which three-dimensional space is
divided by n planes if every three of the planes meet in one point, but no four of the planes go through the same point.
B. Find Sn using iteration.
4.2.220 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 24 (Page No. 511) https://gateoverflow.in/338983
Find a recurrence relation for the number of bit sequences of length n with an even number of 0s.
kenneth-rosen discrete-mathematics counting descriptive
4.2.221 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 25 (Page No. 511) https://gateoverflow.in/338984
How many bit sequences of length seven contain an even number of 0s?
kenneth-rosen discrete-mathematics counting descriptive
4.2.222 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 26 (Page No. 512) https://gateoverflow.in/338986
A. Find a recurrence relation for the number of ways to completely cover a 2 × n checkerboard with 1 × 2 dominoes. [Hint:
Consider separately the coverings where the position in the top right corner of the checkerboard is covered by a domino
positioned horizontally and where it is covered by a domino positioned vertically.]
B. What are the initial conditions for the recurrence relation in part (A)?
C. How many ways are there to completely cover a 2 × 17 checkerboard with 1 × 2 dominoes?
4.2.223 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 27 (Page No. 512) https://gateoverflow.in/338987
A. Find a recurrence relation for the number of ways to lay out a walkway with slate tiles if the tiles are red, green, or gray, so
that no two red tiles are adjacent and tiles of the same color are considered indistinguishable.
B. What are the initial conditions for the recurrence relation in part (A)?
C. How many ways are there to lay out a path of seven tiles as described in part (A)?
4.2.224 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 28 (Page No. 512) https://gateoverflow.in/338993
Show that the Fibonacci numbers satisfy the recurrence relation fn = 5fn−4 + 3fn−5 for n = 5, 6, 7, … , together
with the initial conditions f0 = 0, f1 = 1, f2 = 1, f3 = 2, and f4 = 3. Use this recurrence relation to show that f5n
is divisible by 5, for n = 1, 2, 3, … .
kenneth-rosen discrete-mathematics counting descriptive
4.2.225 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 29 (Page No. 512) https://gateoverflow.in/338994
Let S(m, n) denote the number of onto functions from a set with m elements to a set with n elements. Show that
S(m, n) satisfies the recurrence relation
n−1
S(m, n) = nm − ∑ C(n, k)S(m, k)
k=1
4.2.226 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 3 (Page No. 510) https://gateoverflow.in/338906
A vending machine dispensing books of stamps accepts only one-dollar coins, $1 bills, and $5 bills.
A. Find a recurrence relation for the number of ways to deposit n dollars in the vending machine, where the order in which the
coins and bills are deposited matters.
B. What are the initial conditions?
C. How many ways are there to deposit $10 for a book of stamps?
4.2.227 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 30 (Page No. 512) https://gateoverflow.in/338995
A. Write out all the ways the product x0 ⋅ x1 ⋅ x2 ⋅ x3 ⋅ x4 can be parenthesized to determine the order of multiplication.
B. Use the recurrence relation developed in Example 5 to calculate C4 , the number of ways to parenthesize the product of five
numbers so as to determine the order of multiplication. Verify that you listed the correct number of ways in part (A).
C. Check your result in part (B) by finding C4 , using the closed formula for Cn mentioned in the solution of Example 5.
A. Use the recurrence relation developed in Example 5 to determine C5 , the number of ways to parenthesize the product of six
numbers so as to determine the order of multiplication.
B. Check your result with the closed formula for C5 mentioned in the solution of Example 5.
4.2.229 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 32 (Page No. 512) https://gateoverflow.in/338997
In the Tower of Hanoi puzzle, suppose our goal is to transfer all n disks from peg 1 to peg 3, but we cannot move a
disk directly between pegs 1 and 3. Each move of a disk must be a move involving peg 2. As usual, we cannot place a
disk on top of a smaller disk.
A. Find a recurrence relation for the number of moves required to solve the puzzle for n disks with this added restriction.
B. Solve this recurrence relation to find a formula for the number of moves required to solve the puzzle for n disks.
C. How many different arrangements are there of the n disks on three pegs so that no disk is on top of a smaller disk?
D. Show that every allowable arrangement of the n disks occurs in the solution of this variation of the puzzle.
4.2.230 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 33 (Page No. 512) https://gateoverflow.in/338998
Question 33– 37 deal with a variation of the Josephus problem described by Graham, Knuth, and Patashnik in
[Gr Kn Pa 94]. This problem is based on an account by the historian Flavius Josephus, who was part of a band of 41
Jewish rebels trapped in a cave by the Romans during the Jewish Roman war of the first century. The rebels preferred suicide
to capture; they decided to form a circle and to repeatedly count off around the circle, killing every third rebel left alive.
However, Josephus and another rebel did not want to be killed this way; they determined the positions where they should stand
to be the last two rebels remaining alive. The variation we consider begins with n people, numbered 1 to n, standing around a
circle. In each stage, every second person still left alive is eliminated until only one survives. We denote the number of the
survivor by J(n).
4.2.231 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 34 (Page No. 512) https://gateoverflow.in/338999
Question 33– 37 deal with a variation of the Josephus problem described by Graham, Knuth, and Patashnik in
[Gr Kn Pa 94]. This problem is based on an account by the historian Flavius Josephus, who was part of a band of 41
Jewish rebels trapped in a cave by the Romans during the Jewish Roman war of the first century. The rebels preferred suicide
to capture; they decided to form a circle and to repeatedly count off around the circle, killing every third rebel left alive.
However, Josephus and another rebel did not want to be killed this way; they determined the positions where they should stand
to be the last two rebels remaining alive. The variation we consider begins with n people, numbered 1 to n, standing around a
circle. In each stage, every second person still left alive is eliminated until only one survives. We denote the number of the
survivor by J(n).
Use the values you found in question 33 to conjecture a formula for J(n). [Hint: Write n = 2m + k, where m is a
nonnegative integer and k is a nonnegative integer less than 2m. ]
4.2.232 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 35 (Page No. 512) https://gateoverflow.in/339000
Question 33– 37 deal with a variation of the Josephus problem described by Graham, Knuth, and Patashnik in
[Gr Kn Pa 94]. This problem is based on an account by the historian Flavius Josephus, who was part of a band of 41
Jewish rebels trapped in a cave by the Romans during the Jewish Roman war of the first century. The rebels preferred suicide
to capture; they decided to form a circle and to repeatedly count off around the circle, killing every third rebel left alive.
However, Josephus and another rebel did not want to be killed this way; they determined the positions where they should stand
to be the last two rebels remaining alive. The variation we consider begins with n people, numbered 1 to n, standing around a
circle. In each stage, every second person still left alive is eliminated until only one survives. We denote the number of the
survivor by J(n).
Show that J(n) satisfies the recurrence relation
J(2n) = 2J(n) − 1 and J(2n + 1) = 2J(n) + 1, for n ≥ 1, and J(1) = 1.
kenneth-rosen discrete-mathematics counting descriptive
4.2.233 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 36 (Page No. 512) https://gateoverflow.in/339001
Question 33– 37 deal with a variation of the Josephus problem described by Graham, Knuth, and Patashnik in
[Gr Kn Pa 94]. This problem is based on an account by the historian Flavius Josephus, who was part of a band of 41
Jewish rebels trapped in a cave by the Romans during the Jewish Roman war of the first century. The rebels preferred suicide
to capture; they decided to form a circle and to repeatedly count off around the circle, killing every third rebel left alive.
However, Josephus and another rebel did not want to be killed this way; they determined the positions where they should stand
to be the last two rebels remaining alive. The variation we consider begins with n people, numbered 1 to n, standing around a
circle. In each stage, every second person still left alive is eliminated until only one survives. We denote the number of the
survivor by J(n).
Use mathematical induction to prove the formula you conjectured in question 34, making use of the recurrence relation from
question 35.
kenneth-rosen discrete-mathematics counting descriptive
4.2.234 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 37 (Page No. 512) https://gateoverflow.in/339002
Question 33– 37 deal with a variation of the Josephus problem described by Graham, Knuth, and Patashnik in
[Gr Kn Pa 94]. This problem is based on an account by the historian Flavius Josephus, who was part of a band of 41
Jewish rebels trapped in a cave by the Romans during the Jewish Roman war of the first century. The rebels preferred suicide
to capture; they decided to form a circle and to repeatedly count off around the circle, killing every third rebel left alive.
However, Josephus and another rebel did not want to be killed this way; they determined the positions where they should stand
to be the last two rebels remaining alive. The variation we consider begins with n people, numbered 1 to n, standing around a
circle. In each stage, every second person still left alive is eliminated until only one survives. We denote the number of the
survivor by J(n).
Determine J(100), J(1000), and J(10, 000) from your formula for J(n).
4.2.235 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 38 (Page No. 512) https://gateoverflow.in/339003
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
Show that the Reve’s puzzle with three disks can be solved using five, and no fewer, moves.
kenneth-rosen discrete-mathematics counting descriptive
4.2.236 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 39 (Page No. 512) https://gateoverflow.in/339004
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
Show that the Reve’s puzzle with four disks can be solved using nine, and no fewer, moves
kenneth-rosen discrete-mathematics counting descriptive
4.2.237 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 4 (Page No. 510) https://gateoverflow.in/338907
A country uses as currency coins with values of 1 peso, 2 pesos, 5 pesos, and 10 pesos and bills with values of 5 pesos,
10 pesos, 20 pesos, 50 pesos, and 100 pesos. Find a recurrence relation for the number of ways to pay a bill of n pesos
if the order in which the coins and bills are paid matters.
kenneth-rosen discrete-mathematics counting descriptive
4.2.238 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 40 (Page No. 512) https://gateoverflow.in/339005
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
Describe the moves made by the Frame–Stewart algorithm, with k chosen so that the fewest moves are required, for
4.2.239 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 41 (Page No. 512) https://gateoverflow.in/339006
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
Show that if R(n) is the number of moves used by the Frame–Stewart algorithm to solve the Reve’s puzzle with n disks,
where k is chosen to be the smallest integer with n ≤ k(k + 1)/2, then R(n) satisfies the recurrence relation
R(n) = 2R(n − k) + 2k − 1, with R(0) = 0 and R(1) = 1.
kenneth-rosen discrete-mathematics counting descriptive
4.2.240 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 42 (Page No. 512) https://gateoverflow.in/339007
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
Show that if k is as chosen in question 41, then R(n) − R(n − 1) = 2k−1 .
4.2.241 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 43 (Page No. 512) https://gateoverflow.in/339008
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
k
Show that if k is as chosen in question 41, then R(n) = ∑ i2i−1 − (tk − n)2k−1 .
i=1
4.2.242 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 44 (Page No. 512) https://gateoverflow.in/339009
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
Use question 43 to give an upper bound on the number of moves required to solve the Reve’s puzzle for all integers n with
1 ≤ n ≤ 25.
kenneth-rosen discrete-mathematics counting descriptive
4.2.243 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 45 (Page No. 512) https://gateoverflow.in/339011
Question 38– 45 involve the Reve’s puzzle, the variation of the Tower of Hanoi puzzle with four pegs and n disks.
Before presenting these exercises, we describe the Frame–Stewart algorithm for moving the disks from peg 1 to peg 4
so that no disk is ever on top of a smaller one. This algorithm, given the number of disks n as input, depends on a choice of an
integer k with 1 ≤ k ≤ n. When there is only one disk, move it from peg 1 to peg 4 and stop. For n > 1, the algorithm
proceeds recursively, using these three steps. Recursively move the stack of the n − k smallest disks from peg 1 to peg 2,
using all four pegs. Next move the stack of the k largest disks from peg 1 to peg 4, using the three-peg algorithm from the
Tower of Hanoi puzzle without using the peg holding the n − k smallest disks. Finally, recursively move the smallest n − k
disks to peg 4, using all four pegs. Frame and Stewart showed that to produce the fewest moves using their algorithm, k should
be chosen to be the smallest integer such that n does not exceed tk = k(k + 1)/2, the kth triangular number, that is,
tk−1 < n ≤ tk . The unsettled conjecture, known as Frame’s conjecture, is that this algorithm uses the fewest number of
moves required to solve the puzzle, no matter how the disks are moved.
4.2.244 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 46 (Page No. 512) https://gateoverflow.in/339037
Let {an } be a sequence of real numbers. The backward differences of this sequence are defined recursively as shown
next. The first difference ▽an is
▽an = an − an−1 .
▽k+1 an = ▽k an − ▽k an−1 .
Find ▽an for the sequence {an }, where
A. an = 4. B. an = 2n. C. an = n2 . D. an = 2n .
kenneth-rosen discrete-mathematics counting descriptive
4.2.245 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 47 (Page No. 512) https://gateoverflow.in/339038
Let {an } be a sequence of real numbers. The backward differences of this sequence are defined recursively as shown
next. The first difference ▽an is
▽an = an − an−1 .
▽k+1 an = ▽k an − ▽k an−1 .
Find ▽2 an for the sequence {an }, where
A. an = 4. B. an = 2n. C. an = n2 . D. an = 2n .
kenneth-rosen discrete-mathematics counting descriptive
4.2.246 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 48 (Page No. 512) https://gateoverflow.in/339039
Let {an } be a sequence of real numbers. The backward differences of this sequence are defined recursively as shown
next. The first difference ▽an is
▽an = an − an−1 .
▽k+1 an = ▽k an − ▽k an−1 .
4.2.247 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 49 (Page No. 512) https://gateoverflow.in/339040
Let {an } be a sequence of real numbers. The backward differences of this sequence are defined recursively as shown
next. The first difference ▽an is
▽an = an − an−1 .
▽k+1 an = ▽k an − ▽k an−1 .
4.2.248 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 5 (Page No. 510) https://gateoverflow.in/338908
How many ways are there to pay a bill of 17 pesos using the currency described in question 4, where the order in
which coins and bills are paid matters?
kenneth-rosen discrete-mathematics counting descriptive
4.2.249 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 50 (Page No. 512) https://gateoverflow.in/339042
Let {an } be a sequence of real numbers. The backward differences of this sequence are defined recursively as shown
next. The first difference ▽an is
▽an = an − an−1 .
▽k+1 an = ▽k an − ▽k an−1 .
4.2.250 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 51 (Page No. 512) https://gateoverflow.in/339043
Let {an } be a sequence of real numbers. The backward differences of this sequence are defined recursively as shown
next. The first difference ▽an is
▽an = an − an−1 .
▽k+1 an = ▽k an − ▽k an−1 .
4.2.251 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 52 (Page No. 512) https://gateoverflow.in/339044
Let {an } be a sequence of real numbers. The backward differences of this sequence are defined recursively as shown
next. The first difference ▽an is
▽an = an − an−1 .
▽k+1 an = ▽k an − ▽k an−1 .
Show that any recurrence relation for the sequence {an } can be written in terms of an , ▽an , ▽2 an , … The resulting equation
involving the sequences and its differences is called a difference equation.
kenneth-rosen discrete-mathematics counting descriptive
4.2.252 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 53 (Page No. 512) https://gateoverflow.in/339046
Construct the algorithm described in the text after Algorithm 1 for determining which talks should be scheduled to
maximize the total number of attendees and not just the maximum total number of attendees determined by Algorithm
1.
kenneth-rosen discrete-mathematics counting descriptive
4.2.253 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 54 (Page No. 512) https://gateoverflow.in/339047
Use Algorithm 1 to determine the maximum number of total attendees in the talks in Example 6 if wi , the number of
attendees of talk i, i = 1, 2, … , 7, is
A. 20, 10, 50, 30, 15, 25, 40. B. 100, 5, 10, 20, 25, 40, 30.
C. 2, 3, 8, 5, 4, 7, 10. D. 10, 8, 7, 25, 20, 30, 5.
kenneth-rosen discrete-mathematics counting descriptive
4.2.254 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 55 (Page No. 512) https://gateoverflow.in/339048
For each part of question 54, use your algorithm from question 53 to find the optimal schedule for talks so that the total
number of attendees is maximized.
A. 20, 10, 50, 30, 15, 25, 40. B. 100, 5, 10, 20, 25, 40, 30.
C. 2, 3, 8, 5, 4, 7, 10. D. 10, 8, 7, 25, 20, 30, 5.
kenneth-rosen discrete-mathematics counting descriptive
4.2.255 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 56 (Page No. 512) https://gateoverflow.in/339057
In this question, we will develop a dynamic programming algorithm for finding the maximum sum of consecutive
terms of a sequence of real numbers. That is, given a sequence of real numbers a1 , a2 , … , an , the algorithm computes
k
the maximum sum ∑ ai where 1 ≤ j ≤ k ≤ n.
i=j
A. Show that if all terms of the sequence are nonnegative, this problem is solved by taking the sum of all terms. Then, give an
example where the maximum sum of consecutive terms is not the sum of all terms.
B. L e t M(k) be the maximum of the sums of consecutive terms of the sequence ending at ak . That is,
k
M(k) = max 1≤j≤k ∑ ai . Explain why the recurrence relation M(k) = max(M(k − 1) + ak , ak ) holds for
i=j
k = 2, … , n.
C. Use part (B) to develop a dynamic programming algorithm for solving this problem.
D. Show each step your algorithm from part (C) uses to find the maximum sum of consecutive terms of the sequence
2, −3, 4, 1, −2, 3.
E. Show that the worst-case complexity in terms of the number of additions and comparisons of your algorithm from part (C)
is linear.
4.2.256 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 57 (Page No. 512) https://gateoverflow.in/339060
Dynamic programming can be used to develop an algorithm for solving the matrix-chain multiplication problem
introduced in Section 3.3. This is the problem of determining how the product A1 A2 … An can be computed using the
fewest integer multiplications, where A1 , A2 , … , An are m1 × m2 , m2 × m3 , … , mn × mn+1 matrices, respectively, and
each matrix has integer entries. Recall that by the associative law, the product does not depend on the order in which the
matrices are multiplied.
A. Show that the brute-force method of determining the minimum number of integer multiplications needed to solve a matrix-
chain multiplication problem has exponential worst-case complexity. [Hint: Do this by first showing that the order of
multiplication of matrices is specified by parenthesizing the product. Then, use Example 5 and the result of part (A) of
question 41 in Section 8.4.]
B. Denote by Aij the product Ai Ai+1 … , Aj , and M(i, j) the minimum number of integer multiplications required to find
Aij . Show that if the least number of integer multiplications are used to compute Aij , where i < j, by splitting the product
into the product of Ai through Ak and the product of Ak+1 through Aj , then the first k terms must be parenthesized so that
Aik is computed in the optimal way using M(i, k) integer multiplications and Ak+1,j must be parenthesized so that Ak+1,j
is computed in the optimal way using M(k + 1, j) integer multiplications.
C. Explain why part (B) leads to the recurrence relation
M(i, j) = mini≤k<j(M(i, k) + M(k + 1, j) + mi mk+1 mj+1 ) if 1 ≤ i ≤ j < j ≤ n.
D. Use the recurrence relation in part (C) to construct an efficient algorithm for determining the order the n matrices should
be multiplied to use the minimum number of integer multiplications. Store the partial results M(i, j) as you find them so
that your algorithm will not have exponential complexity.
E. Show that your algorithm from part (D) has O(n3 ) worst-case complexity in terms of multiplications of integers.
A. Find a recurrence relation for the number of strictly increasing sequences of positive integers that have 1 as their first term
and n as their last term, where n is a positive integer. That is, sequences a1 , a2 , … , ak , where a1 = 1, ak = n, and
aj < aj+1 for j = 1, 2, … , k − 1.
B. What are the initial conditions?
C. How many sequences of the type described in (A) are there when n is an integer with n ≥ 2?
4.2.258 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 7 (Page No. 510 - 511) https://gateoverflow.in/338910
A. Find a recurrence relation for the number of bit strings of length n that contain a pair of consecutive 0s.
B. What are the initial conditions?
C. How many bit strings of length seven contain two consecutive 0s?
4.2.259 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 8 (Page No. 511) https://gateoverflow.in/338911
A. Find a recurrence relation for the number of bit strings of length n that contain three consecutive 0s.
B. What are the initial conditions?
C. How many bit strings of length seven contain three consecutive 0s?
4.2.260 Counting: Kenneth Rosen Edition 7 Exercise 8.1 Question 9 (Page No. 511) https://gateoverflow.in/338912
A. Find a recurrence relation for the number of bit strings of length n that do not contain three consecutive 0s.
B. What are the initial conditions?
C. How many bit strings of length seven do not contain three consecutive 0s?
4.3.1 Generating Functions: Kenneth Rosen Edition 7 Exercise 8.4 Question 10 (Page No. 549 )
https://gateoverflow.in/246907
Find the coefficient of x9 in the power series of each of these functions.
a) (x3 + x5 + x6 ). (x3 + x4 ). (x + x2 + x3 + x4 + ⋯)
b) (1 + x + x2 )3
4.4.1 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 1 (Page No. 405)
https://gateoverflow.in/338466
Show that in any set of six classes, each meeting regularly once a week on a particular day of the
week, there must be two that meet on the same day, assuming that no classes are held on weekends.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.2 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 10 (Page No. 405)
https://gateoverflow.in/338476
Let (xi , yi ), i = 1, 2, 3, 4, 5, be a set of five distinct points with integer coordinates in the xy
plane. Show that the midpoint of the line joining at least one pair of these points has integer coordinates.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.3 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 11 (Page No. 405)
https://gateoverflow.in/338477
L e t (xi , yi , zi ), i = 1, 2, 3, 4, 5, 6, 7, 8, 9, be a set of nine distinct points with integer
coordinates in xyz space. Show that the midpoint of at least one pair of these points has integer coordinates.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.4 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 12 (Page No. 405)
https://gateoverflow.in/338478
How many ordered pairs of integers (a, b) are needed to guarantee that there are two ordered
pairs (a1 , b1 ) and (a2 , b2 ) such that a1 mod 5 = a2 mod 5 and b1 mod 5 = b2 mod 5?
4.4.5 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 13 (Page No. 405)
https://gateoverflow.in/338479
A. Show that if five integers are selected from the first eight positive integers, there must be a pair of these integers with a sum
equal to 9.
B. Is the conclusion in part (A) true if four integers are selected rather than five?
4.4.6 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 14 (Page No. 405)
https://gateoverflow.in/338480
A. Show that if seven integers are selected from the first 10 positive integers, there must be at least two pairs of these integers
with the sum 11.
B. Is the conclusion in part (A) true if six integers are selected rather than seven?
4.4.7 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 15 (Page No. 405)
https://gateoverflow.in/338482
How many numbers must be selected from the set {1, 2, 3, 4, 5, 6} to guarantee that at least one
pair of these numbers add up to 7?
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.8 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 16 (Page No. 405)
https://gateoverflow.in/338483
How many numbers must be selected from the set {1, 3, 5, 7, 9, 11, 13, 15} to guarantee that at
least one pair of these numbers add up to 16?
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.9 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 17 (Page No. 405)
https://gateoverflow.in/338484
A company stores products in a warehouse. Storage bins in this warehouse are specified by their
aisle, location in the aisle, and shelf. There are 50 aisles, 85 horizontal locations in each aisle, and 5 shelves throughout
the warehouse. What is the least number of products the company can have so that at least two products must be stored in the
same bin?
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.10 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 18 (Page No. 405)
https://gateoverflow.in/338485
Suppose that there are nine students in a discrete mathematics class at a small college.
A. Show that the class must have at least five male students or at least five female students.
B. Show that the class must have at least three male students or at least seven female students.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.11 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 19 (Page No. 405 - 406)
https://gateoverflow.in/338486
Suppose that every student in a discrete mathematics class of 25 students is a freshman, a
sophomore, or a junior.
A. Show that there are at least nine freshmen, at least nine sophomores, or at least nine juniors in the class.
B. Show that there are either at least three freshmen, at least 19 sophomores, or at least five juniors in the class
4.4.12 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 2 (Page No. 405)
https://gateoverflow.in/338467
Show that if there are 30 students in a class, then at least two have last names that begin with the
same letter.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.13 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 20 (Page No. 406)
https://gateoverflow.in/338487
Find an increasing subsequence of maximal length and a decreasing subsequence of maximal
length in the sequence 22, 5, 7, 2, 23, 10, 15, 21, 3, 17.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.14 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 21 (Page No. 406)
https://gateoverflow.in/338506
Construct a sequence of 16 positive integers that has no increasing or decreasing subsequence of
five terms.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.15 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 22 (Page No. 406)
https://gateoverflow.in/338507
Show that if there are 101 people of different heights standing in a line, it is possible to find 11
people in the order they are standing in the line with heights that are either increasing or decreasing.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.16 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 23 (Page No. 406)
https://gateoverflow.in/338508
Show that whenever 25 girls and 25 boys are seated around a circular table there is always a
person both of whose neighbors are boys.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.17 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 24 (Page No. 406)
https://gateoverflow.in/338509
Suppose that 21 girls and 21 boys enter a mathematics competition. Furthermore, suppose that
each entrant solves at most six questions, and for every boy-girl pair, there is at least one question that they both solved.
Show that there is a question that was solved by at least three girls and at least three boys.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.18 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 25 (Page No. 406)
https://gateoverflow.in/338510
Describe an algorithm in pseudocode for producing the largest increasing or decreasing
subsequence of a sequence of distinct integers.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.19 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 26 (Page No. 406)
https://gateoverflow.in/338511
Show that in a group of five people (where any two people are either friends or enemies), there
are not necessarily three mutual friends or three mutual enemies.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.20 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 27 (Page No. 406)
https://gateoverflow.in/338513
Show that in a group of 10 people (where any two people are either friends or enemies), there
are either three mutual friends or four mutual enemies, and there are either three mutual enemies or four mutual friends.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.21 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 28 (Page No. 406)
https://gateoverflow.in/338514
Use question 27 to show that among any group of 20 people (where any two people are either
friends or enemies), there are either four mutual friends or four mutual enemies.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.22 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 29 (Page No. 406)
https://gateoverflow.in/338515
Show that if n is an integer with n ≥ 2, then the Ramsey number R(2, n) equals
n. (Recall that Ramsey numbers were discussed after Example 13 in Section 6.2.)
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.23 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 3 (Page No. 405)
https://gateoverflow.in/338468
A drawer contains a dozen brown socks and a dozen black socks, all unmatched. A man takes
socks out at random in the dark.
A. How many socks must he take out to be sure that he has at least two socks of the same color?
B. How many socks must he take out to be sure that he has at least two black socks?
4.4.24 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 30 (Page No. 406)
https://gateoverflow.in/338517
Show that if m and n are integers with m ≥ 2 and n ≥ 2, then the Ramsey numbers
R(m, n) and R(n, m) are equal.
(Recall that Ramsey numbers were discussed after Example 13 in Section 6.2.)
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.25 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 31 (Page No. 406)
https://gateoverflow.in/338518
Show that there are at least six people in California (population: 37 million) with the same three
initials who were born on the same day of the year (but not necessarily in the same year). Assume that everyone has
three initials.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.26 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 32 (Page No. 406)
https://gateoverflow.in/338520
Show that if there are 100, 000, 000 wage earners in the United States who earn less than
1, 000, 000 dollars (but at least a penny), then there are two who earned exactly the same amount of money, to the
penny, last year.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.27 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 33 (Page No. 406)
https://gateoverflow.in/338521
In the 17th century, there were more than 800, 000 inhabitants of Paris. At the time, it was
believed that no one had more than 200, 000 hairs on their head. Assuming these numbers are correct and that
everyone has at least one hair on their head (that is, no one is completely bald), use the pigeonhole principle to show, as the
French writer Pierre Nicole did, that there had to be two Parisians with the same number of hairs on their heads. Then use the
generalized pigeonhole principle to show that there had to be at least five Parisians at that time with the same number of hairs
on their heads.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.28 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 34 (Page No. 406)
https://gateoverflow.in/338522
Assuming that no one has more than 1, 000, 000 hairs on the head of any person and that the
population of New York City was 8, 008, 278 in 2010, show there had to be at least nine people in NewYork City in
2010 with the same number of hairs on their heads.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.29 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 35 (Page No. 406)
https://gateoverflow.in/338524
There are 38 different time periods during which classes at a university can be scheduled. If
there are 677 different classes, how many different rooms will be needed?
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.30 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 36 (Page No. 406)
https://gateoverflow.in/338526
A computer network consists of six computers. Each computer is directly connected to at least
one of the other computers. Show that there are at least two computers in the network that are directly connected to the
same number of other computers.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.31 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 37 (Page No. 406)
https://gateoverflow.in/338528
A computer network consists of six computers. Each computer is directly connected to zero or
more of the other computers. Show that there are at least two computers in the network that are directly connected to
the same number of other computers. [Hint: It is impossible to have a computer linked to none of the others and a computer
linked to all the others.]
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.32 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 38 (Page No. 406)
https://gateoverflow.in/338529
Find the least number of cables required to connect eight computers to four printers to guarantee
that for every choice of four of the eight computers, these four computers can directly access four different printers.
Justify your answer.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.33 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 39 (Page No. 406)
https://gateoverflow.in/338530
Find the least number of cables required to connect 100 computers to 20 printers to guarantee
that 2 every subset of 20computers can directly access 20 different printers. (Here, the assumptions about cables and
computers are the same as in Example 9.) Justify your answer.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.34 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 4 (Page No. 405)
https://gateoverflow.in/338469
A bowl contains 10 red balls and 10 blue balls. A woman selects balls at random without
looking at them.
A. How many balls must she select to be sure of having at least three balls of the same color?
B. How many balls must she select to be sure of having at least three blue balls?
4.4.35 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 40 (Page No. 406)
https://gateoverflow.in/338531
Prove that at a party where there are at least two people, there are two people who know the
same number of other people there.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.36 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 41 (Page No. 406)
https://gateoverflow.in/338532
An arm wrestler is the champion for a period of 75 hours. (Here, by an hour, we mean a period
starting from an exact hour, such as 1 p.m., until the next hour.) The arm wrestler had at least one match an hour, but
no more than 125 total matches. Show that there is a period of consecutive hours during which the arm wrestler had exactly 24
matches.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.37 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 42 (Page No. 406)
https://gateoverflow.in/338533
Is the statement in question 41 true if 24 is replaced by
4.4.38 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 43 (Page No. 406)
https://gateoverflow.in/338536
Show that if f is a function from S to T, where S and T are nonempty finite sets and
m = ⌈∣ S ∣ / ∣ T ∣⌉ , then there are at least m elements of S mapped to the same value of T. That is, show that there
are distinct elements s1 , s2 , … , sm of S such that f(s1 ) = f(s2 ) = ⋯ = f(sm ).
4.4.39 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 44 (Page No. 406)
https://gateoverflow.in/338538
There are 51 houses on a street. Each house has an address between 1000 and 1099, inclusive.
Show that at least two houses have addresses that are consecutive integers.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.40 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 45 (Page No. 407)
https://gateoverflow.in/338540
Let x be an irrational number. Show that for some positive integer j not exceeding the positive
integer n, the absolute value of the difference between jx and the nearest integer to jx is less than 1/n.
4.4.41 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 46 (Page No. 407)
https://gateoverflow.in/338541
Let n1 , n2 , … , nt be positive integers. Show that if n1 + n2 + ⋯ + nt − t + 1 objects are
placed into t boxes, then for some i, i = 1, 2, … , t, the ith box contains at least ni objects.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.42 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 47 (Page No. 407)
https://gateoverflow.in/338542
An alternative proof of Theorem 3 based on the generalized pigeonhole principle is outlined in
this exercise. The notation used is the same as that used in the proof in the text.
A. Assume that ik ≤ n for k = 1, 2, … , n2 + 1. Use the generalized pigeonhole principle to show that there are n + 1
terms ak1 , ak2 , … , akn+1 with ik1 = ik2 = ⋯ = ikn+1 , where 1 ≤ k1 < k2 < ⋯ < kn+1 .
B. Show that akj > akj+1 for j = 1, 2, … , n. [Hint:Assume that akj < akj+1 , and show that this implies that ikj > ikj+1 ,
which is a contradiction.]
C. Use parts (A) and (B) to show that if there is no increasing subsequence of length n + 1, then there must be a decreasing
subsequence of this length.
4.4.43 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 5 (Page No. 405)
https://gateoverflow.in/338470
Show that among any group of five (not necessarily consecutive) integers, there are two with the
same remainder when divided by 4.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.44 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 6 (Page No. 405)
https://gateoverflow.in/338472
Let d be a positive integer. Show that among any group of d + 1 (not necessarily consecutive)
integers there are two with exactly the same remainder when they are divided by d.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.45 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 7 (Page No. 405)
https://gateoverflow.in/338473
Let n be a positive integer. Show that in any set of n consecutive integers there is exactly one
divisible by n.
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.4.46 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 8 (Page No. 405)
https://gateoverflow.in/338474
Show that if f is a function from S to T, where S and T are finite sets with ∣S ∣>∣ T ∣, then
there are elements s1 and s2 in S such that f(s1 ) = f(s2 ), or in other words, f is not one-to-one.
4.4.47 Pigeonhole Principle: Kenneth Rosen Edition 7 Exercise 6.2 Question 9 (Page No. 405)
https://gateoverflow.in/338475
What is the minimum number of students, each of whom comes from one of the 50 states, who
must be enrolled in a university to guarantee that there are at least 100 who come from the same state?
kenneth-rosen discrete-mathematics counting pigeonhole-principle descriptive
4.5.1 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 1 (Page No. 524) https://gateoverflow.in/339065
Determine which of these are linear homogeneous recurrence relations with constant coefficients. Also, find the degree
of those that are.
A. an = 3an−1 + 4an−2 + 5an−3 B. an = 2nan−1 + an−2
C. an = an−1 + an−4 D. an = an−1 + 2
E. an = a2n−1 + an−2 F. an = an−2
G. an = an−1 + n
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.2 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 10 (Page No. 525) https://gateoverflow.in/339081
Prove Theorem 2 : Let c1 and c2 be real numbers with c2 ≠ 0. Suppose that r2 − c1 r − c2 = 0 has only one root r0 .
A sequence {an } is a solution of the recurrence relation an = c1 an−1 + c2 an−2 if and only if an = α1 rn0 + α2 nrn0 ,
for n = 0, 1, 2, … , where α1 and α2 are constants.
kenneth-rosen discrete-mathematics counting recurrence proof
4.5.3 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 11 (Page No. 525) https://gateoverflow.in/339082
The Lucas numbers satisfy the recurrence relation Ln = Ln−1 + Ln−2 , and the initial conditions L0 = 2 and
L1 = 1.
A. Show that Ln = fn−1 + fn+1 for n = 2, 3, … , where fn is the nth Fibonacci number.
B. Find an explicit formula for the Lucas numbers.
4.5.4 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 12 (Page No. 525) https://gateoverflow.in/339083
4.5.5 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 13 (Page No. 525) https://gateoverflow.in/339084
4.5.6 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 14 (Page No. 525) https://gateoverflow.in/339085
4.5.7 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 15 (Page No. 525) https://gateoverflow.in/339086
4.5.8 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 16 (Page No. 525) https://gateoverflow.in/339100
Prove Theorem 3 :
Let c1 , c2 , … , ck be real numbers. Suppose that the characteristic equation
rk − c1 rk−1 − … – ck = 0
has k distinct roots r1 , r2 , … rk . Then a sequence {an } is a solution of the recurrence relation
4.5.9 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 17 (Page No. 525) https://gateoverflow.in/339102
Prove this identity relating the Fibonacci numbers and the binomial coefficients:
fn+1 = C(n, 0) + C(n − 1, 1) + ⋅ ⋯ + C(n − k, k), where n is a positive integer and k = n/2. [Hint: Let
an = C(n, 0) + C(n − 1, 1) + ⋯ ⋅ +C(n − k, k). Show that the sequence {an } satisfies the same recurrence relation and
initial conditions satisfied by the sequence of Fibonacci numbers.]
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.10 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 18 (Page No. 525) https://gateoverflow.in/339103
Solve the recurrence relation an = 6an−1 − 12an−2 + 8an−3 with a0 = −5, a1 = 4, and a2 = 88.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.11 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 19 (Page No. 525) https://gateoverflow.in/339104
Solve the recurrence relation an = −3an−1 − 3an−2 − an−3 with a0 = 5, a1 = −9, and a2 = 15.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.12 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 2 (Page No. 524) https://gateoverflow.in/339071
Determine which of these are linear homogeneous recurrence relations with constant coefficients. Also, find the degree
of those that are.
A. an = 3an−2 B. an = 3
C. an = a2n−1 D. an = an−1 + 2an−3
E. an = an−1 /n F. an = an−1 + an−2 + n + 3
G. an = 4an−2 + 5an−4 + 9an−7
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.13 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 20 (Page No. 525) https://gateoverflow.in/339105
Find the general form of the solutions of the recurrence relation an = 8an−2 − 16an−4 .
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.14 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 21 (Page No. 525) https://gateoverflow.in/339162
What is the general form of the solutions of a linear homogeneous recurrence relation if its characteristic equation has
roots 1, 1, 1, 1, −2, −2, −2, 3, 3, −4?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.15 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 22 (Page No. 525) https://gateoverflow.in/339163
What is the general form of the solutions of a linear homogeneous recurrence relation if its characteristic equation has
the roots −1, −1, −1, 2, 2, 5, 5, 7?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.16 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 23 (Page No. 525) https://gateoverflow.in/339164
4.5.17 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 24 (Page No. 525) https://gateoverflow.in/339165
4.5.18 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 25 (Page No. 525) https://gateoverflow.in/339166
A. Determine values of the constants A and B such that an = An + B is a solution of recurrence relation
an = 2an−1 + n + 5.
B. Use Theorem 5 to find all solutions of this recurrence relation.
C. Find the solution of this recurrence relation with a0 = 4.
4.5.19 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 26 (Page No. 525) https://gateoverflow.in/339167
What is the general form of the particular solution guaranteed to exist by Theorem 6 of the linear nonhomogeneous
recurrence relation an = 6an−1 − 12an−2 + 8an−3 + F(n) if
A. F(n) = n2 ? B. F(n) = 2n ?
C. F(n) = n2n ? D. F(n) = (−2)n ?
E. F(n) = n2 2n ? F. F(n) = n3 (−2)n ?
G. F(n) = 3?
What is the general form of the particular solution guaranteed to exist by Theorem 6 of the linear nonhomogeneous
recurrence relation an = 8an−2 − 16an−4 + F(n) if
4.5.21 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 28 (Page No. 525) https://gateoverflow.in/339169
4.5.22 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 29 (Page No. 525) https://gateoverflow.in/339170
4.5.23 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 3 (Page No. 524) https://gateoverflow.in/339072
Solve these recurrence relations together with the initial conditions given.
A. an = 2an−1 for n ≥ 1, a0 = 3
B. an = an−1 for n ≥ 1, a0 = 2
C. an = 5an−1 − 6an−2 for n ≥ 2, a0 = 1, a1 = 0
D. an = 4an−1 − 4an−2 for n ≥ 2, a0 = 6, a1 = 8
E. an = −4an−1 − 4an−2 for n ≥ 2, a0 = 0, a1 = 1
F. an = 4an−2 for n ≥ 2, a0 = 0, a1 = 4
G. an = an−2 /4 for n ≥ 2, a0 = 1, a1 = 0
4.5.24 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 30 (Page No. 525) https://gateoverflow.in/339171
4.5.25 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 31 (Page No. 525) https://gateoverflow.in/339172
Find all solutions of the recurrence relation an = 5an−1 − 6an−2 + 2n + 3n. [Hint: Look for a particular solution of
the form qn2n + p1 n + p2 , where q, p1 , and p2 are constants.]
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.26 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 32 (Page No. 525) https://gateoverflow.in/339173
4.5.27 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 33 (Page No. 525) https://gateoverflow.in/339174
4.5.28 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 34 (Page No. 526) https://gateoverflow.in/339175
4.5.29 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 35 (Page No. 526) https://gateoverflow.in/339177
Find the solution of the recurrence relation an = 4an−1 − 3an−2 + 2n + n + 3 with a0 = 1 and a1 = 4.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.30 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 36 (Page No. 526) https://gateoverflow.in/339178
n
Let an be the sum of the first n perfect squares, that is, an = ∑ k2 . Show that the sequence {an } satisfies the linear
k=1
nonhomogeneous recurrence relation an = an−1 + n2 and the initial condition a1 = 1. Use
Theorem 6 to determine a formula for an by solving this recurrence relation.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.31 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 37 (Page No. 526) https://gateoverflow.in/339205
4.5.32 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 38 (Page No. 526) https://gateoverflow.in/339206
A. Find the characteristic roots of the linear homogeneous recurrence relation an = 2an−1 − 2an−2 . [Note: These are
complex numbers.]
B. Find the solution of the recurrence relation in part (A) with a0 = 1 and a1 = 2.
4.5.33 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 39 (Page No. 526) https://gateoverflow.in/339207
A. a) Find the characteristic roots of the linear homogeneous recurrence relation an = an−4 . [Note: These include complex
numbers.]
B. Find the solution of the recurrence relation in part (A) with a0 = 1, a1 = 0, a2 = −1, and a3 = 1.
Solve these recurrence relations together with the initial conditions given.
4.5.35 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 40 (Page No. 526) https://gateoverflow.in/339209
an = 3an−1 + 2bn−1
bn = an−1 + 2bn−1
with a0 = 1 and b0 = 2.
4.5.36 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 41 (Page No. 526) https://gateoverflow.in/339214
A. Use the formula found in Example 4 for fn , the nth Fibonacci number, to show that fn is the integer closest to
– n
1 1 + √5
( )
√–5 2
4.5.37 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 42 (Page No. 526) https://gateoverflow.in/339215
Show that if an = an−1 + an−2 , a0 = s and a1 = t, where s and t are constants, then an = sfn−1 + tfn for all
positive integers n.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.38 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 43 (Page No. 526) https://gateoverflow.in/339216
4.5.39 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 44 (Page No. 526) https://gateoverflow.in/339217
(Linear algebra required ) Let An be the n × n matrix with 2s on its main diagonal, 1s in all positions next to a
diagonal element, and 0s everywhere else. Find a recurrence relation for dn , the determinant of An . Solve this
recurrence relation to find a formula for dn .
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.40 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 45 (Page No. 526) https://gateoverflow.in/339218
Suppose that each pair of a genetically engineered species of rabbits left on an island produces two new pairs of rabbits
at the age of 1 month and six new pairs of rabbits at the age of 2 months and every month afterward. None of the
rabbits ever die or leave the island.
A. Find a recurrence relation for the number of pairs of rabbits on the island n months after one newborn pair is left on the
island.
B. By solving the recurrence relation in (A) determine the number of pairs of rabbits on the island n months after one pair is
left on the island.
4.5.41 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 46 (Page No. 526) https://gateoverflow.in/339220
Suppose that there are two goats on an island initially.The number of goats on the island doubles every year by natural
reproduction, and some goats are either added or removed each year.
A. Construct a recurrence relation for the number of goats on the island at the start of the nth year, assuming that during each
year an extra 100 goats are put on the island.
B. Solve the recurrence relation from part (A) to find the number of goats on the island at the start of the nth year.
C. Construct a recurrence relation for the number of goats on the island at the start of the nth year, assuming that n goats are
removed during the nth year for each n ≥ 3.
4.5.42 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 47 (Page No. 526) https://gateoverflow.in/339221
A new employee at an exciting new software company starts with a salary of $50, 000 and is promised that at the end
of each year her salary will be double her salary of the previous year, with an extra increment of $10, 000 for each year
she has been with the company.
A. Construct a recurrence relation for her salary for her nth year of employment.
B. Solve this recurrence relation to find her salary for her nth year of employment.
4.5.43 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 48 (Page No. 526) https://gateoverflow.in/339223
Some linear recurrence relations that do not have constant coefficients can be systematically solved. This is the case for
recurrence relations of the form f(n)an = g(n)an−1 + h(n). Exercises 48– 50 illustrate this.
A. Show that the recurrence relation f(n)an = g(n)an−1 + h(n), for n ≥ 1, and with a0 = C, can be reduced to a
recurrence relation of the form bn = bn−1 + Q(n)h(n), where bn = g(n + 1)Q(n + 1)an , with
(f(1)f(2) … f(n − 1))
Q(n) = .
(g(1)g(2) … g(n))
n
C + ∑ Q(i)h(i)
i=1
B. Use part (A) to solve the original recurrence relation to obtain an =
g(n + 1)Q(n + 1)
4.5.44 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 49 (Page No. 527) https://gateoverflow.in/339224
Use question 48 to solve the recurrence relation (n + 1)an = (n + 3)an−1 + n, for n ≥ 1, with a0 = 1
How many different messages can be transmitted in n microseconds using the two signals described in question 19 in
Section 8.1?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.46 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 50 (Page No. 527) https://gateoverflow.in/339228
It can be shown that Cn, the average number of comparisons made by the quick sort algorithm (described in preamble
to question 50 in exercise 5.4), when sorting n elements in random order, satisfies the recurrence relation
2 n−1
Cn = 1 + n + ∑ Ck
n k=0
A. Show that {Cn } also satisfies the recurrence relation nCn = (n + 1)Cn−1 + 2n for n = 1, 2, …
B. Use question 48 to solve the recurrence relation in part (A) to find an explicit formula for Cn .
4.5.47 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 51 (Page No. 527) https://gateoverflow.in/339231
Prove Theorem 4 : Let c1 , c2 , … , ck be real numbers. Suppose that the characteristic equation
rk − c1 rk−1 − … ck = 0
if and only if
an = (α1 , 0 + α1,1n + ⋯ + α1,m1 −1 nm1 −1 )rn1 + (α1 , 0 + α2,1 n … α1,m2 −1 nm2 −1 )rn2 + ⋯ + (αt , 0 + αt,1 n … αt,mt −1 nmt −
4.5.48 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 52 (Page No. 527) https://gateoverflow.in/339232
Prove Theorem 6 :Suppose that {an } satisfies the liner nonhomogeneous recurrence relation
where b0 , b1 , … , bt and s are real numbers. When s is is not a root of the characteristic equation of the associated linear
homogeneous recurrence relation, there is a particular solution of the form
4.5.49 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 53 (Page No. 527) https://gateoverflow.in/339230
Solve the recurrence relation T(n) = nT 2 (n/2) with initial condition T(1) = 6 when n = 2k for some integer k.
[Hint: Let n = 2k and then make the substitution ak = log T(2k ) to obtain a linear nonhomogeneous recurrence
relation.]
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.50 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 6 (Page No. 524) https://gateoverflow.in/339075
How many different messages can be transmitted in n microseconds using three different signals if one signal requires
1 microsecond for transmittal, the other two signals require 2 microseconds each for transmittal, and a signal in a
message is followed immediately by the next signal?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.51 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 7 (Page No. 524) https://gateoverflow.in/339076
In how many ways can a 2 × n rectangular checkerboard be tiled using 1 × 2 and 2 × 2 pieces?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.52 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 8 (Page No. 524 - 525) https://gateoverflow.in/339077
A model for the number of lobsters caught per year is based on the assumption that the number of lobsters caught in a
year is the average of the number caught in the two previous years.
A. Find a recurrence relation for {Ln }, where Ln is the number of lobsters caught in year n, under the assumption for this
model.
B. Find Ln if 100, 000 lobsters were caught in year 1 and 300, 000 were caught in year 2.
4.5.53 Recurrence: Kenneth Rosen Edition 7 Exercise 8.2 Question 9 (Page No. 525) https://gateoverflow.in/339079
A deposit of $100, 000 is made to an investment fund at the beginning of a year. On the last day of each year two
dividends are awarded. The first dividend is 20% of the amount in the account during that year. The second dividend is
45% of the amount in the account in the previous year.
A. Find a recurrence relation for {P n}, where Pn is the amount in the account at the end of n years if no money is ever
withdrawn.
B. How much is in the account after n years if no money has been withdrawn?
4.5.54 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 1 (Page No. 535) https://gateoverflow.in/339391
How many comparisons are needed for a binary search in a set of 64 elements?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.55 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 10 (Page No. 535) https://gateoverflow.in/339401
Find f(n) when n = 2k , where f satisfies the recurrence relation f(n) = f(n/2) + 1 with f(1) = 1.
4.5.57 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 12 (Page No. 535) https://gateoverflow.in/339403
Find f(n) when n = 3k, where f satisfies the recurrence relation f(n) = 2f(n/3) + 4 with f(1) = 1.
4.5.58 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 13 (Page No. 535) https://gateoverflow.in/339404
Give a big-O estimate for the function f given below if f is an increasing function.
4.5.59 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 14 (Page No. 535) https://gateoverflow.in/339405
Suppose that there are n = 2k teams in an elimination tournament, where there are n2 games in the first round, with the
n = 2k−1 winners playing in the second round, and so on. Develop a recurrence relation for the number of rounds in
2
the tournament.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.60 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 15 (Page No. 535) https://gateoverflow.in/339406
How many rounds are in the elimination tournament described in question 14 when there are 32 teams?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.61 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 16 (Page No. 535) https://gateoverflow.in/339407
Solve the recurrence relation for the number of rounds in the tournament described in question 14.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.62 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 2 (Page No. 535) https://gateoverflow.in/339393
How many comparisons are needed to locate the maximum and minimum elements in a sequence with 128 elements
using the algorithm in Example 2?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.63 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 3 (Page No. 535) https://gateoverflow.in/339394
4.5.64 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 4 (Page No. 535) https://gateoverflow.in/339395
4.5.65 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 5 (Page No. 535) https://gateoverflow.in/339396
Determine a value for the constant C in Example 4 and use it to estimate the number of bit operations needed to
multiply two 64-bit integers using the fast multiplication algorithm.
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.66 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 6 (Page No. 535) https://gateoverflow.in/339397
How many operations are needed to multiply two 32 × 32 matrices using the algorithm referred to in Example 5?
kenneth-rosen discrete-mathematics counting recurrence descriptive
4.5.67 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 7 (Page No. 535) https://gateoverflow.in/339398
Suppose that f(n) = f(n/3) + 1 when n is a positive integer divisible by 3, and f(1) = 1. Find
A. f(3)
B. f(27)
C. f(729)
4.5.68 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 8 (Page No. 535) https://gateoverflow.in/339399
Suppose that f(n) = 2f(n/2) + 3 when n is an even positive integer, and f(1) = 5. Find
4.5.69 Recurrence: Kenneth Rosen Edition 7 Exercise 8.3 Question 9 (Page No. 535) https://gateoverflow.in/339400
Suppose that f(n) = f(n/5) + 3n2 when n is a positive integer divisible by 5, and f(1) = 4. Find
A. f(5)
B. f(125)
C. f(3125)
Answer Keys
4.1.1 N/A 4.1.2 N/A 4.1.3 N/A 4.1.4 N/A 4.1.5 N/A
4.1.6 N/A 4.1.7 N/A 4.1.8 N/A 4.1.9 N/A 4.1.10 N/A
4.1.11 N/A 4.1.12 N/A 4.1.13 N/A 4.1.14 N/A 4.1.15 N/A
4.1.16 N/A 4.1.17 N/A 4.1.18 N/A 4.1.19 N/A 4.1.20 N/A
4.1.21 N/A 4.1.22 N/A 4.1.23 N/A 4.1.24 N/A 4.1.25 N/A
4.1.26 N/A 4.1.27 N/A 4.1.28 N/A 4.1.29 N/A 4.1.30 N/A
4.1.31 N/A 4.1.32 N/A 4.1.33 N/A 4.1.34 N/A 4.1.35 N/A
4.1.36 N/A 4.1.37 N/A 4.1.38 N/A 4.1.39 N/A 4.2.1 N/A
4.2.2 N/A 4.2.3 N/A 4.2.4 N/A 4.2.5 N/A 4.2.6 N/A
4.2.7 N/A 4.2.8 N/A 4.2.9 N/A 4.2.10 N/A 4.2.11 N/A
4.2.12 N/A 4.2.13 N/A 4.2.14 N/A 4.2.15 N/A 4.2.16 N/A
4.2.17 N/A 4.2.18 N/A 4.2.19 N/A 4.2.20 N/A 4.2.21 N/A
4.2.22 N/A 4.2.23 N/A 4.2.24 N/A 4.2.25 N/A 4.2.26 N/A
4.2.27 N/A 4.2.28 N/A 4.2.29 N/A 4.2.30 N/A 4.2.31 N/A
4.2.32 N/A 4.2.33 N/A 4.2.34 N/A 4.2.35 N/A 4.2.36 N/A
4.2.37 N/A 4.2.38 N/A 4.2.39 N/A 4.2.40 N/A 4.2.41 N/A
4.2.42 N/A 4.2.43 N/A 4.2.44 N/A 4.2.45 N/A 4.2.46 N/A
4.2.47 N/A 4.2.48 N/A 4.2.49 N/A 4.2.50 N/A 4.2.51 N/A
4.2.52 N/A 4.2.53 N/A 4.2.54 N/A 4.2.55 N/A 4.2.56 N/A
4.2.57 N/A 4.2.58 N/A 4.2.59 N/A 4.2.60 N/A 4.2.61 N/A
4.2.62 N/A 4.2.63 N/A 4.2.64 N/A 4.2.65 N/A 4.2.66 N/A
4.2.67 N/A 4.2.68 N/A 4.2.69 N/A 4.2.70 N/A 4.2.71 N/A
4.2.72 N/A 4.2.73 N/A 4.2.74 N/A 4.2.75 N/A 4.2.76 N/A
4.2.77 N/A 4.2.78 N/A 4.2.79 N/A 4.2.80 N/A 4.2.81 N/A
4.2.82 N/A 4.2.83 N/A 4.2.84 N/A 4.2.85 N/A 4.2.86 N/A
4.2.87 N/A 4.2.88 N/A 4.2.89 N/A 4.2.90 N/A 4.2.91 N/A
4.2.92 N/A 4.2.93 N/A 4.2.94 N/A 4.2.95 N/A 4.2.96 N/A
4.2.97 N/A 4.2.98 N/A 4.2.99 N/A 4.2.100 N/A 4.2.101 N/A
4.2.102 N/A 4.2.103 N/A 4.2.104 N/A 4.2.105 N/A 4.2.106 N/A
4.2.107 N/A 4.2.108 N/A 4.2.109 N/A 4.2.110 N/A 4.2.111 N/A
4.2.112 N/A 4.2.113 N/A 4.2.114 N/A 4.2.115 N/A 4.2.116 N/A
4.2.117 N/A 4.2.118 N/A 4.2.119 N/A 4.2.120 N/A 4.2.121 N/A
4.2.122 Q-Q 4.2.123 N/A 4.2.124 N/A 4.2.125 N/A 4.2.126 N/A
4.2.127 N/A 4.2.128 N/A 4.2.129 N/A 4.2.130 N/A 4.2.131 N/A
4.2.132 N/A 4.2.133 N/A 4.2.134 N/A 4.2.135 N/A 4.2.136 N/A
4.2.137 N/A 4.2.138 N/A 4.2.139 N/A 4.2.140 N/A 4.2.141 N/A
4.2.142 N/A 4.2.143 N/A 4.2.144 N/A 4.2.145 N/A 4.2.146 N/A
4.2.147 N/A 4.2.148 N/A 4.2.149 N/A 4.2.150 N/A 4.2.151 N/A
4.2.152 N/A 4.2.153 N/A 4.2.154 N/A 4.2.155 N/A 4.2.156 N/A
4.2.157 N/A 4.2.158 N/A 4.2.159 N/A 4.2.160 N/A 4.2.161 N/A
4.2.162 N/A 4.2.163 N/A 4.2.164 N/A 4.2.165 N/A 4.2.166 N/A
4.2.167 N/A 4.2.168 N/A 4.2.169 N/A 4.2.170 N/A 4.2.171 N/A
4.2.172 N/A 4.2.173 N/A 4.2.174 N/A 4.2.175 N/A 4.2.176 N/A
4.2.177 N/A 4.2.178 N/A 4.2.179 N/A 4.2.180 N/A 4.2.181 N/A
4.2.182 N/A 4.2.183 N/A 4.2.184 N/A 4.2.185 N/A 4.2.186 N/A
4.2.187 N/A 4.2.188 N/A 4.2.189 N/A 4.2.190 N/A 4.2.191 N/A
4.2.192 N/A 4.2.193 N/A 4.2.194 N/A 4.2.195 N/A 4.2.196 N/A
4.2.197 N/A 4.2.198 N/A 4.2.199 N/A 4.2.200 N/A 4.2.201 N/A
4.2.202 N/A 4.2.203 N/A 4.2.204 N/A 4.2.205 N/A 4.2.206 N/A
4.2.207 N/A 4.2.208 N/A 4.2.209 N/A 4.2.210 N/A 4.2.211 N/A
4.2.212 N/A 4.2.213 N/A 4.2.214 N/A 4.2.215 N/A 4.2.216 N/A
4.2.217 N/A 4.2.218 N/A 4.2.219 N/A 4.2.220 N/A 4.2.221 N/A
4.2.222 N/A 4.2.223 N/A 4.2.224 N/A 4.2.225 N/A 4.2.226 N/A
4.2.227 N/A 4.2.228 N/A 4.2.229 N/A 4.2.230 N/A 4.2.231 N/A
4.2.232 N/A 4.2.233 N/A 4.2.234 N/A 4.2.235 N/A 4.2.236 N/A
4.2.237 N/A 4.2.238 N/A 4.2.239 N/A 4.2.240 N/A 4.2.241 N/A
4.2.242 N/A 4.2.243 N/A 4.2.244 N/A 4.2.245 N/A 4.2.246 N/A
4.2.247 N/A 4.2.248 N/A 4.2.249 N/A 4.2.250 N/A 4.2.251 N/A
4.2.252 N/A 4.2.253 N/A 4.2.254 N/A 4.2.255 N/A 4.2.256 N/A
4.2.257 N/A 4.2.258 N/A 4.2.259 N/A 4.2.260 N/A 4.3.1 Q-Q
4.4.1 N/A 4.4.2 N/A 4.4.3 N/A 4.4.4 N/A 4.4.5 N/A
4.4.6 N/A 4.4.7 N/A 4.4.8 N/A 4.4.9 N/A 4.4.10 N/A
4.4.11 N/A 4.4.12 N/A 4.4.13 N/A 4.4.14 N/A 4.4.15 N/A
4.4.16 N/A 4.4.17 N/A 4.4.18 N/A 4.4.19 N/A 4.4.20 N/A
4.4.21 N/A 4.4.22 N/A 4.4.23 N/A 4.4.24 N/A 4.4.25 N/A
4.4.26 N/A 4.4.27 N/A 4.4.28 N/A 4.4.29 N/A 4.4.30 N/A
4.4.31 N/A 4.4.32 N/A 4.4.33 N/A 4.4.34 N/A 4.4.35 N/A
4.4.36 N/A 4.4.37 N/A 4.4.38 N/A 4.4.39 N/A 4.4.40 N/A
4.4.41 N/A 4.4.42 N/A 4.4.43 N/A 4.4.44 N/A 4.4.45 N/A
4.4.46 N/A 4.4.47 N/A 4.5.1 N/A 4.5.2 N/A 4.5.3 N/A
4.5.4 N/A 4.5.5 N/A 4.5.6 N/A 4.5.7 N/A 4.5.8 N/A
4.5.9 N/A 4.5.10 N/A 4.5.11 N/A 4.5.12 N/A 4.5.13 N/A
4.5.14 N/A 4.5.15 N/A 4.5.16 N/A 4.5.17 N/A 4.5.18 N/A
4.5.19 N/A 4.5.20 N/A 4.5.21 N/A 4.5.22 N/A 4.5.23 N/A
4.5.24 N/A 4.5.25 N/A 4.5.26 N/A 4.5.27 N/A 4.5.28 N/A
4.5.29 N/A 4.5.30 N/A 4.5.31 N/A 4.5.32 N/A 4.5.33 N/A
4.5.34 N/A 4.5.35 N/A 4.5.36 N/A 4.5.37 N/A 4.5.38 N/A
4.5.39 N/A 4.5.40 N/A 4.5.41 N/A 4.5.42 N/A 4.5.43 N/A
4.5.44 N/A 4.5.45 N/A 4.5.46 N/A 4.5.47 N/A 4.5.48 N/A
4.5.49 N/A 4.5.50 N/A 4.5.51 N/A 4.5.52 N/A 4.5.53 N/A
4.5.54 N/A 4.5.55 N/A 4.5.56 N/A 4.5.57 N/A 4.5.58 N/A
4.5.59 N/A 4.5.60 N/A 4.5.61 N/A 4.5.62 N/A 4.5.63 N/A
4.5.64 N/A 4.5.65 N/A 4.5.66 N/A 4.5.67 N/A 4.5.68 N/A
4.5.69 N/A
5 Discrete Mathematics: Graph Theory (1)
5.1.1 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 10.8 Question 23 (Page No. 734) https://gateoverflow.in/136736
Answer Keys
5.1.1 Q-Q
6 Discrete Mathematics: Mathematical Logic (222)
6.0.1 Kenneth Rosen Edition 7 Exercise 1.5 Question 14 (Page No. 66) https://gateoverflow.in/306578
Use quantifiers and predicates with more than one variable to express these statements.
6.1.1 First Order Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 31 (Page No. 54) https://gateoverflow.in/306504
a) ∀y Q(0, y, 0)
b) ∃x Q(x, 1, 1)
c) ∃z ¬Q(0, 0, z)
d) ∃x ¬Q(x, 0, 1)
kenneth-rosen discrete-mathematics mathematical-logic first-order-logic
6.2.1 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 1 (Page No. 12) https://gateoverflow.in/42591
Which of these sentences are propositions? What are the truth values of those that are propositions?
6.2.2 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 2 (Page No. 12) https://gateoverflow.in/42626
Which of these are propositions?What are the truth values of those that are propositions?
A. Do not pass go. B. What time is it?
C. There are no black flies in Maine. D. 4 + x = 5.
E. The moon is made of green cheese. F. 2n ≥ 100
kenneth-rosen mathematical-logic discrete-mathematics
6.2.3 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 3 (Page No. 12) https://gateoverflow.in/42627
6.2.4 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 4 (Page No. 12) https://gateoverflow.in/42628
6.2.5 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 40 (Page No. 16) https://gateoverflow.in/42843
Explain, without using a truth table, why(p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p) is true when p, q, and r have the same truth
value and it is false otherwise.
mathematical-logic discrete-mathematics kenneth-rosen descriptive
6.2.6 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 41 (Page No. 16) https://gateoverflow.in/42844
Explain, without using a truth table, why (p ∨ q ∨ r) ∧ (¬p ∨ ¬q ∨ ¬r) is true when at least one of p, q, and r is true
and at least one is false, but is false when all three variables have the same truth value.
kenneth-rosen discrete-mathematics mathematical-logic descriptive
6.2.7 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 5 (Page No. 13) https://gateoverflow.in/42629
A. Steve has more than 100 GB free disk space on his laptop.
B. Zach blocks e-mails and texts from Jennifer.
C. 7 · 11 · 13 = 999.
D. Diane rode her bicycle 100 miles on Sunday.
6.2.8 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 6 (Page No. 13) https://gateoverflow.in/42630
Suppose that SmartphoneA has 256 MB RAM and 32 GB ROM, and the resolution of its camera is 8 MP; Smartphone
B has 288 MB RAM and 64 GB ROM, and the resolution of its camera is 4 MP; and Smartphone C has 128 MB RAM
and 32 GB ROM, and the resolution of its camera is 5 MP. Determine the truth value of each of these propositions.
6.2.9 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.1 Question 7 (Page No. 13) https://gateoverflow.in/42631
Suppose that during the most recent fiscal year, the annual revenue of Acme Computer was 138 billion dollars and its
net profit was 8 billion dollars, the annual revenue of Nadir Software was 87 billion dollars and its net profit was 5
billion dollars, and the annual revenue of Quixote Media was 111 billion dollars and its net profit was 13 billion dollars.
Determine the truth value of each ofthese propositions for the most recent fiscal year.
6.2.10 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 1 (Page No. 22) https://gateoverflow.in/42914
Translate the given statement into propositional logic using the propositions provided.
You cannot edit a protected Wikipedia entry unless you are an administrator.
Express your answer in terms of e: “You can edit a protected Wikipedia entry”
and a: “You are an administrator.”
kenneth-rosen discrete-mathematics mathematical-logic
6.2.11 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 10 (Page No. 23) https://gateoverflow.in/42924
Are these system specifications consistent? “Whenever the system software is being upgraded, users cannot access the
file system. If users can access the file system, then they can save new files. If users cannot save new files, then the
system software is not being upgraded.”
kenneth-rosen discrete-mathematics mathematical-logic
6.2.12 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 12 (Page No. 23) https://gateoverflow.in/42927
Are these system specifications consistent? “If the file system is not locked, then new messages will be queued. If the
file system is not locked, then the system is functioning normally, and conversely. If new messages are not queued,
then they will be sent to the message buffer. If the file system is not locked, then new messages will be sent to the message
buffer. New messages will not be sent to the message buffer.”
kenneth-rosen discrete-mathematics mathematical-logic
6.2.13 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 13 (Page No. 23) https://gateoverflow.in/306059
What Boolean search would you use to look for Web pages about beaches in New Jersey? what if you wanted to find
Web pages about beaches on the isle of Jersey(in the English Channel)
kenneth-rosen discrete-mathematics mathematical-logic
6.2.14 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 15 (Page No. 23) https://gateoverflow.in/306060
Each inhabitant of a remote village always tells the truth or always lies. A villager will give only a “Yes” or a “No”
response to a question a tourist asks. Suppose you are a tourist visiting this area and come to a fork in the road. One
branch leads to the ruins you want to visit; The other branch leads deep into the jungle. A villager is standing at the fork in the
road. What one question can you ask the villager to determine which branch to take?
kenneth-rosen discrete-mathematics mathematical-logic difficult
6.2.15 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 16 (Page No. 23) https://gateoverflow.in/130668
6.2.16 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 17 (Page No. 23) https://gateoverflow.in/306061
When three professors are seated in a restaurant, the hostess asks them: “Does everyone want coffee ?” The first
professor says: “I do not know.” The second professor then says: “I do not know.” Finally, the third professor says:
“No, not everyone wants coffee.” The hostess comes back and gives coffee to the professors who want it. How did she figure
out who wanted coffee?
kenneth-rosen discrete-mathematics mathematical-logic
6.2.17 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 2 (Page No. 22) https://gateoverflow.in/42915
Translate the given statement into propositional logic using the propositions provided.
You can see the movie only if you are over 18 years old or you have the permission of a parent. Express your answer in
terms of
m: “You can see the movie,”
e: “You are over 18 years old,”
and p: “You have the permission of a parent.”
6.2.18 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 20 (Page No. 23) https://gateoverflow.in/306066
relate to inhabitants of the island of knights and knaves created by Smullyan, where knights always tell the truth always
lie. You encounter two people. A and B. Determine, if possible, what A and B are if they address you in the ways
described. If you can not determine what these people are, can you draw any conclusions?
6.2.19 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 21 (Page No. 23) https://gateoverflow.in/306067
relate to inhabitants of the island of knights and knaves created by Smullyan, where knights always tell the truth always
lie. You encounter two people. A and B. Determine, if possible, what A and B are if they address you in the ways
described. If you can not determine what these people are, can you draw any conclusions?
6.2.20 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 22 (Page No. 23) https://gateoverflow.in/306068
Relate to inhabitants of the island of knights and knaves created by Smullyan, where knights always tell the truth and
knaves always lie. You encounter two people, A and B. Determine, if possible, what A and B are if they address you
in the ways described. If you can not determine what these people are, can you draw any conclusions ?
6.2.21 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 23 (Page No. 23) https://gateoverflow.in/306071
Relate to inhabitants of the island of knights and knaves created by Smullyan, where knights always tell the truth and
knaves always lie. You encounter two people, A and B. Determine, if possible, what A and B are if they address you
in the ways described. If you can not determine what these people are, can you draw any conclusions?
6.2.22 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 3 (Page No. 22) https://gateoverflow.in/42917
Translate the given statement into propositional logic using the propositions provided.
You can graduate only if you have completed the requirements of your major and you do not owe money to the
university and you do not have an overdue library book. Express your answer in terms of
g: “You can graduate,”
m: “You owe money to the university,”
r: “You have completed the requirements of your major,”
and b: “You have an overdue library book.”
6.2.23 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 32 (Page No. 23) https://gateoverflow.in/306074
The police have three suspects for the murder of Mr. Cooper: Mr. Smith, Mr Jones, Mr. Williams. Smith Jones, and
Williams each declare that they did not kill Cooper. Smith also states that Cooper was friend of Jones and that Williams
disliked him. Jones also states that he did not know Cooper and that he was out of town the day Cooper was killed. Williams
also states that he saw both Smith and Jones with Cooper the day of the killing and that either Smith or Jones must have killed
him. Can you determine who the murderer was if
a. one of the three men is guilt, the two innocent men are telling the truth, but the statements of the guilty man may or may not
b true?
b. innocent men do not lie?
6.2.24 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 4 (Page No. 22) https://gateoverflow.in/42918
Translate the given statement into propositional logic using the propositions provided.
To use the wireless network in the airport you must pay the daily fee unless you are a subscriber to the service.Express
your answer in terms of
w: “You can use the wireless network in the airport,”
d: “You pay the daily fee,”
and s: “You are a subscriber to the service.”
6.2.25 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 5 (Page No. 22) https://gateoverflow.in/42919
Translate the given statement into propositional logic using the propositions provided.
You are eligible to be President of the U.S.A. only if you are at least 35 years old, were born in the U.S.A, or at the time
of your birth both of your parents were citizens, and you have lived at least 14 years in the country.
Express your answer in terms of
e: “You are eligible to be President of the U.S.A.,”
a: “You are at least 35 years old,”
b: “You were born in the U.S.A,” p: “At the time of your birth, both of your parents where citizens,”
and r: “You have lived at least 14 years in the U.S.A.”
6.2.26 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 6 (Page No. 22) https://gateoverflow.in/42920
Translate the given statement into propositional logic using the propositions provided.
You can upgrade your operating system only if you have a 32-bit processor running at 1 GHz or faster, at least 1 GB
RAM, and 16 GB free hard disk space, or a 64-bit processor running at 2 GHz or faster, at least 2 GB RAM, and at least 32 GB
free hard disk space. Express you answer in terms of
u: “You can upgrade your operating system,”
b32 : “You have a 32-bit processor,”
b64 :“You have a 64-bit processor,” g1: “Your processor runs at 1 GHz or faster,”
g2 : “Your processor runs at 2 GHz or faster,”
r1 : “Your processor has at least 1 GB RAM,”
r2 : “Your processor has at least 2 GB RAM,”
h16 : “You have at least 16 GB free hard disk space,”
and h32 : “You have at least 32 GB free hard disk space.”
6.2.27 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 7 (Page No. 22) https://gateoverflow.in/42921
Express these system specifications using the propositions p “The message is scanned for viruses” and q “The message
was sent from an unknown system” together with logical connectives (including negations).
a. “The message is scanned for viruses whenever the message was sent from an unknown system.”
b. “The message was sent from an unknown system but it was not scanned for viruses.”
c. “It is necessary to scan the message for viruses whenever it was sent from an unknown system.”
d. “When a message is not sent from an unknown system it is not scanned for viruses.”
Express these system specifications using the propositions p “The user enters a valid password,” q “Access is granted,”
and r “The user has paid the subscription fee” and logical connectives (including negations).
a. “The user has paid the subscription fee, but does not enter a valid password.”
b. “Access is granted whenever the user has paid the subscription fee and enters a valid password.”
c. “Access is denied if the user has not paid the subscription fee.”
d. “If the user has not entered a valid password but has paid the subscription fee, then access is granted.”
6.2.29 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 9 (Page No. 22) https://gateoverflow.in/42923
Are these system specifications consistent? “The system is in multi-user state if and only if it is operating normally. If
the system is operating normally, the kernel is functioning. The kernel is not functioning or the system is in interrupt
mode. If the system is not in multiuser state, then it is in interrupt mode. The system is not in interrupt mode.
kenneth-rosen discrete-mathematics mathematical-logic
6.2.30 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.7 Question 1 (Page No. 91) https://gateoverflow.in/306909
Use a direct proof to show that the sum of two odd integers is even.
kenneth-rosen discrete-mathematics mathematical-logic
6.2.31 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.7 Question 2 (Page No. 91) https://gateoverflow.in/306910
Use a direct proof to show that the sum of two even integers is even.
kenneth-rosen discrete-mathematics mathematical-logic
6.2.32 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.7 Question 3 (Page No. 91) https://gateoverflow.in/306911
Show that the square of an even number is an even number using a direct proof
kenneth-rosen discrete-mathematics mathematical-logic
6.2.33 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 16 (Page No. 126) https://gateoverflow.in/308886
6.2.34 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 11 (Page No. 153) https://gateoverflow.in/309484
6.2.35 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 51 (Page No. 154) https://gateoverflow.in/309528
Relate to inhabitants of the island of knights and knaves created by Smullyan, where knights always tell the truth and
knaves always lie. You encounter two people, A and B. Determine, if possible, what A and B are if they address you
in the ways described. If you can not determine what these people are, can you draw any conclusions ?
6.4.1 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.2 Question 1 (Page No. 22) https://gateoverflow.in/130605
please clarify.
6.4.2 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.2 Question 33 (Page No. 24) https://gateoverflow.in/306077
Steve would like to determine the relative salaries of three coworkers using two facts. First, he knows that if Fred is not
the highest paid of the three, then Janice is. Second, he knows that if Janice is not the lowest paid, then Maggie is paid
the most. Is it possible to determine the relative salaries of Fred, Maggie, and Janice from what Steve knows? If so, who is paid
the most and who the least? Explain your reasoning.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.3 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.2 Question 34 (Page No. 24) https://gateoverflow.in/306080
Five friends have access to a chat room. Is it possible to determine who is chatting if the following information is
known? Either Kevin or Heather, or both, are chatting. Either Randy or Vijay, but not both, are chatting. If Abby is
chatting, so is Randy. Vijay and Kevin are either both chatting or neither is. If Heather is chatting, then so are Abby and Kevin.
Explain your reasoning.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.4 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.2 Question 35 (Page No. 24) https://gateoverflow.in/130917
A detective has interviewed four witnesses to a crime. From the stories of the witnesses the detective has concluded that
if the butler is telling the truth then so is the cook; the cook and the gardener cannot both be telling the truth; the
gardener and the handyman are not both lying; and if the handyman is telling the truth then the cook is lying. For each of the
four persons can the detective determine whether that person is telling the truth or lying ? Explain your reasoning.
kenneth-rosen discrete-mathematics propositional-logic
6.4.5 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 1 (Page No. 34) https://gateoverflow.in/306085
6.4.6 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 14 (Page No. 35) https://gateoverflow.in/306111
6.4.7 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 15 (Page No. 34) https://gateoverflow.in/306112
6.4.8 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 16 (Page No. 35) https://gateoverflow.in/306113
6.4.9 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 17 (Page No. 35) https://gateoverflow.in/306114
6.4.10 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 18 (Page No. 35)
https://gateoverflow.in/306115
show that p → q and ∼ q →∼ p are logically equivalent.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.11 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 19 (Page No. 35)
https://gateoverflow.in/306116
Show that ∼ p ↔ q and p ↔∼ q are logically equivalent.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.12 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 2 (Page No. 34) https://gateoverflow.in/306087
6.4.13 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 20 (Page No. 35)
https://gateoverflow.in/306117
Show that ∼ (p ⊕ q) and p ↔ q are logically equivalent.
6.4.14 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 21 (Page No. 35)
https://gateoverflow.in/306118
Show that ∼ (p ↔ q) and ∼ p ↔ q are logically equivalent.
6.4.15 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 22 (Page No. 35)
https://gateoverflow.in/306119
Show that (p → q) ∧ (p → r) and p → (q ∧ r) are logically equivalent.
6.4.16 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 23 (Page No. 35)
https://gateoverflow.in/306120
Show that (p → r) ∧ (q → r) and (p ∨ q) → r are logically equivalent.
6.4.17 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 24 (Page No. 35)
https://gateoverflow.in/306121
Show that (p → q) ∨ (p → r) and p → (q ∨ r) are logically equivalent.
6.4.19 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 26 (Page No. 35)
https://gateoverflow.in/306123
Show that ∼ p → (q → r) and q → (p ∨ r) are logically equivalent.
6.4.20 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 27 (Page No. 35)
https://gateoverflow.in/306124
Show that p ↔ q and (p → q) ∧ (q → p) are logically equivalent.
6.4.21 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 28 (Page No. 35)
https://gateoverflow.in/306125
Show that p ↔ q and ∼ p ↔∼ q are logically equivalent.
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic
6.4.22 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 3 (Page No. 34) https://gateoverflow.in/306089
a. p ∨ q ≡ q ∨ p
b. p ∧ q ≡ q ∧ p
6.4.23 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 31 (Page No. 35)
https://gateoverflow.in/306126
Show that (p → q) → r and p → (q → r) are not logically equivalent.
6.4.24 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 32 (Page No. 35)
https://gateoverflow.in/306127
Show that (p ∧ q) → r and (p → r) ∧ (q → r) are not logically equivalent.
6.4.25 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 33 (Page No. 35)
https://gateoverflow.in/306128
Show that (p → q) → (r → s) and (p → r) → (q → s) are not logically equivalent.
6.4.26 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 34 (Page No. 35)
https://gateoverflow.in/306129
Find the dual of each of these compound propositions.
a. p∨ ∼ q
b. p ∧ (q ∨ (r ∧ T))
c. (p∧ ∼ q) ∨ (q ∧ F)
6.4.27 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 35 (Page No. 35)
https://gateoverflow.in/306130
Find the dual of each of these compound propositions.
a. p∧ ∼ q∧ ∼ r
b. (p ∧ q ∧ r) ∨ s
c. (p ∨ F) ∧ (q ∨ T)
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic
6.4.28 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 39 (Page No. 35)
https://gateoverflow.in/306131
Why are the duals of two equivalent compound propositions also equivalent, where these
compound propositions contain only the operators ∧, ∨, ∼?
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic
6.4.29 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 4 (Page No. 34) https://gateoverflow.in/306090
a. (p ∨ q) ∨ r ≡ p ∨ (q ∨ r).
b. (p ∧ q)∧ ≡ p ∧ (q ∧ r).
6.4.30 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 44 (Page No. 36)
https://gateoverflow.in/306140
Show that ∼ and ∧ form a functionally complete collection of logical operators. [Hint: First use
a De Morgan law to show that p ∨ q is logically equivalent to (∼ (∼ p∧ ∼ q)). ]
6.4.31 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 45 (Page No. 36)
https://gateoverflow.in/306141
Show that ∼ and ∨ form a functionally complete collection of logical operators.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic difficult descriptive
6.4.32 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 47 (Page No. 36)
https://gateoverflow.in/306143
Show that p ↑ q is logically equivalent to ∼ (p ∧ q) .
6.4.33 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 49 (Page No. 36)
https://gateoverflow.in/306145
Show that p ↓ q is logically equivalent to ∼ (p ∨ q).
6.4.34 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 5 (Page No. 34) https://gateoverflow.in/306091
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r).
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.35 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 6 (Page No. 34) https://gateoverflow.in/306093
∼ (p ∧ q) ≡ ∼ p∨ ∼ q
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic
6.4.36 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 7 (Page No. 34) https://gateoverflow.in/306094
Use De Morgan’s laws to find the negation of each of the following statements.
a. Kwame will take a job in industry or b. Yoshiko knows Java and calculus.
go to graduate school.
c. James is young and strong. d. Rita will move to Oregon or
Washington.
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic
6.4.38 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.3 Question 9 (Page No. 35) https://gateoverflow.in/306096
Show that each of these conditional statements is a tautology by using truth tables.
a. (p ∧ q) → p b. p → (p ∨ q)
c. ∼ p → (p → q) d. (p ∧ q) → (p → q)
e. ∼ (p → q) → p f. ∼ (p → p) →∼ q
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic
6.4.39 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 1 (Page No. 53) https://gateoverflow.in/306150
Let P (x) denote the statement “ x <= 4” . What are these truth values?
a. P (0)
b. P (4)
c. P (6)
6.4.40 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 10 (Page No. 53)
https://gateoverflow.in/306172
Let C(x) be the statement “ x has a cat,” let D(x) be the statement “ x has a dog,” and let F(x)
be the statement “x has a ferret.” Express each of these statements in terms of C(x), D(x), F(x), quantifiers, and
logical connectives.
Let the domain consist of all students in your class.
6.4.41 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 11 (Page No. 53)
https://gateoverflow.in/306195
Let P (x) be the statement “ x = x2 ”. If the domain consists of the integers, what are these truth
values?
f. ∀xP(x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.42 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 12 (Page No. 53)
https://gateoverflow.in/306197
Let Q(x) be the statement “ x + 1 > 2x.” If the domain consists of all integers, what are these
truth values?
a. Q(0) b. Q(−1)
c. Q(1) d. ∃xQ(x)
e. ∀xQ(x) f. ∃x ∼ Q(x)
g. ∀x ∼ Q(x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.43 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 13 (Page No. 53)
https://gateoverflow.in/306198
Determine the truth value of each of these statements if the domain consists of all integers.
a. ∀n(n + 1 > n) b. ∃n(2n = 3n)
c. ∃n(n = −n) d. ∀n(3n <= 4n)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.44 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 14 (Page No. 53)
https://gateoverflow.in/306200
Determine the truth value of each of these statements if the domain consists of all real numbers.
a. ∃x(x3 = −1) b. existsx(x4 < x2 )
c. ∀x((−x)2 = x2 ) d. ∀x(2x > x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.45 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 15 (Page No. 53)
https://gateoverflow.in/306199
Determine the truth value of each of these statements if the domain for all variables consists of
all integers.
a. ∀n(n2 >= 0) b. ∃n(n2 = 2)
c. ∀n(n2 >= n) d. ∃n(n2 < 0)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.46 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 16 (Page No. 53)
https://gateoverflow.in/306203
Determine the truth value of each of these statements if the domain of each variable consists of
all real numbers.
a. ∃x(x2 = 2) b. ∃x(x2 = −1)
c. ∃x(x2 + 2 >= 1) d. ∀x(x2 ≠ x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.47 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 17 (Page No. 53)
https://gateoverflow.in/306204
Suppose that the domain of the propositional function P (x) consists of the integers 0, 1, 2, 3, 4.
Write out each of these propositions using disjunctions, conjunctions, and negations.
a. ∃xP(x) b. ∀xP(x)
c. ∃x ∼ P(x) d. ∀x ∼ P(x)
e. ∼ ∃xP(x) f. ∼ ∀xP(x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.48 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 18 (Page No. 53)
https://gateoverflow.in/306205
Suppose that the domain of the propositional function P (x) consists of the integers
−2, −1, 0, 1, 2. Write out each of these propositions using disjunctions, conjunctions, and negations.
a. ∃xP(x) b. ∀xP(x)
c. ∃x ∼ p(x) d. ∀x ∼ P(x)
e. ∼ ∃xP(x) f. ∼ ∀xP(x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.49 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 19 (Page No. 54)
https://gateoverflow.in/306206
Suppose that the domain of the propositional function P (x) consists of the integers 1, 2, 3, 4, 5.
Express these statements without using quantifiers, instead using only negations, disjunctions, and conjunctions.
a. ∃xP(x) b. ∀xP(x)
c. ∼ ∃xP(x) d. ∼ ∀xP(x)
e. ∀x((x ≠ 3) → P(x)) ∨ ∃x ∼ P(x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.50 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 2 (Page No. 53) https://gateoverflow.in/306151
Let P (x) be the statement “The word x contains the letter a.” what are these truth values?
a. P (orange) b. P (lemon) c. P (true) d. P (false)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.51 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 20 (Page No. 54)
https://gateoverflow.in/306207
Suppose that the domain of the propositional function P (x) consists of −5, −3, −1, 1, 3, 5.
Express these statements without using quantifiers, instead using only negations, disjunctions, and conjunctions.
a. ∃xp(x)
b. ∀xp(x)
c. ∀x((x ≠ 1) → p(x))
d. ∃x((x >= 0) ∧ P (x))
e. ∃x(∼ p(x)) ∧ ∀x((x < 0) → p(x))
6.4.52 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 21 (Page No. 54)
https://gateoverflow.in/306209
For each fo these statements find a domain for which the statements is true and a domain for
which the statement is false.
6.4.53 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 22 (Page No. 54)
https://gateoverflow.in/306211
For each of these statements find a domain for which the statement is true and a domain for
which the statement is false.
a. Everyone speak Hindi. b. There is someone older than 21 years.
c. Everyone two people have the same d. Someone knows more than two other
first name. people.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.54 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 26 (Page No. 54)
https://gateoverflow.in/306218
Translate each of these statements into logical expression in three different ways by varying the
domain and by using predicates with one and with two variables.
6.4.55 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 27 (Page No. 54)
https://gateoverflow.in/306220
Translate each of these statements into logical expression in three different ways by varying the
domain and by using predicates with one and with two variables.
6.4.57 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 30 (Page No. 54)
https://gateoverflow.in/306501
Suppose the domain of the propositional function P (x, y) consists of pairs x and y , where x is
1,2 or 3 and y is 1,2 or 3 . Write out these propositions using disjunctions and conjunctions.
a. ∃xP(x, 3) b. ∀yP(1, y)
c. ∃y ∼ p(2, y) d. ∀x ∼ P(x, 2)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.58 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 32 (Page No. 55)
https://gateoverflow.in/306509
Express each of these statements using quantifiers. Then form the negation of the statement so
that no negation is to the left of quantifier. Next, express the negation in simple English. (Do not simply use the phrase
“It is not the case that.”)
a. All dogs have fleas. b. There is horse that can add.
c. Every koala can climb. d. No monkey can speak French.
e. There exists a pig that can swim and
catch fish.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.59 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 33 (Page No. 55)
https://gateoverflow.in/306512
Express the negation of these propositions using quantifiers, and then express the negation in
English.
6.4.60 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 33 (Page No. 55)
https://gateoverflow.in/306510
Express each of these statements using quantifiers. Then form the negation of the statement so
that no negation is to the left of quantifier. Next, express the negation in simple English. (Do not simply use the phrase
“It is not the case that.”)
a. Some old dogs can learn new tricks. b. No rabbit knows calculus.
c. Every bird can fly. d. There is no dog that can talk.
e. There is no one in this class who
knows French and Russian.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.61 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 35 (Page No. 55)
https://gateoverflow.in/306513
Find a counterexample, if possible, to these universallyquantified statements, where the domain
for all variablesconsists of all integers.
a. ∀x(x2 >= x)
b. ∀x(x > 0 ∨ x < 0)
c. ∀x(x = 1)
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic
6.4.62 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 36 (Page No. 55)
https://gateoverflow.in/306515
Find a counterexample, if possible, to these universally quantified statements, where the domain
for all variables consists of all real numbers.
a. ∀x(x2 ≠ x)
b. ∀x(x2 ≠ 2)
c. ∀x(|x| > 0)
6.4.63 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 37 (Page No. 55)
https://gateoverflow.in/306518
Express each of these statements using predicates and quantifiers.
a. A passenger on an airline qualifies as an elite flyer if the passenger flies more than 25,000 miles in a year or takes more
than 25 flights during that year.
b. A man qualifies for the marathon if his best previous time is less than 3 hours and a woman qualifies for the marathon if
her best previous time is less than3.5 hours.
c. A student must take at least 60 course hours, or at least 45 course hours and write a master’s thesis, and receive a grade no
lower than a B in all required courses,to receive a master’s degree.
d. There is a student who has taken more than 21 credit hours in a semester and received all A’s.
6.4.64 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 38 (Page No. 55)
https://gateoverflow.in/306521
Translate these system specifications into English where the predicate S(x, y) is “ x is in state y
“ and where the domain for x and y consists of all system and all possible states, respectively.
a. ∃xS(x, open)
b. ∀xS(x, malfunctioning) ∨ S(x, diagnostic)
c. ∃xS(x, open) ∨ ∃xS(x, diagnostic)
d. ∃x ∼ S(x, available)
e. ∀x ∼ S(x, working)
6.4.65 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 39 (Page No. 55)
https://gateoverflow.in/306522
Translate these specifications into English where F(p) is“Printer p is out of service,” B(p) is
“Printer p is busy,”L(j) is “Print job j is lost,” and Q(j)is “Print job j is queued.”
6.4.66 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 40 (Page No. 55)
https://gateoverflow.in/306524
Express each of these system specifications using predicates, quantifiers, and logical
connectives.
a. When there is less than 30 megabytes free on the hard disk, a warning message is sent to all users.
b. No directories in the file system can be opened and no files can be closed when system errors have been detected.
c. The file system cannot be backed up if there is a user currently logged on.
d. Video on demand can be delivered when there are at least 8 megabytes of memory available and the connection speed is at
least 56 kilobits per second.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.67 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 41 (Page No. 55)
https://gateoverflow.in/306525
Express each of these system specifications using predicates, quantifiers, and logical
connectives.
a. At least one mail message, among the nonempty set of messages, can be saved if there is a disk with more than 10 kilobytes
of free space.
b. Whenever there is an active alert, all queued messages are transmitted.
c. The diagnostic monitor tracks the status of all systems except the main console.
d. Each participant on the conference call whom the host of the call did not put on a special list was billed.
6.4.68 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 42 (Page No. 55)
https://gateoverflow.in/306526
Express each of these system specifications using predicates, quantifiers, and logical
connectives.
6.4.69 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 43 (Page No. 56)
https://gateoverflow.in/306528
Determine whether ∀x(P (x) → Q(x)) and ∀xP (x) → ∀xQ(x) are logically equivalent .
Justify your answer.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.70 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 44 (Page No. 56)
https://gateoverflow.in/306529
Determine whether ∀x(P (x) ↔ Q(x)) and ∀xP (x) ↔ ∀xQ(x) are logically equivalent .
Justify your answer.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.71 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 45 (Page No. 56)
https://gateoverflow.in/306530
Show that ∃x(P (x) ∨ Q(x)) and ∃xP (x) ∨ ∃xQ(x) are logically equivalent.
6.4.72 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 46 (Page No. 56)
https://gateoverflow.in/306531
Establish these logical equivalences, where x does not occur as a free variable in A. Assume that
the domain is nonempty.
6.4.73 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 47 (Page No. 56)
https://gateoverflow.in/306532
Establish these logical equivalences, where x does not occur as a free variable in A. Assume that
the domain is nonempty.
6.4.74 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 49 (Page No. 56)
https://gateoverflow.in/306533
Establish these logical equivalences, where x does not occur as a free variable in A. Assume that
the domain is nonempty.
6.4.75 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 5 (Page No. 53) https://gateoverflow.in/306152
Let P (x) be the statement “x spends more than five hours every weekday in class.” where the domain for x consists of
all students. Express each of these qualifications in English.
a. ∃xP(x) b. ∀xP(x)
c. ∃x ∼ p(x) d. ∀x ∼ P(x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.76 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 50 (Page No. 56)
https://gateoverflow.in/306535
Show that ∀xP (x) ∨ ∀xQ(x) and ∀x(P (x) ∨ Q(x)) are not logically equivalent.
6.4.77 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 51 (Page No. 56)
https://gateoverflow.in/306534
Show that ∃xP (x) ∧ ∃xQ(x) and ∃x(P (x) ∧ Q(x)) are not logically equivalent.
6.4.78 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 52 (Page No. 56)
https://gateoverflow.in/306544
As mentioned in the text, the notation ∃ ∼ xP (x) denotes “There exists a unique x such that
P (x) is true.”If the domain consists of all integers, what are the truth values of these statements?
a. ∃ ∼ x(x > 1) b. ∃ ∼ x(x2 = 1)
c. ∃x(x + 3 = 2x) d. ∃ ∼ x(x = x + 1)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.79 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 53 (Page No. 56)
https://gateoverflow.in/306546
What are the truth values of these statements?
6.4.80 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 57 (Page No. 56)
https://gateoverflow.in/306548
Suppose that Prolog facts are used to define the predicates mother (M, Y ) and father (F, X) ,
which represent that M is the mother of Y and F is the father of X , respectively. Give a Prolog rule to define the
predicate sibling (X, Y ) , which represent that X , Y are siblings (that is, have the same mother and the same father.)
6.4.81 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 58 (Page No. 56)
https://gateoverflow.in/306550
Suppose that Prolog facts are used to define the predicates mother (M, Y ) and father (F,X),
which represent that M is the mother of Y and F is the father of X respectively. Give a Prolog rule to define the
predicate grandfather (X, Y ) , which represent that X is the grandfather of Y .
6.4.82 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 59 (Page No. 56)
https://gateoverflow.in/306551
Let P (x), Q(x), and R(x) be the statements “ x is a professor,” “ x is ignorant,” and “ x is vain,”
respectively.Express each of these statements using quantifiers; logical connectives; and P (x), Q(x), and R(x) ,
where the domain consists of all people.
a. No professors are ignorant. b. All ignorant people are vain.
c. No professors are vain. d. Does (c) follow from (a) and (b)?
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.83 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 6 (Page No. 53) https://gateoverflow.in/306163
Let N(x) be the statements “ x has visited North Dakota,” where the domain consists of the students in your school.
Express each of these quantifications in English.
a. ∃xN(x) b. ∀xN(x)
c. ∼ ∃xN(x) d. ∃x ∼ N(x)
e. ∼ ∀xN(x) f. ∀x ∼ N(x)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.84 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 60 (Page No. 56)
https://gateoverflow.in/306553
LetP (x), Q(x), R(x), and S(x) be the statements “ x is a baby,” “ x is logical,” “ x is able to
manage a crocodile,”and “xis despised,” respectively. Suppose that the domain consists of all people. Express each of
these statements using quantifiers; logical connectives; and P (x), Q(x), R(x), and S(x) .
6.4.85 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 62 (Page No. 56)
https://gateoverflow.in/306554
Let P (x), Q(x), R(x), and S(x) be the statements “ x is a duck,” “ x is one of my poultry,” “ x
is an officer,”and “ x is willing to waltz,” respectively. Express each of these statements using quantifiers; logical
connectives; and P (x), Q(x), R(x), and S(x) .
6.4.86 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 7 (Page No. 53) https://gateoverflow.in/306166
Translate these statements into English, where C(x) is “ x is comedian” and F(x) is “ x is funny” and the domain
consists of all poeple.
a. ∀x(C(x) → F(x)) b. ∀x(C(x) ∧ F(x))
c. ∃x(C(x) → F(x)) d. ∃x(C(x) ∧ F(x))
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.87 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.4 Question 8 (Page No. 53) https://gateoverflow.in/306168
Translate these statements into English, where R(x) is “ x is a rabbit” and H(x) is “ x hops” and the domain consists of
all animals.
a. ∀x(R(x) → H(x)) b. ∀x(R(x) ∧ H(x))
c. ∃x(R(x) → H(x)) d. ∃x(R(x) ∧ H(x))
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.88 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 1 (Page No. 64) https://gateoverflow.in/306555
Translate these statements into English, Where the domain for each variable consists of all real numbers.
a. ∀x∃y(x < y)
b. ∀x∀y((x >= 0) ∧ (y >= 0) → (xy >= 0))
c. ∀x∀y∃z(xy = z)
6.4.89 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 10 (Page No. 65)
https://gateoverflow.in/306564
Let F(x, y) be the statement “ x can fooly,” where the domain consists of all people in the
world. Use quantifiers to express each of these statements.
6.4.90 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 11 (Page No. 65)
https://gateoverflow.in/306568
LetS(x) be the predicate “ x is a student,” F(x) the predicate “ x is a faculty member,” and
A(x, y) the predicate“ x has asked y a question,” where the domain consists of all people associated with your school.
Use quantifiers to express each of these statements.
6.4.91 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 12 (Page No. 65)
https://gateoverflow.in/306571
Let I(x) be the statement “ x has an Internet connection”and C(x, y) be the statement “ x and y
have chatted over the Internet,” where the domain for the variables x and y consists of all students in your class. Use
quantifiers to express each of these statements.
6.4.92 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 13 (Page No. 66)
https://gateoverflow.in/306576
Let M(x, y) be “ x has sent y an e-mail message” and T(x, y) be “ x has telephoned y,” where
the domain consists of all students in your class. Use quantifiers to express each of these statements. (Assume that all e-
mail messages that were sent are received, which is not the way things often work.)
6.4.93 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 15 (Page No. 66)
https://gateoverflow.in/306581
Use quantifiers and predicates with more than one variable to express these statements.
6.4.94 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 16 (Page No. 66)
https://gateoverflow.in/306586
A discrete mathematics class contains 1 mathematics ma-jor who is a freshman, 12 mathematics
majors who are sophomores, 15 computer science majors who are sophomores, 2 mathematics majors who are juniors,
2 computer science majors who are juniors, and 1 computer science major who is a senior. Express each of these statements in
terms of quantifiers and then determine its truth value.
6.4.95 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 17 (Page No. 66)
https://gateoverflow.in/306587
Express each of these system specifications using predicates, quantifiers, and logical
connectives, if necessary.
6.4.96 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 18 (Page No. 66)
https://gateoverflow.in/306590
Express each of these system specifications using predicates, quantifiers, and logical
connectives, if necessary.
6.4.97 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 19 (Page No. 66)
https://gateoverflow.in/306592
Express each of these statements using mathematical and logical operators, predicates, and
quantifiers, where the domain consists of all integers.
6.4.98 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 2 (Page No. 64) https://gateoverflow.in/306556
Translate these statements into English, where the domain for each variable consists of all real numbers.
a. ∃x∀y(xy = y)
b. ∀x∀y(((x >= 0) ∧ (y < 0)) → (x − y > 0))
c. ∀x∀y∃z(x = y + z)
6.4.99 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 20 (Page No. 66)
https://gateoverflow.in/306595
Express each of these statements using predicates, quantifiers, logical connectives, and
mathematical operators where the domain consists of all integers.
6.4.101 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 24 (Page No. 66)
https://gateoverflow.in/306625
Translate each of these nested quantifications into an English statement that expresses a
mathematical fact. The domain in each case consists of all real numbers.
a. ∃x∀y(y = y)
b. ∀x∀y((x >= 0) ∧ (y < 0)) → (x − y > 0)
c. ∃x∃y(((x <= 0) ∧ (y <= 0)) ∧ (x − y > 0))
d. ∀x∀y((x ≠ 0) ∧ (y ≠ 0) ↔ (xy ≠ 0))
6.4.102 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 25 (Page No. 66)
https://gateoverflow.in/306674
Translate each of these nested quantifications into an English statement that expresses a
mathematical fact. The domain in each case consists of all real numbers.
a. ∃x∀y(xy = y)
b. ∀x∀y(((x < 0) ∧ (y < 0)) → (xy > 0))
c. ∃x∃y((x2 > y) ∧ (x < y))
d. ∀x∀y∃z(x + y = z)
6.4.103 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 26 (Page No. 66)
https://gateoverflow.in/306675
Let Q(x, y) be the statement “ x + y = x − y. ” If the domain for both variables consists of all
integers, what are the truth values?
a. Q(1, 1) b. Q(2, 0)
c. ∀yQ(1, y) d. ∃xQ(x, 2)
e. ∃x∃yQ(x, y) f. ∀x∃yQ(x, y)
g. ∃x∀yQ(x, y) h. ∀y∃xQ(x, y)
i. ∀x∀yQ(x, y)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.104 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 27 (Page No. 66)
https://gateoverflow.in/306676
Determine the truth value of each of these statements if the domain for all variables consists of
all integers.
a. ∀n∃m(n2 < m)
b. ∃n∀m(n < m2 )
c. ∀n∃m(n + m = 0)
d. ∃n∀m(nm = m)
e. ∃n∃m(n2 + m2 = 5)
f. ∃n∃m(n2 + m2 = 6)
g. ∃n∃m(n + m = 4 ∧ n − m = 1)
h. ∃n∃m(n + m = 4 ∧ n − m = 2)
i. ∀n∀m∃p(p = (m + n)/2)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.105 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 28 (Page No. 66)
https://gateoverflow.in/306799
Determine the truth value of each of these statements if the domain of each variable consists of
all real numbers.
a. ∀x∃y(x2 = y)
b. ∀x∃y(x = y 2 )
c. ∃x∀y(xy = 0)
d. ∃x∃y(x + y ≠ y + x)
e. ∀x(x ≠ 0 → ∃y(xy = 1))
f. ∃x∀y(y ≠ 0 → xy = 1)
g. ∀x∃y(x + y = 1)
h. ∃x∃y(x + 2y = 2 ∧ 2x + 4y = 5)
i. ∀x∃y(x + y = 2 ∧ 2x − y = 1)
j. ∀x∀y∃z(z = (x + y)/2)
6.4.106 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 29 (Page No. 66)
https://gateoverflow.in/306801
Suppose the domain of the propositions function P (x, y) consists of pairs x and y, where x is
1, 2 or 3 and y is 1, 2 or 3. Write out these propositions using disjunctions and conjunctions.
a. ∀x∀yP(x, y) b. ∃x∃yP(x, y)
c. ∃x∀yP(x, y) d. ∀y∃xP(x, y)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.107 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 3 (Page No. 64)
https://gateoverflow.in/306560
Let Q(x, y) be the statement “ x has sent an e-mail message toy,” where the domain for both x
and y consists of all students in your class. Express each of these quantifications in English.
a. ∃x∃yQ(x, y) b. ∃x∀yQ(x, y)
c. ∀x∃yQ(x, y) d. ∃y∀xQ(x, y)
e. ∀y∃xQ(x, y) f. ∀x∀yQ(x, y)
6.4.108 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 30 (Page No. 66)
https://gateoverflow.in/306802
Rewrite each of these statements so that negations appear only within predicates (that is, so that
no negation is outside a quantifier or an expression involving logical connectives).
a. ∼ ∃y∃xP (x, y)
b. ∼ ∀x∃yP (x, y)
c. ∼ ∃y(Q(y) ∧ ∀x ∼ R(x, y))
d. ∼ ∃y(∃xR(x, y) ∨ ∀xS(x, y))
e. ∼ ∃y(∀x∃zT(x, y, z) ∨ ∃x∀zU(x, y, z))
6.4.109 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 31 (Page No. 66)
https://gateoverflow.in/306803
Express the negations of each of these statements so that all negation symbols immediately
precede predicates.
a. ∀x∃y∀zT(x, y, z)
b. ∀x∃yP (x, y) ∨ ∀x∃yQ(x, y)
c. ∀x∃y(P (x, y) ∧ ∃zR(x, y, z))
d. ∀x∃y(P (x, y) → Q(x, y))
6.4.110 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 32 (Page No. 66)
https://gateoverflow.in/306805
Express the negations of each of these statements so that all negation symbols immediately
precede predicates.
a. ∃z∀y∀xT(x, y, z)
b. ∃x∃yP (x, y) ∧ ∀x∀yQ(x, y)
c. ∃x∃y(Q(x, y) ↔ Q(y, x))
d. ∀y∃x∃z(T(x, y, z) ∨ Q(x, y))
6.4.111 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 33 (Page No. 66)
https://gateoverflow.in/306806
Rewrite each of these statements so that negations ap-pear only within predicates (that is, so that
no negation is outside a quantifier or an expression involving logical connectives).
a. ∼ ∀x∀yP (x, y)
b. ∼ ∀y∃xP (x, y)
c. ∼ ∀y∀x(P (x, y) ∧ ∀x∀yQ(x, y))
d. ∼ ∀x(∃y∀zP (x, y, z) ∧ ∃z∀yP (x, y, z))
6.4.112 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 34 (Page No. 66)
https://gateoverflow.in/306807
Find a common domain for the variables x, y, and z for which the statement
∀x∀y((x ≠ y) → ∀z(z = x) ∨ (z = y)) is true and another domain for which it is false.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.113 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 36 (Page No. 68)
https://gateoverflow.in/306809
Express each of these statements using quantifiers. Then form the negation of the statement so
that no negation is to the left of a quantifier. Next, express the negation in simple English. (Do not simply use the
phrase “It is not the case that.”)
a. No one has lost more than one thousand dollars playing the lottery.
b. There is a student in this class who has chatted with exactly one other student.
c. No student in this class has sent e-mail to exactly two other students in this class.
d. Some student has solved every exercise in this book.
e. No student has solved at least one exercise in every section of this book.
6.4.114 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 37 (Page No. 68)
https://gateoverflow.in/306810
Express each of these statements using quantifiers. Then form the negation of the statement so
that no negation is to the left of a quantifier. Next, express the negation in simple English. (Do not simply use the
phrase “It is not the case that.”)
a. Every student in this class has taken exactly two mathematics classes at this school.
b. Someone has visited every country in the world except Libya.
c. No one has climbed every mountain in the Himalayas.
d. Every movie actor has either been in a movie with Kevin Bacon or has been in a movie with someone who has been in a
movie with Kevin Bacon
a. ∀x∀y(x2 = y 2 → x = y)
b. ∀x∃y(y 2 = x)
c. ∀x∀y(xy >= x)
6.4.116 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 4 (Page No. 64)
https://gateoverflow.in/306562
Let P (x, y) be the statement “Student x has taken classy,” where the domain for x consists of
all students in your class and for y consists of all computer science courses at your school. Express each of these
quantifications in English.
a. ∃x∃yP(x, y) b. ∃x∀yP(x, y)
c. ∀x∃yP(x, y) d. ∃y∃xP(x, y)
e. ∀y∃xP(x, y) f. ∀x∀yP(x, y)
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.117 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 40 (Page No. 68)
https://gateoverflow.in/306816
Find a counterexample, if possible ,to these universally quantified statements, where the domain
for all variables consists of all integers.
a. ∀x∃y(x = 1/y)
b. ∀x∃y(y 2 − x < 100)
c. ∀x∀y(x2 ≠ y 3 )
6.4.118 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 45 (Page No. 68)
https://gateoverflow.in/306817
Determine the truth value of the statement ∀x∃y(xy = 1) if the domain for the variables
consists of
6.4.119 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 46 (Page No. 68)
https://gateoverflow.in/306818
Determine the truth value of the statement ∃x∀y(x <= y 2 ) if the domain for the variables
consists of
6.4.120 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 47 (Page No. 68)
https://gateoverflow.in/306819
Show that the two statements ∼ ∃x∀yP (x, y) and ∀x∃y ∼ P (x, y) , where both quantifiers
over the first variable in P (x, y) have the same domain , and both quantifiers over the second variable in P (x, y) have
the same domain, are logically equivalent.
discrete-mathematics mathematical-logic kenneth-rosen propositional-logic
6.4.121 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 48 (Page No. 68)
https://gateoverflow.in/306820
Show that ∀xP (x) ∨ ∀xQ(x) and ∀x∀y(P (x) ∨ Q(y)), where all quantifiers have the same
nonempty domain, are logically equivalent . (The new variable y is used to combine the quantifications correctly.)
discrete-mathematics kenneth-rosen mathematical-logic propositional-logic
6.4.122 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 49 (Page No. 68)
https://gateoverflow.in/306821
a. Show that ∀xP (x) ∧ ∃xQ(x) is logically equivalent to ∀x∃y(P (x) ∧ Q(y)), where all quantifiers have the same
nonempty domain.
b. Show that ∀xP (x) ∨ ∃xQ(x) is equivalent to ∀x∃y(P (x) ∨ Q(y)), where all quantifiers have the same nonempty
domain.
6.4.123 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.5 Question 9 (Page No. 65)
https://gateoverflow.in/306563
Let L(x, y) be the statement “ x loves y,” where the domain for both x and y consists of all
people in the world. Use quantifiers to express each of these statements.
6.4.124 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 13 (Page No. 79)
https://gateoverflow.in/306828
For each of these arguments, explain which rules of inference are used for each step.
a. “Doug, a student in this class, knows how to write programs in JAVA. Everyone who knows how to write programs in
JAVA can get a high-paying job. There-fore, someone in this class can get a high-paying job.”
b. “Somebody in this class enjoys whale watching. Every person who enjoys whale watching cares about ocean pollution.
Therefore, there is a person in this class who cares about ocean pollution.”
c. “Each of the 93 students in this class owns a personal computer. Everyone who owns a personal computer can use a word
processing program. Therefore, Zeke,a student in this class, can use a word processing pro-gram.”
d. “Everyone in New Jersey lives within 50 miles of the ocean. Someone in New Jersey has never seen the ocean. Therefore,
someone who lives within 50 miles of the ocean has never seen the ocean.”
6.4.125 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 14 (Page No. 79)
https://gateoverflow.in/306831
For each of these arguments, explain which rules of inference are used for each step.
a. “Linda, a student in this class, owns a red convertible.Everyone who owns a red convertible has gotten at least one
speeding ticket. Therefore, someone in this class has gotten a speeding ticket.”
b. “Each of five roommates, Melissa, Aaron, Ralph, Veneesha, and Keeshawn, has taken a course in discrete mathematics.
Every student who has taken a course indiscrete mathematics can take a course in algorithms.Therefore, all five roommates
can take a course in algorithms next year.”
c. “All movies produced by John Sayles are wonderful. John Sayles produced a movie about coal miners.Therefore, there is a
wonderful movie about coal miners.”
d. “There is someone in this class who has been to France. Everyone who goes to France visits the Louvre. Therefore,
someone in this class has visited the Louvre.
6.4.126 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 15 (Page No. 79)
https://gateoverflow.in/306832
For each of these arguments determine whether the argument is correct or incorrect and explain
why.
a. All students in this class understand logic. Xavier is a student in this class. Therefore, Xavier understands logic.
b. Every computer science major takes discrete mathematics. Natasha is taking discrete mathematics.Therefore, Natasha is a
computer science major.
c. All parrots like fruit. My pet bird is not a parrot. Therefore, my pet bird does not like fruit.
d. Everyone who eats granola every day is healthy. Linda is not healthy. Therefore, Linda does not eat granola every day.
6.4.127 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 16 (Page No. 79)
https://gateoverflow.in/306833
For each of these arguments determine whether the argument is correct or incorrect and explain
why.
a. Everyone enrolled in the university has lived in a dormitory. Mia has never lived in a dormitory. Therefore,Mia is not
enrolled in the university.
b. A convertible car is fun to drive. Isaac’s car is not a convertible. Therefore, Isaac’s car is not fun to drive.
c. Quincy likes all action movies. Quincy likes the movie Eight Men Out. Therefore,Eight Men Out is an action movie.
d. All lobstermen set at least a dozen traps. Hamilton is a lobsterman. Therefore, Hamilton sets at least a dozen traps
6.4.128 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 17 (Page No. 79)
https://gateoverflow.in/306834
What is wrong with this argument? Let H(x) be “ x is happy.” Given the premise ∃xH(x), we
conclude that H(Lola). Therefore, Lola is happy.
6.4.129 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 18 (Page No. 79)
https://gateoverflow.in/306835
What is wrong with this argument? Let S(x, y) be “ x is shorter than y.” Given the premise
∃sS(s, Max), it follows that S(Max, Max) . Then by existential generalization it follows that ∃xS(x, x), so that
someone is shorter than himself.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.130 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 25 (Page No. 80)
https://gateoverflow.in/306836
Justify the rule of universal modus tollens by showing that the premises ∀x(P (x) → Q(x))
and ∼ Q(a)for a particular element a in the domain, imply ∼ P (a)
6.4.131 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 26 (Page No. 80)
https://gateoverflow.in/306838
Justify the rule of universal transitivity, which states that if ∀x(P (x) → Q(x)) and
∀x(Q(x) → R(x)) are true, then ∀x(P (x) → R(x)) is true, where the domains of all quantifiers are the same.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.132 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 27 (Page No. 80)
https://gateoverflow.in/306839
Use rules of inference to show that if ∀x(P (x) → (Q(x) ∧ S(x))) and ∀x(P (x) ∧ R(x)) are
true, then ∀x(R(x) ∧ S(x)) is true.
6.4.133 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 28 (Page No. 80)
https://gateoverflow.in/306840
Use rules of inference to show that if ∀x(P (x) ∨ Q(x)) and ∀x((∼ P (x) ∧ Q(x)) → R(x))
are true, then ∀x(∼ R(x) → P (x)) is also true, where the domains of all quantifiers are the same.
6.4.134 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 29 (Page No. 80)
https://gateoverflow.in/306892
Use rules of inference
show that if ∀x(P (x) ∨ Q(x)),
to
∀x(∼ Q(x) ∨ S(x)), ∀x(R(x) →∼ S(x)), and ∃x ∼ P (x) are true, then ∃x ∼ R(x) is true.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.135 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 3 (Page No. 78)
https://gateoverflow.in/306822
What rule of inference is used in each of these arguments?
a. Alice is a mathematics major. Therefore, Alice is either a mathematics major or a computer science major.
b. Jerry is a mathematics major and a computer science major. Therefore, Jerry is a mathematics major.
c. If it is rainy, then the pool will be closed. It is rainy.Therefore, the pool is closed.
d. If it snows today, the university will close. The university is not closed today. Therefore, it did not snow today.
e. If I go swimming, then I will stay in the sun too long.If I stay in the sun too long, then I will sunburn. Therefore, if I go
swimming, then I will sunburn
6.4.136 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 30 (Page No. 80)
https://gateoverflow.in/306893
Use resolution to show the hypotheses “Allen is a bad boy or Hillary is a good girl” and “Allen
is a good boy or David is happy” imply the conclusion “Hillary is a good girl or David is happy.”
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.137 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 31 (Page No. 80)
https://gateoverflow.in/306895
Use resolution to show that the hypotheses “It is not raining or Yvette has her umbrella,” “Yvette
does not have her umbrella or she does not get wet,” and “It is raining or Yvette does not get wet” imply that “Yvette
does not get wet.”
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.138 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 32 (Page No. 80)
https://gateoverflow.in/306896
Show that the equivalence p∧ ∼ p ≡ F can be derived using resolution together with the fact
that a conditional statement with a false hypothesis is true. [Hint:Let q = r = F in resolution.]
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.139 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 33 (Page No. 80)
https://gateoverflow.in/306899
Use resolution to
that show
the compound proposition
(p ∨ q) ∧ (∼ p ∨ q) ∧ (p∨ ∼ q) ∧ (∼ p∨ ∼ q) is not satisfiable.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.140 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 34 (Page No. 80)
https://gateoverflow.in/306902
The Logic Problem, taken from WFF’N PROOF, The Game of Logic, has these two
assumptions:1. “Logic is difficult or not many students like logic.”2. “If mathematics is easy, then logic is not
difficult.”By translating these assumptions into statements involving propositional variables and logical connectives, deter-
mine whether each of the following are valid conclusions of these assumptions:
6.4.141 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 35 (Page No. 80)
https://gateoverflow.in/306904
Determine whether this argument, taken from Kalish and Montague [KaMo64], is valid.
If Superman were able and willing to prevent evil,he would do so. If Superman were unable to prevent evil, he would be
impotent; if he were unwilling to prevent evil, he would be malevolent. Superman does not prevent evil. If Superman exists, he
is neither impotent nor malevolent. Therefore, Superman does not exist.
kenneth-rosen discrete-mathematics propositional-logic mathematical-logic difficult
6.4.142 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 4 (Page No. 78)
https://gateoverflow.in/306823
What rule of inference is used in each of these arguments?
a. Kangaroos live in Australia and are marsupials. There-fore, kangaroos are marsupials.
b. It is either hotter than 100 degrees today or the pollution is dangerous. It is less than 100 degrees outside today. Therefore,
the pollution is dangerous.
c. Linda is an excellent swimmer. If Linda is an excellent swimmer, then she can work as a lifeguard. Therefore,Linda can
work as a lifeguard.
d. Steve will work at a computer company this summer.Therefore, this summer Steve will work at a computer company or he
will be a beach bum.
e. If I work all night on this homework, then I can answer all the exercises. If I answer all the exercises, I will understand the
material . Therefore ,If I work all night on this homework, Then I will understand the material.
6.4.143 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 5 (Page No. 78)
https://gateoverflow.in/306824
Use rules of inference to show that the hypotheses “Randy works hard,” “If Randy works hard,
then he is a dull boy,”and “If Randy is a dull boy, then he will not get the job”imply the conclusion “Randy will not get
the job.”
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.144 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 7 (Page No. 78)
https://gateoverflow.in/306825
What rules of inference are used in this famous argument? “All men are mortal. Socrates is a
man. Therefore,Socrates is mortal.”
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.145 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 8 (Page No. 78)
https://gateoverflow.in/306826
What rules of inference are used in this argument? “No man is an island. Manhattan is an island.
Therefore, Manhattan is not a man.”
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.146 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.6 Question 9 (Page No. 78)
https://gateoverflow.in/306827
For each of these collections of premises, what relevant conclusion or conclusions can be drawn?
Explain the rules of inference used to obtain each conclusion from the premises.
a. “If I take the day off, it either rains or snows.” “I took Tuesday off or I took Thursday off.” “It was sunny on Tuesday.” “It
did not snow on Thursday.”
b. “If I eat spicy foods, then I have strange dreams.” “I have strange dreams if there is thunder while I sleep.”“I did not have
strange dreams.”
c. “I am either clever or lucky.” “I am not lucky.” “If I am lucky, then I will win the lottery.”
d. “Every computer science major has a personal computer.” “Ralph does not have a personal computer.”“Ann has a personal
computer.”
e. “What is good for corporations is good for the United States.” “What is good for the United States is good for you.” “What
is good for corporations is for you to buy lots of stuff.”
f. “All rodents gnaw their food.” “Mice are rodents.”“Rabbits do not gnaw their food.” “Bats are not ro-dents.”
6.4.147 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 10 (Page No. 91)
https://gateoverflow.in/308669
Use a direct proof to show that the product of two rational numbers is rational.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.148 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 11 (Page No. 91)
https://gateoverflow.in/308670
Prove or disprove that the product of two irrational numbers is irrational.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.149 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 12 (Page No. 91)
https://gateoverflow.in/308672
Prove or disprove that the product of a nonzero rational number and an irrational number is
irrational.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.150 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 13 (Page No. 91)
https://gateoverflow.in/308673
Prove that if x is irrational, then 1/x is irrational.
6.4.151 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 14 (Page No. 91)
https://gateoverflow.in/308674
Prove that if x is rational and x ≠ 0 , then 1/x is rational.
6.4.152 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 15 (Page No. 91)
https://gateoverflow.in/308677
Use a proof by contraposition to show that if x + y ≥ 2 ,where x and y are real numbers, then
x ≥ 1 or y ≥ 1 .
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.153 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 16 (Page No. 91)
https://gateoverflow.in/308678
Prove that if m and n are integers and mn is even, then m is even or n is even.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.154 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 17 (Page No. 91)
https://gateoverflow.in/308679
Show that if n is an integer and n3 + 5 is odd, then n is even using.
a. a proof by contraposition.
b. a proof by contradiction.
6.4.155 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 19 (Page No. 91)
https://gateoverflow.in/308681
Prove the position P (0), where P (n) is the proposition “If n is a positive integer greater than 1,
then n2 > n. ” What kind of proof did you use?
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.156 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 20 (Page No. 91)
https://gateoverflow.in/308682
Prove the position P (1), where P (n) is the proposition “If n is a positive integer greater than 1,
then n2 > n. ” What kind of proof did you use?
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.157 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 21 (Page No. 91)
https://gateoverflow.in/308683
Let P (n) be the proposition “If a and b are positive real numbers, then (a + b)n ≥ an + bn . ”
Prove that P (1) is true. What kind of proof did you use?
6.4.158 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 22 (Page No. 91)
https://gateoverflow.in/308684
Show that if you pick three socks from a drawer containing just blue socks and black socks, you
must get either a pair of blue socks or a pair of black socks.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.159 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 23 (Page No. 91)
https://gateoverflow.in/308685
Show that at least ten of any 64 days chosen must fall on the same day of the week.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.160 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 24 (Page No. 91)
https://gateoverflow.in/308687
Show that at least three of any 25 days chosen must fall in the same month of the year.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.161 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 25 (Page No. 91)
https://gateoverflow.in/308689
Use a proof by contradiction to show that there is no rational number r for which
r3 + r + 1 = 0 . [Hint:Assume that r = a/b is a root, where a and b are integers and a/b is in lowest terms. Obtain an
equation involving integer s by multiplying by b3 . Then look at whether a and b are each odd or even.]
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.162 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 26 (Page No. 91)
https://gateoverflow.in/308690
Prove that if n is a positive integer, then n is even if and only if 7n + 4 is even.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.163 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 27 (Page No. 91)
https://gateoverflow.in/308691
Prove that if n is a positive integer, then n is odd if and only if 5n + 6 is odd.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.164 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 28 (Page No. 91)
https://gateoverflow.in/308692
Prove that m2 = n2 if and only if m = n or m = -n.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.165 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 29 (Page No. 91)
https://gateoverflow.in/308693
Prove or disprove that if m and n are integers such that mn = 1, then either m = 1 and n = 1 ,
or else m = −1 and n = −1.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.166 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 30 (Page No. 91)
https://gateoverflow.in/308694
Show that these three statements are equivalent, where a and b are real numbers:
a. a is less than b,
b. the average of a and b is greater than a, and
c. the average of a and b is less than b.
6.4.167 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 31 (Page No. 91)
https://gateoverflow.in/308695
Show that these statements about the integer x are equivalent:
a. 3x + 2 is even,
b. x + 5 is odd,
c. x2 is even
6.4.168 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 32 (Page No. 91)
https://gateoverflow.in/308696
Show that these statements about the real number x are equivalent:
a. x is rational,
b. x/2 is rational,
c. 3x − 1 is rational.
6.4.169 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 33 (Page No. 91)
https://gateoverflow.in/308697
Show that these statements about the real number x are equivalent:
x is irrational,
3x + 2 is irrational,
x/2 is irrational.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.170 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 34 (Page No. 91)
−−−−−−−−−− https://gateoverflow.in/308699
Is this reasoning for finding the solutions of the equation √2x2 − 1 = x correct?
−−−−−−−−−−
a. √2x2 − 1 = x is given;
b. 2x2 − 1 = x2 , obtained by squaring both sides of (1);
c. x2 − 1 = 0 , obtained by subtracting x2 from both sides of (2);
d. (x − 1)(x + 1) = 0, obtained by factoring the left-hand side of x2 − 1 ;
e. x = 1 or x = −1,which follows because ab = 0 implies that a = 0 or b = 0
6.4.171 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 35 (Page No. 91)
−−−−−−−−−−− https://gateoverflow.in/308700
Are these steps for finding the solutions of √x + 3 = 3 − x correct?
−−−−−−−−−−−
a. √x + 3 = 3 − x is given;
b. x + 3 = x2 − 6x + 9, obtained by squaring both sides of(1);
c. 0 = x2 − 7x + 6 , obtained by subtracting x + 3 from both sides of(2);
d. 0 = (x − 1)(x − 6), obtained by factoring the right-hand side of(3);
e. x = 1 or x = 6 ,which follows from(4) because ab = 0 implies that a = 0 or b = 0 .
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.172 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 36 (Page No. 91)
https://gateoverflow.in/308701
Show that the propositions p1, p2, p3, and p4can be shown to be equivalent by showing that
p1 ↔ p4, p2 ↔ p3 , and p1 ↔ p3 .
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.173 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 37 (Page No. 91)
https://gateoverflow.in/308705
Show that the propositions p1, p2, p3, p4, and p5 can be shown to be equivalent by proving that
the conditional statements p1 → p4 , p3 → p1 , p4 → p2 , p2 → p5 , and p5 → p3 are true.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.174 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 38 (Page No. 92)
https://gateoverflow.in/308706
Find a counterexample to the statement that every positive integer can be written as the sum of
the squares of three integers
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.175 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 39 (Page No. 92)
https://gateoverflow.in/308707
Prove that at least one of the real numbers a1 , a2 , . . . , an is greater than or equal to the average
of these numbers.What kind of proof did you use?
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.176 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 4 (Page No. 91)
https://gateoverflow.in/306913
Show that the additive inverse, or negative, of an even number is an even number using a direct
proof.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.177 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 41 (Page No. 92)
https://gateoverflow.in/308708
Prove that if n is an integer, these four statements are equivalent:
6.4.178 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 42 (Page No. 92)
https://gateoverflow.in/308711
Prove that these four statements about the integer n are equivalent:
n2 is odd,
1 − n is even,
n3 is odd,
n2 + 1 is even.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.179 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 5 (Page No. 91)
https://gateoverflow.in/306914
Prove that if m + n and n + p are even integers, where m, n,and p are integers, then m + p is
even. What kind of proof did you use?
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.180 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 6 (Page No. 91)
https://gateoverflow.in/306915
Use a direct proof to show that the product of two odd numbers is odd.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.181 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 7 (Page No. 91)
https://gateoverflow.in/306916
Use a direct proof to show that every odd integer is the difference of two squares.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.182 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 8 (Page No. 91)
https://gateoverflow.in/308667
Prove that if n is a perfect square, then n + 2 is not a perfect square
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.183 Propositional Logic: Kenneth Rosen Edition 7 Exercise 1.7 Question 9 (Page No. 91)
https://gateoverflow.in/308668
Use a proof by contradiction to prove that the sum of an irrational number and a rational number
is irrational.
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
6.4.184 Propositional Logic: Kenneth Rosen Edition 7 Exercise 2.1 Question 9 (Page No. 125)
https://gateoverflow.in/308873
Determine whether each of these statements is true or false.
a. 0ϵϕ b. ϕ ϵ {0}
c. { 0 } ⊂ { ϕ} d. ϕ ⊂ {0}
e. {0} ϵ {0} f. {0} ⊂ {0}
g. { ϕ} ⊆ { ϕ}
kenneth-rosen discrete-mathematics mathematical-logic propositional-logic
Answer Keys
6.0.1 Q-Q 6.1.1 Q-Q 6.2.1 Q-Q 6.2.2 Q-Q 6.2.3 Q-Q
6.2.4 Q-Q 6.2.5 N/A 6.2.6 N/A 6.2.7 Q-Q 6.2.8 Q-Q
6.2.9 Q-Q 6.2.10 Q-Q 6.2.11 Q-Q 6.2.12 Q-Q 6.2.13 Q-Q
6.2.14 Q-Q 6.2.15 Q-Q 6.2.16 Q-Q 6.2.17 Q-Q 6.2.18 N/A
6.2.19 N/A 6.2.20 Q-Q 6.2.21 Q-Q 6.2.22 Q-Q 6.2.23 Q-Q
6.2.24 Q-Q 6.2.25 Q-Q 6.2.26 Q-Q 6.2.27 Q-Q 6.2.28 Q-Q
6.2.29 Q-Q 6.2.30 Q-Q 6.2.31 Q-Q 6.2.32 Q-Q 6.2.33 Q-Q
6.2.34 Q-Q 6.2.35 Q-Q 6.3.1 N/A 6.4.1 Q-Q 6.4.2 Q-Q
6.4.3 Q-Q 6.4.4 Q-Q 6.4.5 Q-Q 6.4.6 Q-Q 6.4.7 Q-Q
6.4.8 Q-Q 6.4.9 Q-Q 6.4.10 Q-Q 6.4.11 Q-Q 6.4.12 Q-Q
6.4.13 Q-Q 6.4.14 Q-Q 6.4.15 Q-Q 6.4.16 Q-Q 6.4.17 Q-Q
6.4.18 Q-Q 6.4.19 Q-Q 6.4.20 Q-Q 6.4.21 Q-Q 6.4.22 Q-Q
6.4.23 Q-Q 6.4.24 Q-Q 6.4.25 Q-Q 6.4.26 Q-Q 6.4.27 Q-Q
6.4.28 Q-Q 6.4.29 Q-Q 6.4.30 Q-Q 6.4.31 N/A 6.4.32 Q-Q
6.4.33 Q-Q 6.4.34 Q-Q 6.4.35 Q-Q 6.4.36 Q-Q 6.4.37 Q-Q
6.4.38 Q-Q 6.4.39 Q-Q 6.4.40 Q-Q 6.4.41 Q-Q 6.4.42 Q-Q
6.4.43 Q-Q 6.4.44 Q-Q 6.4.45 Q-Q 6.4.46 Q-Q 6.4.47 Q-Q
6.4.48 Q-Q 6.4.49 Q-Q 6.4.50 Q-Q 6.4.51 Q-Q 6.4.52 Q-Q
6.4.53 Q-Q 6.4.54 Q-Q 6.4.55 Q-Q 6.4.56 Q-Q 6.4.57 Q-Q
6.4.58 Q-Q 6.4.59 Q-Q 6.4.60 Q-Q 6.4.61 Q-Q 6.4.62 Q-Q
6.4.63 Q-Q 6.4.64 Q-Q 6.4.65 Q-Q 6.4.66 Q-Q 6.4.67 Q-Q
6.4.68 Q-Q 6.4.69 Q-Q 6.4.70 Q-Q 6.4.71 Q-Q 6.4.72 Q-Q
6.4.73 Q-Q 6.4.74 Q-Q 6.4.75 Q-Q 6.4.76 Q-Q 6.4.77 Q-Q
6.4.78 Q-Q 6.4.79 Q-Q 6.4.80 Q-Q 6.4.81 Q-Q 6.4.82 Q-Q
6.4.83 Q-Q 6.4.84 Q-Q 6.4.85 Q-Q 6.4.86 Q-Q 6.4.87 Q-Q
6.4.88 Q-Q 6.4.89 Q-Q 6.4.90 Q-Q 6.4.91 Q-Q 6.4.92 Q-Q
6.4.93 Q-Q 6.4.94 Q-Q 6.4.95 Q-Q 6.4.96 Q-Q 6.4.97 Q-Q
6.4.98 Q-Q 6.4.99 Q-Q 6.4.100 Q-Q 6.4.101 Q-Q 6.4.102 Q-Q
6.4.103 Q-Q 6.4.104 Q-Q 6.4.105 Q-Q 6.4.106 Q-Q 6.4.107 Q-Q
6.4.108 Q-Q 6.4.109 Q-Q 6.4.110 Q-Q 6.4.111 Q-Q 6.4.112 Q-Q
6.4.113 Q-Q 6.4.114 Q-Q 6.4.115 Q-Q 6.4.116 Q-Q 6.4.117 Q-Q
6.4.118 Q-Q 6.4.119 Q-Q 6.4.120 Q-Q 6.4.121 Q-Q 6.4.122 Q-Q
6.4.123 Q-Q 6.4.124 Q-Q 6.4.125 Q-Q 6.4.126 Q-Q 6.4.127 Q-Q
6.4.128 Q-Q 6.4.129 Q-Q 6.4.130 Q-Q 6.4.131 Q-Q 6.4.132 Q-Q
6.4.133 Q-Q 6.4.134 Q-Q 6.4.135 Q-Q 6.4.136 Q-Q 6.4.137 Q-Q
6.4.138 Q-Q 6.4.139 Q-Q 6.4.140 Q-Q 6.4.141 Q-Q 6.4.142 Q-Q
6.4.143 Q-Q 6.4.144 Q-Q 6.4.145 Q-Q 6.4.146 Q-Q 6.4.147 Q-Q
6.4.148 Q-Q 6.4.149 Q-Q 6.4.150 Q-Q 6.4.151 Q-Q 6.4.152 Q-Q
6.4.153 Q-Q 6.4.154 Q-Q 6.4.155 Q-Q 6.4.156 Q-Q 6.4.157 Q-Q
6.4.158 Q-Q 6.4.159 Q-Q 6.4.160 Q-Q 6.4.161 Q-Q 6.4.162 Q-Q
6.4.163 Q-Q 6.4.164 Q-Q 6.4.165 Q-Q 6.4.166 Q-Q 6.4.167 Q-Q
6.4.168 Q-Q 6.4.169 Q-Q 6.4.170 Q-Q 6.4.171 Q-Q 6.4.172 Q-Q
6.4.173 Q-Q 6.4.174 Q-Q 6.4.175 Q-Q 6.4.176 Q-Q 6.4.177 Q-Q
6.4.178 Q-Q 6.4.179 Q-Q 6.4.180 Q-Q 6.4.181 Q-Q 6.4.182 Q-Q
6.4.183 Q-Q 6.4.184 Q-Q
7 Discrete Mathematics: Set Theory & Algebra (236)
7.0.1 Kenneth Rosen Edition 7 Exercise 2.4 Question 40 (Page No. 169) https://gateoverflow.in/337976
200
Find ∑ k3 . (Use Table 2.)
k=99
7.1.1 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 11 (Page No. 23) https://gateoverflow.in/42926
Are these system specifications consistent? “The router can send packets to the edge system only if it supports the new
address space. For the router to support the new address space it is necessary that the latest software release be
installed. The router can send packets to the edge system if the latest software release is installed, The router does not support
the new address space.”
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.2 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 1.2 Question 18 (Page No. 23) https://gateoverflow.in/223166
7.1.3 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 1 (Page No. 125) https://gateoverflow.in/308854
7.1.4 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 10 (Page No. 125) https://gateoverflow.in/308876
7.1.5 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 11 (Page No. 125) https://gateoverflow.in/308881
7.1.6 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 12 (Page No. 125) https://gateoverflow.in/308882
Use a Venn diagram to illustrate the subset of odd integers in the set of all positive integers not exceeding 10.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.7 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 13 (Page No. 126) https://gateoverflow.in/308883
Use a Venn diagram to illustrate the set of all months of the year whose names do not contain the letter R in the set of
all months of the year.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.8 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 14 (Page No. 126) https://gateoverflow.in/308884
7.1.9 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 15 (Page No. 126) https://gateoverflow.in/308885
7.1.10 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 17 (Page No. 126) https://gateoverflow.in/308887
Suppose that A, B, and C are sets such that A ⊆ B and B ⊆ C. show that A ⊆ C.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.11 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 18 (Page No. 126) https://gateoverflow.in/308888
7.1.12 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 19 (Page No. 126) https://gateoverflow.in/308891
7.1.13 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 2 (Page No. 125) https://gateoverflow.in/308857
a. { 0, 3, 6, 9, 12 }
b. { −3, −2, −1, 0, 1, 2, 3 }
c. { m, n, o, p }
7.1.14 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 20 (Page No. 126) https://gateoverflow.in/308892
Find the power set of each of these sets, where a and b are distinct elements
a. {a}
b. {a, b}
c. {ϕ, {ϕ}}
7.1.16 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 22 (Page No. 126) https://gateoverflow.in/308894
Can you conclude that A = B if A and B are two sets with the same power set?
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.17 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 23 (Page No. 126) https://gateoverflow.in/308896
How many elements does each of these sets have where a and b are distinct elements?
7.1.18 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 24 (Page No. 126) https://gateoverflow.in/308898
Determine whether each of these sets is the power set of a set, where a and b are distinct elements.
a. ϕ b. {ϕ, {a}}
c. {ϕ, {a} , {ϕ, a}} d. {ϕ, {a} , {b} , {a, b}}
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.19 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 25 (Page No. 126) https://gateoverflow.in/308899
7.1.20 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 26 (Page No. 126) https://gateoverflow.in/308903
7.1.21 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 27 (Page No. 126) https://gateoverflow.in/308906
a. A × B.
b. B × A.
7.1.22 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 28 (Page No. 126) https://gateoverflow.in/308907
What is the Cartesian product A × B, where A is the set of courses offered by the mathematics department at a
university and B is the set of mathematics professors at this university? Give an example of how this Cartesian product
can be used.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.23 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 29 (Page No. 126) https://gateoverflow.in/308908
What is the Cartesian product A × B × C, where A is the set of all airlines and B and C are both the set of all cities in
the United States? Give an example of how this Cartesian product can be used.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.24 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 3 (Page No. 125) https://gateoverflow.in/308858
For each of these pairs of sets, determine whether the first is a subset of the second, the second is a subset of the first, or
neither is a subset of the other.
a. the set of airline flights from New York to New Delhi, the set of nonstop airline flights from New York to New Delhi
b. the set of people who speak English, the set of people who speak Chinese
c. he set of flying squirrels, the set of living creatures that can fly.
7.1.25 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 30 (Page No. 126) https://gateoverflow.in/308909
Suppose that A × B = ϕ, where A and B are sets. What can you conclude?
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.26 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 31 (Page No. 126) https://gateoverflow.in/308910
7.1.27 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 32 (Page No. 126) https://gateoverflow.in/308911
1. A×B×C
2. C×B×A
3. C×A×B
4. B×B×B
7.1.28 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 33 (Page No. 126) https://gateoverflow.in/308912
Find A2 if
a. A = {0, 1, 3}
b. A = {1, 2, a, b}
7.1.29 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 34 (Page No. 126) https://gateoverflow.in/308913
Find A3 if
a. A = {a}
b. A = {0, a}
7.1.30 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 35 (Page No. 126) https://gateoverflow.in/308914
How many different elements does A × B have if A has m elements and B has n elements?
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.31 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 36 (Page No. 126) https://gateoverflow.in/308915
How many different elements does A × B × C have it A has m elemetns, B has n elements, and C has p elements?
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.32 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 37 (Page No. 126) https://gateoverflow.in/308916
How many different elements does An have when A has m elements and n is a positive integer?
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.33 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 38 (Page No. 126) https://gateoverflow.in/308917
7.1.34 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 39 (Page No. 126) https://gateoverflow.in/308918
7.1.35 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 4 (Page No. 125) https://gateoverflow.in/308860
For each of these pairs of sets, determine whether the first is a subset of the second, the second is a subset of the first,or
neither is a subset of the other.
a. the set of people who speak English, the set of people who speak English with an Australian accent
b. the set of fruits, the set of citrus fruits
c. the set of students studying discrete mathematics, the set of students studying data structures
7.1.36 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 40 (Page No. 126) https://gateoverflow.in/308919
7.1.37 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 41 (Page No. 126) https://gateoverflow.in/308923
Translate each of these quantifications into English and determine is truth value.
a. ∀x ϵ (x2 ≠ −1) b. ∃x ϵ Z(x2 = 2)
c. ∀x ϵ (x2 > 0) d. ∀x ϵ R(x2 = x)
7.1.38 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 42 (Page No. 126) https://gateoverflow.in/308924
Translate each of these quantifications into English and determine is truth value.
a. ∃x ϵ R(x3 = −1) b. ∃x ϵ Z(x + 1 > x)
c. ∀x ϵ (x − 1) ϵ Z d. ∀x ϵ Z(x2 ϵ Z)
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.39 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 43 (Page No. 126) https://gateoverflow.in/308925
Find the truth set of each of these predicates where the domain is the set of integers.
a. P (x) : x2 < 3
b. Q(x) : x2 > x
c. R(x) : 2x + 1 = 0
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.40 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 44 (Page No. 126) https://gateoverflow.in/308926
Find the truth set of each of these predicates where the domain is the set of integers.
1. P (x) : x3 >= 1
2. Q(x) : x2 = 2
3. R(x) : x < x2
7.1.41 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 45 (Page No. 126) https://gateoverflow.in/308927
The defining property of an ordered pair is that two ordered pairs are equal if and only if their first elements are equal
and their second elements are equal. Surprisingly, instead of taking the ordered pair as a primitive concept, we can
construct ordered pairs using basic notions from set theory. Show that if we define the ordered pair (a, b) to be {{a} , {a, b}},
then (a, b) = (c, d) if and only if a = c and b = d . [Hint: First show that {{a} , {a, b}} = {{c} , {c, d}} if and only if
a = c and b = d.]
kenneth-rosen discrete-mathematics set-theory&algebra difficult
7.1.42 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 5 (Page No. 125) https://gateoverflow.in/308862
a. { 1, 3, 3, 3, 5, 5, 5, 5, 5 }, { 5, 3, 1 }
b. {{ 1 }}, { 1 , { 1 }}
c. ϕ, { ϕ }
7.1.43 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 6 (Page No. 125) https://gateoverflow.in/308863
7.1.44 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.1 Question 7 (Page No. 125) https://gateoverflow.in/308869
For each of the following sets, determine whether 2 is anelement of that set.
a. { xϵR | x is an integer b.
greater | x 1is }the square of
{xϵRthan 2 ,{ 2 }}
c. an{ integer} d. {{ 2 },{{ 2 }}} e. {{ 2 },{ 2 ,{ 2 }}}
f. {{{ 2 }}}
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.45 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 1 (Page No. 136) https://gateoverflow.in/308928
Let A be the set of students who live within one mile of school and let B be the set of students who walk to classes.
Describe the students in each of these sets.
a. A ∩ B b. A ∪ B c. A − B d. B − A
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.46 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 10 (Page No. 136) https://gateoverflow.in/308994
Show that
1. A − ϕ = A.
2. ϕ − A = ϕ
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.47 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 11 (Page No. 136) https://gateoverflow.in/308995
Let A and B be sets. Prove the commutative laws from Table 1 by showing that
1. A ∪ B = B ∪ A.
2. A ∩ B = B ∩ A.
7.1.48 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 12 (Page No. 136) https://gateoverflow.in/308996
Prove the first absorption law from Table 1 by showing that if A and B are sets, then A ∪ (A ∪ B) = A
7.1.49 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 13 (Page No. 136) https://gateoverflow.in/308997
Prove the second absorption law from Table 1 by showing that if A and B are sets, then A ∩ (A ∪ B) = A
7.1.50 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 14 (Page No. 136) https://gateoverflow.in/308999
7.1.51 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 15 (Page No. 136) https://gateoverflow.in/309001
rove the second De Morgan law in Table 1 by showing that if A and B are sets, then ∼ (A ∪ B) = (∼ A∩ ∼ B)
7.1.52 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 16 (Page No. 136) https://gateoverflow.in/309003
7.1.53 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 17 (Page No. 136) https://gateoverflow.in/309004
7.1.54 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 18 (Page No. 136) https://gateoverflow.in/309019
7.1.55 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 19 (Page No. 136) https://gateoverflow.in/309022
a. A − B = A∩ ∼ B.
b. (A ∩ B) ∪ (A∩ ∼ B) = A.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.56 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 2 (Page No. 136) https://gateoverflow.in/308930
Suppose that A is the set of sophomores at your school and B is the set of students in discrete mathematics at your
school. Express each of these sets in terms of A and B .
7.1.57 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 20 (Page No. 136) https://gateoverflow.in/309132
a. A ∪ B = B
b. A ∩ B = A
7.1.58 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 21 (Page No. 136) https://gateoverflow.in/309133
Prove the first associative law from Table 1 by showing that if A, B, and C are sets, then
A ∪ (B ∪ C) = (A ∪ B) ∪ C.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.59 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 22 (Page No. 136) https://gateoverflow.in/309134
Prove the second associative law from Table 1 by showing that if A, B, and C are sets, then
A ∪ (B ∩ C) = (A ∩ B) ∩ C.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.60 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 23 (Page No. 136) https://gateoverflow.in/309135
Prove the first distributive law from Table 1 by showing that if A, B, and C are sets, then
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.61 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 24 (Page No. 136) https://gateoverflow.in/309136
7.1.62 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 25 (Page No. 136) https://gateoverflow.in/309137
a. A ∩ B ∩ C. b. A ∪ B ∪ C.
c. (A ∪ B) ∩ C. d. (A ∩ B) ∪ C.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.63 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 26 (Page No. 136) https://gateoverflow.in/309138
Draw the Venn diagrams for each of these combination sof the sets A, B, and C .
a. A ∩ (B ∪ C)
b. ∼ A∩ ∼ B∩ ∼ C
c. (A − B) ∪ (A − C) ∪ (B − C)
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.64 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 27 (Page No. 136) https://gateoverflow.in/309139
Draw the Venn diagrams for each of these combinations of the sets A, B, and C .
a. A ∩ (B − C)
b. (A ∩ B) ∪ (A ∩ C)
c. (A∩ ∼ B) ∪ (A∩ ∼ C)
7.1.65 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 28 (Page No. 136) https://gateoverflow.in/309140
Draw the Venn diagrams for each of these combinations of the sets A, B, C, and D.
a. (A ∩ B) ∪ (C ∩ D)
b. ∼ A∪ ∼ B∪ ∼ C∪ ∼ D
c. A − (B ∩ C ∩ D)
7.1.66 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 29 (Page No. 136) https://gateoverflow.in/309141
What can you say about the sets A and B if we know that
a. A ∪ B = A? b. A ∩ B = A?
c. A − B = A? d. A ∩ B = B ∩ A?
e. A– B = B − A?
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.67 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 3 (Page No. 136) https://gateoverflow.in/308932
a. A ∪ B b. A ∩ B c. A − B d. B − A
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.68 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 30 (Page No. 137) https://gateoverflow.in/309142
1. A ∪ C = B ∪ C?
2. A ∩ C = B ∩ C?
3. A ∪ C = B ∪ C and A ∩ C = B ∩ C?
7.1.69 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 31 (Page No. 137) https://gateoverflow.in/309143
7.1.70 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 32 (Page No. 137) https://gateoverflow.in/309144
7.1.71 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 35 (Page No. 137) https://gateoverflow.in/309145
7.1.73 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 37 (Page No. 137) https://gateoverflow.in/309147
7.1.74 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 4 (Page No. 136) https://gateoverflow.in/308987
a. A ∪ B b. A ∩ B c. A − B d. B − A
kenneth-rosen discrete-mathematics set-theory&algebra easy
7.1.75 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 49 (Page No. 137) https://gateoverflow.in/306411
∞
Find ⋃ Ai and ⋃∞
i=1 Ai if for every positive integer i,
i=1
a) Ai = {i, i + 1, i + 2, . . .}.
b) Ai = {0, i}.
c) Ai = (0, i), that is, the set of real numbers x with
0 < x < i.
d) Ai = (i,∞), that is, the set of real numbers x with
x > i.
kenneth-rosen discrete-mathematics
7.1.76 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 5 (Page No. 136) https://gateoverflow.in/308988
7.1.77 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 6 (Page No. 136) https://gateoverflow.in/308990
a. A ∪ ϕ = A.
b. A ∩ U = A.
7.1.78 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 7 (Page No. 136) https://gateoverflow.in/308991
a. A ∪ U = U.
b. A ∩ ϕ = ϕ.
7.1.79 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 8 (Page No. 136) https://gateoverflow.in/308992
a. A ∪ A = A.
b. A ∩ A = A.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.80 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.2 Question 9 (Page No. 136) https://gateoverflow.in/308993
a. A∪ ∼ A = U.
b. A∩ ∼ A = ϕ.
7.1.81 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 1 (Page No. 152) https://gateoverflow.in/309469
a. f(x) = 1/x?
b. f(x) = √−x?
−−−−−−−
c. f(x) = ±√(x2 + 1) ?
7.1.82 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 1 (Page No. 153) https://gateoverflow.in/309477
a. the function that assigns to each pair of positive integers the maximum of these two integers
b. the function that assigns to each positive integer the number of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 that do not appear as
decimal digits of the integer
c. the function that assigns to a bit string the number of times the block 11 appears
d. the function that assigns to a bit string the numerical position of the first 1 in the string and that assigns the value 0 to a bit
string consisting of all 0s
7.1.83 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 10 (Page No. 153) https://gateoverflow.in/309481
7.1.84 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 12 (Page No. 153) https://gateoverflow.in/309482
7.1.85 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 13 (Page No. 153) https://gateoverflow.in/309483
7.1.86 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 14 (Page No. 153) https://gateoverflow.in/309485
7.1.87 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 15 (Page No. 153) https://gateoverflow.in/309486
7.1.88 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 16 (Page No. 153) https://gateoverflow.in/309487
Consider these functions from the set of students in a discrete mathematics class. Under what conditions is the function
one-to-one if it assigns to a student his or her
a. mobile phone number. b. student identification number.
c. final grade in the class. d. home town.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.89 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 17 (Page No. 153) https://gateoverflow.in/309488
Consider these functions from the set of teachers in a school. Under what conditions is the function one-to-one if it
assigns to a teacher his or her
a. office.
b. assigned bus to chaperone in a group of buses taking students on a field trip.
c. salary.
d. social security number
7.1.90 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 2 (Page No. 152) https://gateoverflow.in/309471
a. f(n) = + − n.
−−−−−
b. f(n) = √n2 + 1.
c. f(n) = 1/(n2 − 4).
7.1.91 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 20 (Page No. 153) https://gateoverflow.in/309490
7.1.92 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 21 (Page No. 153) https://gateoverflow.in/309491
Give an explicit formula for a function from the set of integers to the set of positive integers that is
a. one-to-one, but not onto. b. onto, but not one-to-one.
c. one-to-one and onto. d. neither one-to-one nor onto.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.93 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 22 (Page No. 153) https://gateoverflow.in/309492
7.1.94 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 23 (Page No. 153) https://gateoverflow.in/309493
7.1.95 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 24 (Page No. 153) https://gateoverflow.in/309494
Let f : R → R and let f(x) > 0 for all xϵR. Show that f(x) is strictly increasing if and only if the function
g(x) = 1/f(x) is strictly decreasing.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.96 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 25 (Page No. 153) https://gateoverflow.in/309495
Let f : R → R and let f(x) > 0 for all xϵR. Show that f(x) is strictly decreasing if and only if the function
g(x) = 1/f(x) is strictly increasing.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.97 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 26 (Page No. 153) https://gateoverflow.in/309496
7.1.98 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 27 (Page No. 153) https://gateoverflow.in/309497
7.1.99 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 28 (Page No. 153) https://gateoverflow.in/309498
Show that the function f(x) = ex from the set of real numbers to the set of real numbers is not invertible, but if the
codomain is restricted to the set of positive real numbers, the resulting function is invertible
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.100 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 29 (Page No. 154) https://gateoverflow.in/309499
Show that the function f(x) = |x| from the set of real numbers to the set of nonnegative real numbers is not invertible,
but if the domain is restricted to the set of nonnegative real numbers, the resulting function is invertible.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.101 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 3 (Page No. 152) https://gateoverflow.in/309472
Determine whether f is a function from the set of all bit strings to the set of integers if
7.1.102 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 30 (Page No. 154) https://gateoverflow.in/309500
a. f(x) = 1 b. f(x) = 2x + 1
c. f(x) = ⌈x/5⌉ d. f(x) = ⌊(x2 + 1)/3⌋
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.103 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 31 (Page No. 154) https://gateoverflow.in/309510
7.1.104 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 32 Page No. 154) https://gateoverflow.in/309511
Let f(x) = 2x where the domain is the set of real numbers. What is
a. f(Z)
b. f(N)
c. f(R)
7.1.105 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 33 (Page No. 154) https://gateoverflow.in/309512
Show that if both f and g are one-to-one functions,then fog is also one-to-one.
Show that if both f and g are onto functions, then fog is also onto.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.106 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 34 (Page No. 154) https://gateoverflow.in/309513
If f and fog are one-to-one, does it follow that g is one-to-one? Justify your answer.
kenneth-rosen discrete-mathematics set-theory&algebra difficult
7.1.107 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 35 (Page No. 154) https://gateoverflow.in/309514
If f and fog are onto, does it follow that g is onto?Justify your answer.
kenneth-rosen discrete-mathematics set-theory&algebra difficult
7.1.108 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 36 (Page No. 154) https://gateoverflow.in/309515
Find fog and gof . Where f(x) = x2 + 1 and g(x) = x + 2 , are functions from R to R.
7.1.109 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 38 (Page No. 154) https://gateoverflow.in/309516
L e t f(x) = ax + b and g(x) = cx + d , where a,b,c, and d ar constants. Determine neccessary and sufficient
conditions on the constants a,b,c, and d so that fog = gof
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.110 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 39 (Page No. 154) https://gateoverflow.in/309517
Show that the function f(x) = ax + b from R to R is invertible, where a and bare constants, with a = 0 , and find the
inverse of f .
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.111 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 4 (Page No. 152) https://gateoverflow.in/309473
Find the domain and range of these functions. Note that in each case, to find the domain, determine the set of elements
assigned values by the function.
a. the function that assigns to each nonnegative integer its last digit
b. the function that assigns the next largest integer to a positive integer
c. the function that assigns to a bit string the number of one bits in the string
d. the function that assigns to a bit string the number of bits in the string
7.1.112 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 40 (Page No. 154) https://gateoverflow.in/309518
Let f be a function from the set A to the set B. Let S adn T be subsets of A .Show that
7.1.113 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 42 (Page No. 154) https://gateoverflow.in/309519
a. f −1 ({1})
b. f −1 ({x|0 < x < 1})
c. f −1 ({x|x > 4})
7.1.114 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 43 (Page No. 154) https://gateoverflow.in/309520
a. g−1 ({0})
b. g−1 ({−1, 0, 1})
c. g−1 ({x|0 < x < 1})
7.1.115 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 44 (Page No. 154) https://gateoverflow.in/309521
a. f −1 (S ∪ T) = f −1 (S) ∪ f −1 (T)
b. f −1 (S ∩ T) = f −1 (S) ∩ f −1 (T)
7.1.116 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 45 (Page No. 154) https://gateoverflow.in/309522
Show that ⌊x + 1/2⌋ is the closest integer to the number x,except when x is midway between two integers, when it is
the larger of these two integers
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.118 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 47 Page No. 154) https://gateoverflow.in/309524
Show that ⌈x − 1/2⌉ is the closest integer to the number x,except when x is midway between two integers, when it is
the smaller of these two integers
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.119 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 48 (Page No. 154) https://gateoverflow.in/309525
Show that if x is a real number, then ⌈x⌉ − ⌊x⌋ = 1 if x is not an integer and ⌈x⌉ − ⌊x⌋ = 0 if x is an integer.
7.1.120 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 49 (Page No. 154) https://gateoverflow.in/309526
Show that if x is a real number, then x − 1 < ⌊x⌋ <= x <= ⌈x⌉ < x + 1.
7.1.121 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 5 (Page No. 152) https://gateoverflow.in/309474
Find the domain and range of these functions. Note that in each case, to find the domain, determine the set of elements
assigned values by the function.
a. the function that assigns to each bit string the number of ones in the string minus the number of zeros in the string
b. the function that assigns to each bit string twice the number of zeros in that string
c. the function that assigns the number of bits left over when a bit string is split into bytes (which are blocks of 8 bits)
d. the function that assigns to each positive integer the largest perfect square not exceeding this integer
7.1.122 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 50 (Page No. 154) https://gateoverflow.in/309527
7.1.123 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 52 (Page No. 154) https://gateoverflow.in/309529
7.1.124 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 53 (Page No. 154) https://gateoverflow.in/309530
Prove that if n is an integer, then ⌊n/2⌋ = n/2 if n is even and (n − 1)/2 if n is odd.
7.1.125 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 54 (Page No. 154) https://gateoverflow.in/309638
Prove that if x is a reall number , then ⌊−x⌋ = − ⌈x⌉ and ⌈−x⌉ = − ⌊x⌋
The function INT is found on some calculators, where INT(x) = ⌊x⌋ when x nonnegative real number and INT (x) =
⌈x⌉ when x is a negative real number. Show that this INT function satisfies the identity INT (−x)=− INT(x)
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.127 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 56 (Page No. 154) https://gateoverflow.in/309640
Let a and b be real numbers with a < b . Use the floor and / or ceiling functions to express the number of integers n
that satisfy the inequality a ≤ n ≤ b .
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.128 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 57 (Page No. 154) https://gateoverflow.in/309641
Let a and b be real numbers with a < b . Use the floor and / or ceiling functions to express the number of integers n
that satisfy the inequality a < n < b.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.129 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 58 (Page No. 154) https://gateoverflow.in/309642
How many bytes are required to encode n bits of data where n equals
a. 4 b. 10 c. 500 d. 3000
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.130 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 59 (Page No. 155) https://gateoverflow.in/309643
How many bytes are required to encode n bits of data where n equals
a. 7 b. 17 c. 1001 d. 28800
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.131 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 6 (Page No. 152) https://gateoverflow.in/309475
a. the function that assigns to each pair of positive integers the first integer of the pair
b. the function that assigns to each positive integer its largest decimal digit
c. the function that assigns to a bit string the number of ones minus the number of zeros in the string
d. the function that assigns to each positive integer the largest integer not exceeding the square root of the integer
e. the function that assigns to a bit string the longest string of ones in the string
7.1.132 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 60 (Page No. 155) https://gateoverflow.in/309644
How many ATM cells (described in Example 28) can be transmitted in 10 seconds over a link operating at the
following rates?
7.1.133 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 61 (Page No. 155) https://gateoverflow.in/309645
Data are transmitted over a particular Ethernet network in blocks of 1500 octets (blocks of 8 bits). How many blocks
are required to transmit the following amounts of data over this Ethernet network? (Note that a byte is a synonym for
an octet, a kilobyte is 1000 bytes, and a megabyte is 1, 000, 000 bytes.)
a. 150 kilobytes of data b. 384 kilobytes of data
c. 1.544 megabytes of data d. 45.3 megabytes of data
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.134 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 62 (Page No. 155) https://gateoverflow.in/309647
7.1.135 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 63 (Page No. 155) https://gateoverflow.in/309648
7.1.136 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 64 (Page No. 155) https://gateoverflow.in/309649
7.1.137 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 65 (Page No. 155) https://gateoverflow.in/309650
7.1.138 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 66 (Page No. 155) https://gateoverflow.in/309651
7.1.139 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 67 (Page No. 155) https://gateoverflow.in/309652
a. f(x) = ⌊x + 1/2⌋
b. f(x) = ⌊2x + 1⌋
c. f(x) = ⌈x/3⌉
d. f(x) = ⌈1/x⌉
e. f(x) = ⌈x − 2⌉ + ⌊x + 2⌋
f. f(x) = ⌊2x⌋ ⌈x/2⌉
g. f(x) = ⌈⌊x − 12⌋ + 1/2⌉
7.1.140 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 68 (Page No. 155) https://gateoverflow.in/309653
a. f(x) = ⌈3x − 2⌉
b. f(x) = ⌈0.2x⌉
c. f(x) = ⌊−1/x⌋
d. f(x) = ⌊x2 ⌋
e. f(x) = ⌈x/2⌉ ⌊x/2⌋
f. f(x) = ⌊x/2⌋ + ⌈x/2⌉
g. f(x) = ⌊2 ⌈x/2⌉ + 1/2⌋
7.1.141 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 69 (Page No. 155) https://gateoverflow.in/309654
Suppose that f is an invertible function from Y to Z and g is an invertible function from X to Y . Show that the inverse
of the composition fog is given by (fog)−1 = g−1 of −1 .
7.1.143 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 71 (Page No. 155) https://gateoverflow.in/309656
Let S be a subset of a universal set U . The characteristic function fs of S is the function from U to the set {0, 1} such
that fS (x) = 1 if x belongs to S and fS (x) = 0 if x does not belong to S . Let A and B be sets. Show that for all x ϵ
U,
a. fA∩B (x) = fA (x). fB (x) b. fA∪B (x) = fA (x) + fB (x)– fA (x). fB (x)
c. f∼A = 1 − fA (x) d. fA⊕B (x) = fA (x) + fB (x) − 2fA (x)fB (x)
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.144 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 72 (Page No. 155) https://gateoverflow.in/309658
Suppose that f is a function from A to B, where A and B are finite sets with |A| = |B| . Show that f is one-to-one if
and only if it is onto.
kenneth-rosen discrete-mathematics set-theory&algebra
7.1.145 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 73 (Page No. 155) https://gateoverflow.in/309663
Prove or disprove each of these statements about the floor and ceiling functions.
7.1.146 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 74 (Page No. 155) https://gateoverflow.in/309664
Prove or disprove each of these statements about the floor and ceiling functions.
7.1.147 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.3 Question 8 (Page No. 153) https://gateoverflow.in/309478
a. ⌊1.1⌋
b. ⌈1.1⌉
c. ⌊−0.1⌋
d. ⌈−0.1⌉
e. ⌈2.99⌉
f. (⌊−2.99⌋)
g. ⌊1/2 + ⌈1/2⌉⌋
h. ⌈⌊1/2⌋ + ⌈1/2⌉ + 1/2⌉
7.1.149 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 1 (Page No. 167) https://gateoverflow.in/337863
A. a0 B. a1 C. a4 D. a5
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.150 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 10 (Page No. 168) https://gateoverflow.in/337881
Find the first six terms of the sequence defined by each of these recurrence relations and initial conditions.
A. an = −2an−1 , a0 = −1
B. an = an−1 − an−2 , a0 = 2, a1 = −1
C. an = 3a2n−1 , a0 = 1
D. an = nan−1 + a2n−2 , a0 = −1, a1 = 0
E. an = an−1 − an−2 + an−3 , a0 = 1, a1 = 1, a2 = 2
7.1.151 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 11 (Page No. 168) https://gateoverflow.in/337884
Let an = 2n + 5 ⋅ 3n for n = 0, 1, 2, …
A. Find a0 a1 , a2 , a3 , and a4 .
B. Show that a2 = 5a1 − 6a0 , a3 = 5a2 − 6a1 , and a4 = 5a3 − 6a2 .
C. Show that an = 5an−1 − 6an−2 for all integers n with n ≥ 2.
7.1.152 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 12 (Page No. 168) https://gateoverflow.in/337887
Show that the sequence {an } is a solution of the recurrence relation an = −3an−1 + 4an−2 if
A. an = 0. B. an = 1.
C. an = (−4)n . D. an = 2(−4)n + 3.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.153 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 13 (Page No. 168) https://gateoverflow.in/337889
A. an =0 B. an = 1
C. an = 2n D. an = 4n
E. an = n4n F. an = 2 ⋅ 4n + 3n4n
G. an = (−4)n H. an = n2 4n
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.154 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 14 (Page No. 168) https://gateoverflow.in/337890
For each of these sequences find a recurrence relation satisfied by this sequence. (The answers are not unique because
there are infinitely many different recurrence relations satisfied by any sequence.)
A. an = 3 B. an = 2n
C. an = 2n + 3 D. an = 5n
E. an = n2 F. an = n2 + n
G. an = n + (−1)n H. an = n!
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.155 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 15 (Page No. 168) https://gateoverflow.in/337891
Show that the sequence {an } is a solution of the recurrence relation an = an−1 + 2an−2 + 2n − 9 if
A. an = −n + 2. B. an = 5(−1)n − n + 2.
C. an = 3(−1)n + 2n − n + 2. D. an = 7 ⋅ 2n − n + 2.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.156 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 16 (Page No. 168) https://gateoverflow.in/337925
Find the solution to each of these recurrence relations with the given initial conditions. Use an iterative approach such
as that used in Example 10.
A. an = −an−1 , a0 = 5 B. an = an−1 + 3, a0 = 1
C. an = an−1 − n, a0 = 4 D. an = 2an−1 − 3, a0 = −1
E. an = (n + 1)an−1 , a0 = 2 F. an = 2nan−1 , a0 = 3
G. an = −an−1 + n − 1, a0 = 7
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.157 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 17 (Page No. 168) https://gateoverflow.in/337927
Find the solution to each of these recurrence relations and initial conditions. Use an iterative approach such as that used
in Example 10.
A. an = 3an−1 , a0 = 2 B. an = an−1 + 2, a0 = 3
C. an = an−1 + n, a0 = 1 D. an = an−1 + 2n + 3, a0 = 4
E. an = 2an−1 − 1, a0 = 1 F. an = 3an−1 + 1, a0 = 1
G. an = nan−1 , a0 = 5 H. an = 2nan−1 , a0 = 1
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.158 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 18 (Page No. 168) https://gateoverflow.in/337929
A. Set up a recurrence relation for the amount in the account at the end of n years.
B. Find an explicit formula for the amount in the account at the end of n years.
C. How much money will the account contain after 100 years?
7.1.159 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 19 (Page No. 168) https://gateoverflow.in/337930
A. Set up a recurrence relation for the number of bacteria after n hours have elapsed.
B. If 100 bacteria are used to begin a new colony, how many bacteria will be in the colony in 10 hours?
7.1.160 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 2 (Page No. 167) https://gateoverflow.in/337866
7.1.161 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 20 (Page No. 168) https://gateoverflow.in/337931
Assume that the population of the world in 2010 was 6.9 billion and is growing at the rate of 1.1% a year.
A. Set up a recurrence relation for the population of the world n years after 2010.
B. Find an explicit formula for the population of the world n years after 2010.
C. What will the population of the world be in 2030?
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.162 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 21 (Page No. 168) https://gateoverflow.in/337932
A factory makes custom sports cars at an increasing rate. In the first month, only one car is made, in the second month,
two cars are made, and so on, with n cars made in the nth month.
A. Set up a recurrence relation for the number of cars produced in the first n months by this factory.
B. How many cars are produced in the first year?
C. Find an explicit formula for the number of cars produced in the first n months by this factory
7.1.163 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 22 (Page No. 168 - 169)
https://gateoverflow.in/337933
An employee joined a company in 2009 with a starting salary of $50, 000. Every year this
employee receives a raise of $1000 plus 5% of the salary of the previous year.
A. Set up a recurrence relation for the salary of this employee n years after 2009.
B. What will the salary of this employee be in 2017?
C. Find an explicit formula for the salary of this employee n years after 2009.
7.1.164 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 23 (Page No. 169) https://gateoverflow.in/337935
Find a recurrence relation for the balance B(k) owed at the end of k months on a loan of $5000 at a rate of 7% if a
payment of $100 is made each month. [Hint: Express B(k) in terms of B(k − 1); the monthly interest is
(0.07/12)B(k − 1). ]
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.165 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 24 (Page No. 169) https://gateoverflow.in/337936
A. Find a recurrence relation for the balance B(k) owed at the end of k months on a loan at a rate of r if a payment P is made
on the loan each month. [Hint: Express B(k) in terms of B(k − 1) and note that the monthly interest rate is r/12.]
B. Determine what the monthly payment P should be so that the loan is paid off after T months.
7.1.166 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 25 (Page No. 169) https://gateoverflow.in/337939
For each of these lists of integers, provide a simple formula or rule that generates the terms of an integer sequence that
begins with the given list.Assuming that your formula or rule is correct, determine the next three terms of the sequence.
A. 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, …
B. 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, …
C. 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, …
D. 3, 6, 12, 24, 48, 96, 192, …
E. 15, 8, 1, −6, −13, −20, −27, …
F. 3, 5, 8, 12, 17, 23, 30, 38, 47, …
G. 2, 16, 54, 128, 250, 432, 686, …
H. 2, 3, 7, 25, 121, 721, 5041, 40321, …
7.1.167 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 26 (Page No. 169) https://gateoverflow.in/337941
For each of these lists of integers, provide a simple formula or rule that generates the terms of an integer sequence that
begins with the given list.Assuming that your formula or rule is correct, determine the next three terms of the sequence.
A. 3, 6, 11, 18, 27, 38, 51, 66, 83, 102, …
B. 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, …
C. 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, …
D. 1, 2, 2, 2, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, …
E. 0, 2, 8, 26, 80, 242, 728, 2186, 6560, 19682, …
F. 1, 3, 15, 105, 945, 10395, 135135, 2027025, 34459425, …
G. 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, …
H. 2, 4, 16, 256, 65536, 4294967296, …
7.1.168 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 27 (Page No. 169) https://gateoverflow.in/337942
Show that if an denotes the nth positive integer that is not a perfect square, then an = n + {√−
n}, where {x} denotes
the integer closest to the real number x.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.169 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 28 (Page No. 169) https://gateoverflow.in/337945
7.1.170 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 29 (Page No. 169) https://gateoverflow.in/337947
7.1.171 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 3 (Page No. 167) https://gateoverflow.in/337868
What are the terms a0 , a1 , a2 , and a3 of the sequence {an }, where an equals
A. 2n + 1 B. (n + 1)n+1
C. ⌊n/2⌋ D. ⌊n/2⌋ + ⌈n/2⌉
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.172 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 30 (Page No. 169) https://gateoverflow.in/337949
A. ∑ j B. ∑ j2
j∈S j∈S
C. ∑(1/j) D. ∑ 1
j∈S j∈S
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.173 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 31 (Page No. 169) https://gateoverflow.in/337950
7.1.175 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 33 (Page No. 169) https://gateoverflow.in/337966
7.1.176 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 34 (Page No. 169) https://gateoverflow.in/337967
7.1.177 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 35 (Page No. 169) https://gateoverflow.in/337968
n
Show that ∑(aj − aj−1 ) = an − a0, where a0 , a1 , … , an is a sequence of real numbers. This type of sum is called
j=1
telescoping.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.178 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 36 (Page No. 169) https://gateoverflow.in/337971
1 ( k−1
1 ) n
1
Version1 : Use the identity = and question 35 to compute ∑ .
k(k + 1) (k + 1) k=1
k(k + 1)
n
Version2 : Use the identity 1/(k(k + 1)) = 1/k − 1/(k + 1) and question 35 to compute ∑ 1/(k(k + 1)).
k=1
Sum both sides of the identity k2 − (k − 1)2 = 2k − 1 from k = 1 to k = n and use question 35 to find
n
A. a formula for ∑(2k − 1) (the sum of the first n odd natural numbers).
k=1
n
B. a formula for ∑ k.
k=1
7.1.180 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 38 (Page No. 169) https://gateoverflow.in/337974
n
Use the technique given in question 35, together with the result of question 37b, to derive the formula for ∑ k2 given
k=1
in Table 2. [Hint: Take ak = k3 in the telescoping sum in question 35.]
7.1.181 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 39 (Page No. 169) https://gateoverflow.in/337975
200
Find ∑ k. (Use Table 2.)
k=100
7.1.182 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 4 (Page No. 167) https://gateoverflow.in/337869
What are the terms a0 , a1 , a2 , and a3 of the sequence {an }, where an equals
A. (−2)n B. 3 C. 7 + 4n D. 2n + (−2)n
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.183 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 41 (Page No. 169) https://gateoverflow.in/337978
m
−
Find a formula for ∑ ⌊√k⌋ , when m is a positive integer.
k=0
7.1.184 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 42 (Page No. 169) https://gateoverflow.in/337979
m
−
Find a formula for ∑ ⌊√k⌋ , when m is a positive integer.
k=0
n
There is also a special notation for products. The product of am , am+1 , … , an is represented by ∏ aj , read as the product
j=m
from j = m to j = n of aj .
7.1.185 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 43 (Page No. 170) https://gateoverflow.in/337980
7.1.186 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 44 (Page No. 170) https://gateoverflow.in/337981
Recall that the value of the factorial function at a positive integer n, denoted by n!, is the product of the positive
integers from 1 to n, inclusive. Also, we specify that 0! = 1.
7.1.187 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 45 (Page No. 170) https://gateoverflow.in/337982
Recall that the value of the factorial function at a positive integer n, denoted by n!, is the product of the positive
integers from 1 to n, inclusive. Also, we specify that 0! = 1.
4
B. ∑ j !
i=0
7.1.188 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 46 (Page No. 170) https://gateoverflow.in/337983
Recall that the value of the factorial function at a positive integer n, denoted by n!, is the product of the positive
integers from 1 to n, inclusive. Also, we specify that 0! = 1.
4
C. ∏ j !
i=0
7.1.189 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 5 (Page No. 167) https://gateoverflow.in/337870
A. the sequence that begins with 2 and in which each successive term is 3 more than the preceding term
B. the sequence that lists each positive integer three times, in increasing order
C. the sequence that lists the odd positive integers in increasing order, listing each odd integer twice
D. the sequence whose nth term is n! − 2n
E. the sequence that begins with 3, where each succeeding term is twice the preceding term
F. the sequence whose first term is 2, second term is 4, and each succeeding term is the sum of the two preceding terms
G. the sequence whose nth term is the number of bits in the binary expansion of the number n (defined in Section 4.2)
H. the sequence where the nth term is the number of letters in the English word for the index n
7.1.190 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 6 (Page No. 167 - 168)
https://gateoverflow.in/337872
List the first 10 terms of each of these sequences.
A. the sequence obtained by starting with 10 and obtaining each term by subtracting 3 from the previous term
B. the sequence whose nth term is the sum of the first n positive integers
C. the sequence whose nth term is 3n − 2n
D. the sequence whose nth term is ⌊√− n⌋
E. the sequence whose first two terms are 1 and 5 and each succeeding term is the sum of the two previous terms
F. the sequence whose nth term is the largest integer whose binary expansion (defined in Section 4.2) has n bits (Write your
answer in decimal notation.)
G. the sequence whose terms are constructed sequentially as follows: start with 1, then add 1, then multiply by 1, then add 2,
then multiply by 2, and so on
H. the sequence whose nth term is the largest integer k such that k! ≤ n
Find at least three different sequences beginning with the terms 1, 2, 4 whose terms are generated by a simple formula
or rule.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.192 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 8 (Page No. 168) https://gateoverflow.in/337875
Find at least three different sequences beginning with the terms 3, 5, 7 whose terms are generated by a simple formula
or rule.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.193 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.4 Question 9 (Page No. 168) https://gateoverflow.in/337879
Find the first five terms of the sequence defined by each of these recurrence relations and initial conditions.
A. an = 6an−1 , a0 = 2
B. an = a2n−1 , a1 = 2
C. an = an−1 + 3an−2 , a0 = 1, a1 = 2
D. an = nan−1 + n2 an−2 , a0 = 1, a1 = 1
E. an = an−1 + an−3 , a0 = 1, a1 = 2, a2 = 0
7.1.194 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 1 (Page No. 176) https://gateoverflow.in/337989
Determine whether each of these sets is finite, countably infinite, or uncountable. For those that are countably infinite,
exhibit a one-to-one correspondence between the set of positive integers and that set.
A. the negative integers B. the even integers
C. the integers less than 100 D. the real numbers between 0 and 12
E. the positive integers less than 1, 000, 000, 000 F. the integers that are multiples of 7
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.195 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 10 (Page No. 176) https://gateoverflow.in/337998
A. finite.
B. countably infinite.
C. uncountable.
7.1.196 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 11 (Page No. 176) https://gateoverflow.in/338001
A. finite.
B. countably infinite.
C. uncountable
7.1.197 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 12 (Page No. 176) https://gateoverflow.in/338002
7.1.199 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 14 (Page No. 176) https://gateoverflow.in/338004
Show that if A and B are sets with the same cardinality, then ∣A ∣≤∣ B∣ and ∣B ∣≤∣ A ∣.
7.1.200 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 15 (Page No. 176) https://gateoverflow.in/338005
7.1.201 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 16 (Page No. 176) https://gateoverflow.in/338006
7.1.202 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 17 (Page No. 176) https://gateoverflow.in/338007
7.1.203 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 18 (Page No. 177) https://gateoverflow.in/338008
Show that if A and B are sets ∣A ∣=∣ B ∣, then ∣P (A) ∣=∣ P (B) ∣.
7.1.204 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 19 (Page No. 177) https://gateoverflow.in/338009
Show that if A, B, C, and D are sets with ∣A ∣=∣ B∣ and ∣C ∣=∣ D ∣, then ∣A × C ∣=∣ B × D ∣.
7.1.205 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 2 (Page No. 176) https://gateoverflow.in/337990
Determine whether each of these sets is finite, countably infinite, or uncountable. For those that are countably infinite,
exhibit a one-to-one correspondence between the set of positive integers and that set.
7.1.206 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 20 (Page No. 177) https://gateoverflow.in/338010
7.1.207 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 21 (Page No. 177) https://gateoverflow.in/338011
Show that if A, B, and C are sets such that ∣A ∣≤∣ B∣ and ∣B ∣≤∣ C ∣, then ∣A ∣≤∣ C ∣.
Suppose that A is a countable set. Show that the set B is also countable if there is an onto function f from A to B.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.209 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 23 (Page No. 177) https://gateoverflow.in/338015
7.1.210 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 24 (Page No. 177) https://gateoverflow.in/338016
7.1.211 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 25 (Page No. 177) https://gateoverflow.in/338017
Prove that if it is possible to label each element of an infinite set S with a finite string of keyboard characters, from a
finite list characters, where no two elements of S have the same label, then S is a countably infinite set.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.212 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 26 (Page No. 177) https://gateoverflow.in/338018
Use question 25 to provide a proof different from that in the text that the set of rational numbers is countable. [Hint:
Show that you can express a rational number as a string of digits with a slash and possibly a minus sign.]
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.213 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 27 (Page No. 177) https://gateoverflow.in/338019
7.1.214 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 28 (Page No. 177) https://gateoverflow.in/338020
7.1.215 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 29 (Page No. 177) https://gateoverflow.in/338021
7.1.216 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 3 (Page No. 176) https://gateoverflow.in/337991
Determine whether each of these sets is countable or uncountable. For those that are countably infinite, exhibit a one-
to-one correspondence between the set of positive integers and that set.
7.1.217 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 30 (Page No. 177) https://gateoverflow.in/338022
Show that the set of real numbers that are solutions of quadratic equations ax2 + bx + c = 0, where a, b, and c are
integers, is countable.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.218 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 31 (Page No. 177) https://gateoverflow.in/338023
7.1.219 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 32 (Page No. 177) https://gateoverflow.in/338025
Show that when you substitute (3n + 1)2 for each occurrence of n and (3m + 1)2 for each occurrence of m in the
right-hand side of the formula for the function f(m, n) in question 31, you obtain a one-to-one polynomial function
Z × Z → Z. It is an open question whether there is a one-to-one polynomial function Q × Q → Q.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.220 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 33 (Page No. 177) https://gateoverflow.in/338028
Use the Schröder-Bernstein theorem to show that (0, 1) and [0, 1] have the same cardinality.
7.1.221 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 34 (Page No. 177) https://gateoverflow.in/338029
Show that (0, 1) and R have the same cardinality. [Hint: Use the Schröder-Bernstein theorem.]
7.1.222 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 35 (Page No. 177) https://gateoverflow.in/338030
Show that there is no one-to-one correspondence from the set of positive integers to the power set of the set of positive
integers. [Hint: Assume that there is such a one-to-one correspondence. Represent a subset of the set of positive
integers as an infinite bit string with ith bit 1 if i belongs to the subset and 0 otherwise. Suppose that you can list these infinite
strings in a sequence indexed by the positive integers. Construct a new bit string with its ith bit equal to the complement of the
ith bit of the ith string in the list. Show that this new bit string cannot appear in the list.]
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.223 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 36 (Page No. 177) https://gateoverflow.in/338033
Show that there is a one-to-one correspondence from the set of subsets of the positive integers to the set real numbers
between 0 and 1. Use this result and question 34 and 35 to conclude that ℵ0 <∣ P (Z + ) ∣=∣ R ∣. [ Hint: Look at the
first part of the hint for Exercise 35.]
7.1.224 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 37 (Page No. 177) https://gateoverflow.in/338034
Show that the set of all computer programs in a particular programming language is countable. [Hint: A computer
program written in a programming language can be thought of as a string of symbols from a finite alphabet.]
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.225 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 38 (Page No. 177) https://gateoverflow.in/338035
Show that the set of functions from the positive integers to the set {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} is uncountable. [Hint:
First set up a one-to-one correspondence between the set of real numbers between 0 and 1 and a subset of these
functions. Do this by associating to the real number 0. d1 d2 … dn … the function f with f(n) = dn. ]
7.1.226 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 39 (Page No. 177) https://gateoverflow.in/338036
We say that a function is computable if there is a computer program that finds the values of this function. Use question
37 and 38 to show that there are functions that are not computable.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.227 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 4 (Page No. 176) https://gateoverflow.in/337992
Determine whether each of these sets is countable or uncountable. For those that are countably infinite, exhibit a one-
to-one correspondence between the set of positive integers and that set.
7.1.228 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 40 (Page No. 177) https://gateoverflow.in/338037
Show that if S is a set, then there does not exist an onto function f from S to P (S), the power set of S . Conclude that
∣S ∣<∣ P (S) ∣. This result is known as Cantor’s theorem. [Hint: Suppose such a function f existed. Let
T = {s ∈ S ∣ s ∉ f(s)} and show that no element s can exist for which f(s) = T. ]
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.229 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 5 (Page No. 176) https://gateoverflow.in/337993
Show that a finite group of guests arriving at Hilbert’s fully occupied Grand Hotel can be given rooms without evicting
any current guest.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.230 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 6 (Page No. 176) https://gateoverflow.in/337994
Suppose that Hilbert’s Grand Hotel is fully occupied, but the hotel closes all the even numbered rooms for maintenance.
Show that all guests can remain in the hotel.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.231 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 7 (Page No. 176) https://gateoverflow.in/337995
Suppose that Hilbert’s Grand Hotel is fully occupied on the day the hotel expands to a second building which also
contains a countably infinite number of rooms. Show that the current guests can be spread out to fill every room of the
two buildings of the hotel.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.232 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 8 (Page No. 176) https://gateoverflow.in/337996
Show that a countably infinite number of guests arriving at Hilbert’s fully occupied Grand Hotel can be given rooms
without evicting any current guest.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.233 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.5 Question 9 (Page No. 176) https://gateoverflow.in/337997
Suppose that a countably infinite number of buses, each containing a countably infinite number of guests, arrive at
Hilbert’s fully occupied Grand Hotel. Show that all the arriving guests can be accommodated without evicting any
current guest.
kenneth-rosen discrete-mathematics set-theory&algebra descriptive
7.1.234 Kenneth Rosen: Kenneth Rosen Edition 7 Exercise 2.6 Question 22 (Page No. 177) https://gateoverflow.in/140453
Suppose that A is a countable set. Show that the set B is also countable if there is an onto function f from A to B.
kenneth-rosen discrete-mathematics set-theory&algebra
7.2.1 Probability: Kenneth Rosen Edition 7 Exercise 7.1 Question 14 (Page No. 451) https://gateoverflow.in/289047
What is the probability that a five-card poker hand contains two pairs (that is, two of each of two different kinds and a
fifth card of a third kind)?
kenneth-rosen discrete-mathematics probability
Answer Keys
7.0.1 Q-Q 7.1.1 N/A 7.1.2 Q-Q 7.1.3 Q-Q 7.1.4 Q-Q
7.1.5 Q-Q 7.1.6 Q-Q 7.1.7 Q-Q 7.1.8 Q-Q 7.1.9 Q-Q
7.1.10 Q-Q 7.1.11 Q-Q 7.1.12 Q-Q 7.1.13 Q-Q 7.1.14 Q-Q
7.1.15 Q-Q 7.1.16 Q-Q 7.1.17 Q-Q 7.1.18 D 7.1.19 Q-Q
7.1.20 Q-Q 7.1.21 Q-Q 7.1.22 Q-Q 7.1.23 Q-Q 7.1.24 Q-Q
7.1.25 Q-Q 7.1.26 Q-Q 7.1.27 Q-Q 7.1.28 Q-Q 7.1.29 Q-Q
7.1.30 Q-Q 7.1.31 Q-Q 7.1.32 Q-Q 7.1.33 Q-Q 7.1.34 Q-Q
7.1.35 Q-Q 7.1.36 Q-Q 7.1.37 Q-Q 7.1.38 Q-Q 7.1.39 Q-Q
7.1.40 Q-Q 7.1.41 Q-Q 7.1.42 Q-Q 7.1.43 Q-Q 7.1.44 Q-Q
7.1.45 Q-Q 7.1.46 Q-Q 7.1.47 Q-Q 7.1.48 Q-Q 7.1.49 Q-Q
7.1.50 Q-Q 7.1.51 Q-Q 7.1.52 Q-Q 7.1.53 Q-Q 7.1.54 Q-Q
7.1.55 Q-Q 7.1.56 Q-Q 7.1.57 Q-Q 7.1.58 Q-Q 7.1.59 Q-Q
7.1.60 Q-Q 7.1.61 Q-Q 7.1.62 Q-Q 7.1.63 Q-Q 7.1.64 Q-Q
7.1.65 Q-Q 7.1.66 Q-Q 7.1.67 Q-Q 7.1.68 Q-Q 7.1.69 Q-Q
7.1.70 Q-Q 7.1.71 Q-Q 7.1.72 Q-Q 7.1.73 Q-Q 7.1.74 Q-Q
7.1.75 Q-Q 7.1.76 Q-Q 7.1.77 Q-Q 7.1.78 Q-Q 7.1.79 Q-Q
7.1.80 Q-Q 7.1.81 Q-Q 7.1.82 Q-Q 7.1.83 Q-Q 7.1.84 Q-Q
7.1.85 Q-Q 7.1.86 Q-Q 7.1.87 Q-Q 7.1.88 Q-Q 7.1.89 Q-Q
7.1.90 Q-Q 7.1.91 Q-Q 7.1.92 Q-Q 7.1.93 Q-Q 7.1.94 Q-Q
7.1.95 Q-Q 7.1.96 Q-Q 7.1.97 Q-Q 7.1.98 Q-Q 7.1.99 Q-Q
7.1.100 Q-Q 7.1.101 Q-Q 7.1.102 Q-Q 7.1.103 Q-Q 7.1.104 Q-Q
7.1.105 Q-Q 7.1.106 Q-Q 7.1.107 Q-Q 7.1.108 Q-Q 7.1.109 Q-Q
7.1.110 Q-Q 7.1.111 Q-Q 7.1.112 Q-Q 7.1.113 Q-Q 7.1.114 Q-Q
7.1.115 Q-Q 7.1.116 Q-Q 7.1.117 Q-Q 7.1.118 Q-Q 7.1.119 Q-Q
7.1.120 Q-Q 7.1.121 Q-Q 7.1.122 Q-Q 7.1.123 Q-Q 7.1.124 Q-Q
7.1.125 Q-Q 7.1.126 Q-Q 7.1.127 Q-Q 7.1.128 Q-Q 7.1.129 Q-Q
7.1.130 Q-Q 7.1.131 Q-Q 7.1.132 Q-Q 7.1.133 Q-Q 7.1.134 Q-Q
7.1.135 Q-Q 7.1.136 Q-Q 7.1.137 Q-Q 7.1.138 Q-Q 7.1.139 Q-Q
7.1.140 Q-Q 7.1.141 Q-Q 7.1.142 Q-Q 7.1.143 Q-Q 7.1.144 Q-Q
7.1.145 Q-Q 7.1.146 Q-Q 7.1.147 Q-Q 7.1.148 Q-Q 7.1.149 N/A
7.1.150 N/A 7.1.151 N/A 7.1.152 N/A 7.1.153 N/A 7.1.154 N/A
7.1.155 N/A 7.1.156 N/A 7.1.157 N/A 7.1.158 N/A 7.1.159 N/A
7.1.160 N/A 7.1.161 N/A 7.1.162 N/A 7.1.163 N/A 7.1.164 N/A
7.1.165 N/A 7.1.166 N/A 7.1.167 N/A 7.1.168 N/A 7.1.169 N/A
7.1.170 N/A 7.1.171 N/A 7.1.172 N/A 7.1.173 N/A 7.1.174 N/A
7.1.175 N/A 7.1.176 N/A 7.1.177 N/A 7.1.178 N/A 7.1.179 N/A
7.1.180 N/A 7.1.181 N/A 7.1.182 N/A 7.1.183 N/A 7.1.184 N/A
7.1.185 N/A 7.1.186 N/A 7.1.187 N/A 7.1.188 N/A 7.1.189 N/A
7.1.190 N/A 7.1.191 N/A 7.1.192 N/A 7.1.193 N/A 7.1.194 N/A
7.1.195 N/A 7.1.196 N/A 7.1.197 N/A 7.1.198 N/A 7.1.199 N/A
7.1.200 N/A 7.1.201 N/A 7.1.202 N/A 7.1.203 N/A 7.1.204 N/A
7.1.205 N/A 7.1.206 N/A 7.1.207 N/A 7.1.208 N/A 7.1.209 N/A
7.1.210 N/A 7.1.211 N/A 7.1.212 N/A 7.1.213 N/A 7.1.214 N/A
7.1.215 N/A 7.1.216 N/A 7.1.217 N/A 7.1.218 N/A 7.1.219 N/A
7.1.220 N/A 7.1.221 N/A 7.1.222 N/A 7.1.223 N/A 7.1.224 N/A
7.1.225 N/A 7.1.226 N/A 7.1.227 N/A 7.1.228 N/A 7.1.229 N/A
7.1.230 N/A 7.1.231 N/A 7.1.232 N/A 7.1.233 N/A 7.1.234 Q-Q
7.2.1 Q-Q
8 Engineering Mathematics: Probability (89)
A biologist needs at least 3 mature specimens of certain plant. The plant needs a year to reach maturity; once a seed is
planted, any plant will survive for the year with probability 1/1000 (independently of other plants). The biologist
plants 3000 seeds. A year is deemed a success if three or more plants from these seeds reach maturity.
(c) The biologist plans to do this year after year. What is the probability that he has at least 2 success in 10 years?
8.1.1 Conditional Probability: Kenneth Rosen Edition 7 Exercise 7.2 Question 24 (Page No. 467)
https://gateoverflow.in/273066
What is the conditional probability that exactly four heads appear when a fair coin is flipped five
times, given that the first flip came up heads?
shouldn’t the answer be 1/16?
my approach
probability that we get 4 head after 4 toss=(1/2)^4
probability that outcome of first toss is head=½
(1/2)4 ∗1/2
P(A/B)=P(A ∩ B)/P(B)= 1/2
answer is given ¼?
where am I going wrong?
b) at least 7 Heads are tossed , what is the probability that your first toss is Heads?
probability gravner engineering-mathematics conditional-probability
a) without replacement
probability gravner engineering-mathematics conditional-probability
Flip a fair coin. If you toss Heads, roll 1 die. If you toss Tails, roll 2 dice. Compute the probability that you roll exactly
one 6.
gravner probability engineering-mathematics conditional-probability
Roll a die, then select at random, without replacement, as many cards from the deck as the number shown on the die.
What is the probability that you get at least one Ace?
gravner probability engineering-mathematics conditional-probability
A factory has three machines, M 1 , M2, and M 3, that produce items (say, light bulbs). It is impossible to tell which
machine produced a particular item, but some are defective. Here are the known numbers:
proportion of prob. any made item
machine
items made is defective
M1 0.2 0.001
M2 0.3 0.002
M3 0.5 0.003
You pick an item, test it, and find it is defective. What is the probability that it was made by M 2?
A fair coin is tossed 10 times. What is the probability that we get exactly 5 Heads?
probability gravner engineering-mathematics
A tennis tournament has 2n participants, n Swedes and n Norwegians. First, n people are chosen at random from the
2n (with no regard to nationality) and then paired randomly with the other n people. Each pair proceeds to play one
match. An outcome is a set of n (ordered) pairs, giving the winner and the loser in each of the n matches.
A tennis tournament has 2n participants, n Swedes and n Norwegians. First, n people are chosen at random from the
2n (with no regard to nationality) and then paired randomly with the other n people. Each pair proceeds to play one
match. An outcome is a set of n (ordered) pairs, giving the winner and the loser in each of the n matches.
(b) What do you need to assume to conclude that all outcomes are equally likely?
probability gravner engineering-mathematics
A tennis tournament has 2n participants, n Swedes and n Norwegians. First, n people are chosen at random from the
2n (with no regard to nationality) and then paired randomly with the other n people. Each pair proceeds to play one
match. An outcome is a set of n (ordered) pairs, giving the winner and the loser in each of the n matches.
(c) Under this assumption, compute the probability that all Swedes are the winners.
probability gravner engineering-mathematics
A group of 3 Norwegians, 4 Swedes, and 5 Finns is seated at random around a table. Compute the probability that at
least one of the three groups ends up sitting together.
probability gravner engineering-mathematics
Three married couples take seats around a table at random . Compute Probability(no wife sits next to her husband).
probability gravner engineering-mathematics
A group of 20 Scandinavians consists of 7 Swedes, 3 Finns, and 10 Norwegians. A committee of five people is chosen
at random from this group. What is the probability that at least one of the three nations is not represented on the
committee?
probability gravner engineering-mathematics
Choose each digit of a 5 digit number at random from digits 1, . . .9. Compute the probability that no digit appears
more than twice..
gravner probability engineering-mathematics
Toss three fair coins. What is the probability of exactly one Heads(H) ?
a) Compute the probability that at least one number occurs exactly 6 times
gravner probability engineering-mathematics
We have a fair coin and unfair coin,which always comes out Heads. Choose one at random, toss it twice. It comes out
Heads both times. What is the probability that the coin is fair?
probability gravner engineering-mathematics
Assume 10 % of people have a certain disease. A test gives the correct diagnosis with probability of 0.8; that is, if the
person is sick, the test will be positive with probability 0.8, but if the person is not sick, the test will be positive with
probability 0.2. A random person from the population has tested positive for the disease. What is the probability that he is
actually sick?(No, it is not 0.8!)
probability gravner engineering-mathematics
Rolla four sided fair die, that is , choose one of the numbers 1, 2, 3, 4 at random. Let
A={1,2}, B={1,3}, C={1,4} . Check that these are pairwise independent (each pair is independent), but not
independent.
probability gravner engineering-mathematics
Many casinos allow you to bet even money of the following game. Two dice are rolled and the sum S is observed.
Assume that two equally matched teams, A and B, play a series of games and that the first team that wins four games
and that the first wins four games is the overall winner of the series. As it happens, team A lost the first game. What is
the probability it will win the series? Assume that the games are Bernoulli trials with success probability 1/2.
probability gravner engineering-mathematics
A mathematician carries two matchboxes, each originally containing n matches. Each time he needs a match, he is
equally likely to take it from either box. what is the probability that, upon reaching for a box and finding it empty, there
are exactly k matches still in the other box? Here, 0 ≤ k ≤ n .
probability gravner engineering-mathematics
Each day, you independently decide, with probability p, to flip a fair coin. Otherwise, you do nothing.
Each day, you independently decide, with probability p, to flip a fair coin. Otherwise, you do nothing.
You roll a die and your score is the number shown on the die. Your friends rolls five dice his score is the number of 6′ s
shown. Compute
(a) the probability of even A that the two scores are equal
gravner probability engineering-mathematics
You roll a die and your score is the number shown on the die. Your friends rolls five dice his score is the number of 6′ s
shown. Compute.
(b) The probability of event B that your friend's score is strictly larger than yours.
gravner probability engineering-mathematics
Consider the following game. Pick one card at random from a full deck of 52 cards. If you pull an Ace, you win
outright.If not, then you look at the value of the card(K ,Q, and J count as 10). If the number is 7 or less you lose
outright. Otherwise you select (at random, without replacement) that number of additional cards from the deck.(For example, if
you picked a 9 the first time, you select 9 more cards.) If you get at least one Ace, you win. What are your chances of winning
this game?
gravner probability engineering-mathematics
You have 16 balls, 3 blue 4 green, and 9 red. You also have 3 urns. For each of the 16 balls. you select an urn at
random and put the ball into it.(Urns are large enough to accommodate any number of balls.)
You have 16 balls, 4 green, and 9 red. You also have 3 urns. For each of the 16 balls. you select an urn at random and
put the ball into it.(Urns are large enough to accommodate any number of balls.)
(b) What is the probability that each urn contains 3 red balls?
gravner probability engineering-mathematics
You have 16 balls, 4 green, and 9 red. You also have 3 urns. For each of the 16 balls. you select an urn at random and
put the ball into it.(Urns are large enough to accommodate any number of balls.)
(c) What is the probability that each urn contains all three colors?
gravner probability engineering-mathematics
Roll a die 4 times. What is the probability that you get different numbers?
probability gravner engineering-mathematics
Assume that you have an n-element set U and that you select r independent random subsets A 1,............Ar ⊂ U . All A i
are chosen so that all 2 n choices are equally likely. Compute (in a simple closed form) the probability that the A i are
pairwise disjoint.
(b) Each of the number 1, 2, 3 appears exactly twice, while the number 4 appears four times.
probability engineering-mathematics gravner
(a) Compute the probability that all couples sit together(i.e., every husband-wife pair occupies adjacent seats).
gravner probability engineering-mathematics
(b) Compute the probability that at most one wife does not sit next to her husband.
gravner probability engineering-mathematics
8.2.39 Gravner: Probability - Gravner-53.a https://gateoverflow.in/246445
Consider the following game. A player rolls a die. If he rolls 3 or less, he loses immediately. Otherwise he selects, at
random, as many cards from a full deck as the number that came up on the die. The player wins if all four Aces are
among the selected cards.
Consider the following game. A player rolls a die. If he rolls 3 or less, he loses immediately. Otherwise he selects, at
random, as many cards from a full deck as the number that came up on the die. The player wins if all four Aces are
among the selected cards.
(b) Smith tells you that he recently played this game once and won. That is the probability that he rolled a 6 on the die?
probability gravner engineering-mathematics
Let X be the number of Heads in 2 fair coin tosses. Determine its p.m.f.
probability gravner engineering-mathematics
An urn contains 20 balls numbers 1, . . . . . . . . .20 . Select 5 balls at random, without replacement. Let X be the largest
number among selected balls. Determine its p.m.f. and the probability that at least one the selected numbers is 15 or
more.
probability gravner engineering-mathematics
Let X be a random variable with P (X = 1) = 0.2, P (X = 2) = 0.3 , and P (X = 3) = 0.5 . What is the expected
value of X ?
probability gravner engineering-mathematics
An urn contains 11 balls, 3 white , 3 red, and 5 blue balls. Take out 3 balls at random, without replacement. You win 1
for each red ball you select and lose a 1 for each white ball you select. Determine the p.m.f. of X , the amount you win.
probability gravner engineering-mathematics
Probability for(all cards of the same suit end up next to each other)
probability gravner engineering-mathematics
A bag has 6 pieces of paper, each with one of the letters, E. E, P , P , P , and R, on it. Pull 6 pieces at random out of
the bag (1) without , and (2) with replacement. What is the probability that these pieces, in order, spell P EP P ER?
probability gravner engineering-mathematics
Sit 3 men and 3 women at random (1) in a row of chairs and (2) around a table. Compute Probability (all women sit
together). In case (2), also compute Probability (men and women alternate).
probability gravner engineering-mathematics
A group consists of 3 Norwegians, 4 Swedes, and 5 Finns, and they sit at random around a table. What is the
probability that all groups end up sitting together?
probability gravner engineering-mathematics
Let X be a N(μ, σ 2 ) random variable and let Y = αX + β , with α > 0. How is Y distributed?
8.4.1 Probability: Kenneth Rosen Edition 7 Exercise 7.2 Example 2 (Page No. 455) https://gateoverflow.in/161474
8.4.2 Probability: Kenneth Rosen Edition 7 Exercise 7.3 Example 2 (Page No. 471) https://gateoverflow.in/130478
Suppose that one person in 10,000 people has a rare genetic disease. There is an excellent test for the disease; 99.9% of
people with the disease test positive and only 0.02% who do not have the disease test positive.
a) What is the probability that someone who tests positive has the genetic disease?
b) What is the probability that someone who tests negative does not have the disease?
My Answers :-
P(D) = 0.00001
P(D') = 0.99999
P(P/D) = 0.999
P(P'/D) = 0.001
P(P/D') = 0.0002
P(P'/D') = 0.9998
(0.999)(0.00001)
Answer a) (0.999)(0.00001)+(0.0002)(0.99999)
(0.9998)(0.99999)
Answer b) (0.9998)(0.99999)+(0.001)(0.00001)
Correct me if I am wrong?
discrete-mathematics kenneth-rosen probability
Let X be the number shown on a rolled fair die. Compute EX,E(X 2), and Var(X).
Denote by d the dominant gene and by r the recessive gene at a single locus. Then dd is called the pure dominant
genotype, dr is called hybrid, and rr the pure recessive genotype. The two genotypes with at least one dominant gene,
dd and dr, result in the phenotype of the dominant gene, while rr results in a recessive phenotype.
probability gravner engineering-mathematics random-variable
Suppose that the probability that a person is killed by lighting in a year is, independently, 1/(500) million. Assume that
the US population is 300 million.
probability gravner engineering-mathematics random-variable
Assume a crime has been committed. It is known that the particular has certain characteristics, which occur with a
small frequency p (say,10 -8) in a population of size n say (10 8). A person who matches these characteristics has been
found at random(e.g., at routine traffic stop or by airport security ) and , since p is so small charged with the crime. There is no
other evidence. What should the defense be?
You roll a die, your opponent tosses a coin. If you roll 6 you win; if you do not roll 6 and your opponent tosses Heads
you lose; otherwise, this round ends and the game repeats. On the average, how many rounds does the game last?
probability gravner engineering-mathematics random-variable
Roll a fair die repeatedly. Let X be the number of 6's in the first 10 rolls and let Y the number of rolls needed to obtain
a 3.
Roll a fair die repeatedly. Let X be the number of 6's in the first 10 rolls and let Y the number of rolls needed to obtain
a 3.
(b) Write down the probability mass function of Y.
gravner random-variable probability engineering-mathematics
Roll a fair die repeatedly. Let X be the number of 6's in the first 10 rolls and let Y the number of rolls needed to obtain
a 3.
Roll a fair die repeatedly. Let X be the number of 6's in the first 10 rolls and let Y the number of rolls needed to obtain
a 3.
A biologist needs at least 3 mature specimens of certain plant. The plant needs a year to reach maturity; once a seed is
planted, any plant will survive for the year with probability 1/1000 (independently of other plants). The biologist
plants 3000 seeds. A year is deemed a success if three or more plants from these seeds reach maturity.
(a) Write down the exact expression for the probability that the biologist will indeed end up with at least 3 mature plants.
gravner probability engineering-mathematics random-variable
A biologist needs at least 3 mature specimens of certain plant. The plant needs a year to reach maturity; once a seed is
planted, any plant will survive for the year with probability 1/1000 (independently of other plants). The biologist
plants 3000 seeds. A year is deemed a success if three or more plants from these seeds reach maturity.
(b) Write down a relevant approximate expression for the probability from(a).Justify briefly the approximation.
gravner probability engineering-mathematics random-variable
A biologist needs at least 3 mature specimens of certain plant. The plant needs a year to reach maturity; once a seed is
planted, any plant will survive for the year with probability 1/1000 (independently of other plants). The biologist
plants 3000 seeds. A year is deemed a success if three or more plants from these seeds reach maturity.
(d) Devise a method to determine the number of seeds the biologist should plant in order to get at least 3 mature plants in a
year with probability at least 0.999.
gravner probability engineering-mathematics random-variable
You are dealt one card at random form a full deck and your opponent is dealt 2 cards (Without any replacement ). If
you get an Ace, he pays you 10 dollar, if you get a King, he pays you 5 dollar (regardless of his cards). If you have
neither an Ace nor a King, but your card is red and your opponent has no red cards, he pays you 1 dollar. In all other cases you
pay him 1 dollar . Determine your expected earnings . Are they positive?
probability gravner engineering-mathematics random-variable
You and your opponent both roll a fair die. If you both roll the same number, the game is repeated, otherwise whoever
rolls the larger number wins. Let N be the number of times the two dice have to be rolled before the game is decided.
(a)Determine the probability mass function of N.
probability gravner engineering-mathematics random-variable
You and your opponent both roll a fair die. If you both roll the same number, the game is repeated, otherwise whoever
rolls the larger number wins. Let N be the number of times the two dice have to be rolled before the game is decided.
You and your opponent both roll a fair die. If you both roll the same number, the game is repeated, otherwise whoever
rolls the larger number wins. Let N be the number of times the two dice have to be rolled before the game is decided.
(c) Assume that you get paid 10 dollar for winning in the first round, 1 dollar for winning in any other round, and nothing
otherwise.Compute your expected winnings .
probability gravner engineering-mathematics random-variable
Each of 50 students in class belongs to exactly one the four groups A, B, C or D. The membership numbers for the
four groups are as follows: A : 5, B : 5, C : 15, D : 20 . First choose one of the 50 students at random and let X be
the size of that student's group . Next, choose one the four groups at random and let Y be its size.
Each of 50 students in class belongs to exactly one the four groups A, B, C or D. The membership numbers for the
four groups are as follows: A : 5, B : 5, C : 15, D : 20 . First choose one of the 50 students at random and let X be
the size of that student's group . Next, choose one the four groups at random and let Y be its size.
Each of 50 students in class belongs to exactly one the four groups A, B, C or D. The membership numbers for the
four groups are as follows: A : 5, B : 5, C : 15, D : 20 . First choose one of the 50 students at random and let X be
the size of that student's group . Next, choose one the four groups at random and let Y be its size.
Each of 50 students in class belongs to exactly one the four groups A, B, C or D. The membership numbers for the
four groups are as follows: A : 5, B : 5, C : 15, D : 20 . First choose one of the 50 students at random and let X be
the size of that student's group . Next, choose one the four groups at random and let Y be its size.
(d) Assume you have a students divided into n groups with memberships s 1,.........sn , and X be the size of the group of a
randomly chosen student, while Y is the size of the randomly chosen group.
Let EY= μ and Var(Y) = σ2 . Express EX with s, n, μ and σ.
(a) Determine c.
gravner probability engineering-mathematics random-variable
(b) Compute P (1 ⩽ X ⩽ 2)
Assume that X is uniform on [0,1]. What is P (XϵQ) ? What is the probability that the binary expansion of X starts
with 0.010?
probability gravner engineering-mathematics random-variable
A uniform random number X divides [0, 1] into two segments. Let R be the ratio of the smaller versus the larger
segment. Compute the density of R.
probability gravner engineering-mathematics random-variable
Assume that a light bulb lasts on average 100 hours. Assuming exponential distribution, compute the probability that it
lasts more than 200 hours and the probability that it lasts less than 50 hours.
probability gravner engineering-mathematics random-variable
Answer Keys
8.0.1 Q-Q 8.1.1 Q-Q 8.1.2 Q-Q 8.1.3 Q-Q 8.1.4 Q-Q
8.1.5 Q-Q 8.1.6 Q-Q 8.1.7 Q-Q 8.1.8 Q-Q 8.2.1 Q-Q
8.2.2 Q-Q 8.2.3 Q-Q 8.2.4 Q-Q 8.2.5 Q-Q 8.2.6 Q-Q
8.2.7 Q-Q 8.2.8 Q-Q 8.2.9 Q-Q 8.2.10 Q-Q 8.2.11 Q-Q
8.2.12 Q-Q 8.2.13 Q-Q 8.2.14 Q-Q 8.2.15 Q-Q 8.2.16 Q-Q
8.2.17 Q-Q 8.2.18 Q-Q 8.2.19 Q-Q 8.2.20 Q-Q 8.2.21 Q-Q
8.2.22 Q-Q 8.2.23 Q-Q 8.2.24 Q-Q 8.2.25 Q-Q 8.2.26 Q-Q
8.2.27 Q-Q 8.2.28 Q-Q 8.2.29 Q-Q 8.2.30 Q-Q 8.2.31 Q-Q
8.2.32 Q-Q 8.2.33 Q-Q 8.2.34 Q-Q 8.2.35 Q-Q 8.2.36 Q-Q
8.2.37 Q-Q 8.2.38 Q-Q 8.2.39 Q-Q 8.2.40 Q-Q 8.2.41 Q-Q
8.2.42 Q-Q 8.2.43 Q-Q 8.2.44 Q-Q 8.2.45 Q-Q 8.2.46 Q-Q
8.2.47 Q-Q 8.2.48 Q-Q 8.2.49 Q-Q 8.2.50 Q-Q 8.3.1 Q-Q
8.4.1 Q-Q 8.4.2 Q-Q 8.5.1 Q-Q 8.5.2 Q-Q 8.5.3 Q-Q
8.5.4 Q-Q 8.5.5 Q-Q 8.5.6 Q-Q 8.5.7 Q-Q 8.5.8 Q-Q
8.5.9 Q-Q 8.5.10 Q-Q 8.5.11 Q-Q 8.5.12 Q-Q 8.5.13 Q-Q
8.5.14 Q-Q 8.5.15 Q-Q 8.5.16 Q-Q 8.5.17 Q-Q 8.5.18 Q-Q
8.5.19 Q-Q 8.5.20 Q-Q 8.5.21 Q-Q 8.5.22 Q-Q 8.5.23 Q-Q
8.5.24 Q-Q 8.5.25 Q-Q 8.5.26 Q-Q 8.5.27 Q-Q
9 Operating System (600)
9.1.1 Bankers Algorithm: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 41 (Page No. 470)
https://gateoverflow.in/325120
Program a simulation of the banker’s algorithm. Your program should cycle through each of the
bank clients asking for a request and evaluating whether it is safe or unsafe. Output a log of requests and decisions to a
file.
tanenbaum operating-system deadlock deadlock-prevention-avoidance-detection bankers-algorithm descriptive
9.2.1 Bitmaps: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 29 (Page No. 335)
https://gateoverflow.in/324777
Suppose that file 21 in Fig. 4 − 25 was not modified since the last dump. In what way would
the four bitmaps of Fig. 4 − 26 be different?
9.4.1 Cylinders: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 28 (Page No. 431)
https://gateoverflow.in/324844
Consider a magnetic disk consisting of 16 heads and 400 cylinders. This disk has four 100-
cylinder zones with the cylinders in different zones containing 160, 200, 240. and 280 sectors, respectively. Assume
that each sector contains 512 bytes, average seek time between adjacent cylinders is 1 msec, and the disk rotates at 7200
RPM. Calculate the
a. disk capacity,
b. optimal track skew, and
c. maximum data transfer rate.
9.4.2 Cylinders: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 29 (Page No. 432)
https://gateoverflow.in/324845
A disk manufacturer has two 5.25-inch disks that each have 10, 000 cylinders. The newer one
has double the linear recording density of the older one. Which disk properties are better on the newer drive and which
are the same? Are any worse on the newer one?
tanenbaum operating-system input-output disks cylinders descriptive
9.5.1 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 1 (Page No. 465)
https://gateoverflow.in/324877
Give an example of a deadlock taken from politics.
tanenbaum operating-system deadlock descriptive
9.5.2 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 10 (Page No. 466)
https://gateoverflow.in/325076
Consider Fig. 6-4. Suppose that in step (o) C requested S instead of requesting R. Would this
lead to deadlock? Suppose that it requested both S and R.
tanenbaum operating-system deadlock descriptive
9.5.3 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 2 (Page No. 465)
https://gateoverflow.in/324878
Students working at individual PCs in a computer laboratory send their files to be printed by a
server that spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for the print
spool is limited? How may the deadlock be avoided?
tanenbaum operating-system deadlock descriptive
9.5.4 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 29 (Page No. 468)
https://gateoverflow.in/325098
A distributed system using mailboxes has two IP C primitives, send and receive. The latter
primitive specifies a process to receive from and blocks if no message from that process is available, even though
messages may be waiting from other processes. There are no shared resources, but processes need to communicate frequently
about other matters. Is deadlock possible? Discuss.
tanenbaum operating-system deadlock descriptive
9.5.5 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 36 (Page No. 468 - 469)
https://gateoverflow.in/325107
Local Area Networks utilize a media access method called CSMA/CD, in which stations sharing
a bus can sense the medium and detect transmissions as well as collisions. In the Ethernet protocol, stations requesting
the shared channel do not transmit frames if they sense the medium is busy. When such transmission has terminated, waiting
stations each transmit their frames. Two frames that are transmitted at the same time will collide. If stations immediately and
repeatedly retransmit after collision detection, they will continue to collide indefinitely
a. Is this a resource deadlock or a livelock?
b. Can you suggest a solution to this anomaly?
c. Can starvation occur with this scenario?
9.5.6 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 37 (Page No. 469)
https://gateoverflow.in/325109
A program contains an error in the order of cooperation and competition mechanisms, resulting
in a consumer process locking a mutex (mutual exclusion semaphore) before it blocks on an empty buffer. The
producer process blocks on the mutex before it can place a value in the empty buffer and awaken the consumer. Thus, both
processes are blocked forever, the producer waiting for the mutex to be unlocked and the consumer waiting for a signal from
the producer. Is this a resource deadlock or a communication deadlock? Suggest methods for its control.
tanenbaum operating-system deadlock descriptive
9.5.7 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 38 (Page No. 469)
https://gateoverflow.in/325111
Cinderella and the Prince are getting divorced. To divide their property, they have agreed on the
following algorithm. Every morning, each one may send a letter to the other’s lawyer requesting one item of property.
Since it takes a day for letters to be delivered, they have agreed that if both discover that they have requested the same item on
the same day, the next day they will send a letter canceling the request. Among their property is their dog, Woofer, Woofer’s
doghouse, their canary, Tweeter, and Tweeter’s cage. The animals love their houses, so it has been agreed that any division of
property separating an animal from its house is invalid, requiring the whole division to start over from scratch. Both Cinderella
and the Prince desperately want Woofer. So that they can go on (separate) vacations, each spouse has programmed a personal
computer to handle the negotiation. When they come back from vacation, the computers are still negotiating. Why? Is deadlock
possible? Is starvation possible? Discuss your answer.
tanenbaum operating-system deadlock descriptive
9.5.8 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 4 (Page No. 465)
https://gateoverflow.in/324880
In Fig. 6-1 the resources are returned in the reverse order of their acquisition. Would giving them
back in the other order be just as good?
9.5.9 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 44 (Page No. 470)
https://gateoverflow.in/325124
In certain countries, when two people meet they bow to each other. The protocol is that one of
them bows first and stays down until the other one bows. If they bow at the same time, they will both stay bowed
forever. Write a program that does not deadlock.
tanenbaum operating-system deadlock descriptive
9.5.10 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 5 (Page No. 465)
https://gateoverflow.in/324881
The four conditions (mutual exclusion, hold and wait, no preemption and circular wait) are
necessary for a resource deadlock to occur. Give an example to show that these conditions are not sufficient for a
resource deadlock to occur. When are these conditions sufficient for a resource deadock to occur?
tanenbaum operating-system deadlock descriptive
9.5.11 Deadlock: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 8 (Page No. 466)
https://gateoverflow.in/324884
Is it possible that a resource deadlock involves multiple units of one type and a single unit of
another? If so, give an example.
tanenbaum operating-system deadlock descriptive
9.5.12 Deadlock: Galvin Edition 9 Exercise 7 Question 1 (Page No. 339) https://gateoverflow.in/306989
List three examples of deadlocks that are not related to a computer system environment.
galvin operating-system deadlock descriptive
9.5.13 Deadlock: Galvin Edition 9 Exercise 7 Question 10 (Page No. 341) https://gateoverflow.in/306999
Is it possible to have a deadlock involving only one single-threaded process ? Explain your answer
galvin operating-system deadlock
9.5.14 Deadlock: Galvin Edition 9 Exercise 7 Question 11 (Page No. 341-342) https://gateoverflow.in/307000
a. Show that the four necessary conditions for deadlock hold in this example.
b. State a simple rule for avoiding deadlocks in this system
9.5.15 Deadlock: Galvin Edition 9 Exercise 7 Question 12 (Page No. 341) https://gateoverflow.in/307001
Assume a multithreaded application uses only reader–writer locks for synchronization. Applying the four necessary
conditions for deadlock, is deadlock still possible if multiple reader–writer locks are used ?
galvin operating-system deadlock
9.5.16 Deadlock: Galvin Edition 9 Exercise 7 Question 13 (Page No. 341) https://gateoverflow.in/307002
/* thread one runs in this function */
void *do work one(void *param)
{
pthread mutex lock(&first mutex);
pthread mutex lock(&second mutex);
/**
* Do some work
*/
pthread mutex unlock(&second mutex);
pthread mutex unlock(&first mutex);
pthread exit(0);
}
/* thread two runs in this function */
void *do work two(void *param)
{
pthread mutex lock(&second mutex);
pthread mutex lock(&first mutex);
/**
* Do some work
*/
pthread mutex unlock(&first mutex);
pthread mutex unlock(&second mutex);
pthread exit(0);
}
The program example shown above doesn’t always lead to deadlock. Describe what role the CP U scheduler plays and how it
can contribute to deadlock in this program.
galvin operating-system deadlock
9.5.17 Deadlock: Galvin Edition 9 Exercise 7 Question 15 (Page No. 342) https://gateoverflow.in/307003
Compare the circular-wait scheme with the various deadlock-avoidance schemes (like the banker’s algorithm) with
respect to the following issues:
a. Runtime overheads
b. System throughput
galvin operating-system deadlock
9.5.18 Deadlock: Galvin Edition 9 Exercise 7 Question 2 (Page No. 339) https://gateoverflow.in/306990
Suppose that a system is in an unsafe state. Show that it is possible for the processes to complete their execution
without entering a deadlocked state.
galvin operating-system deadlock descriptive
9.5.19 Deadlock: Galvin Edition 9 Exercise 7 Question 20 (Page No. 343) https://gateoverflow.in/307008
Consider again the setting in the preceding question. Assume now that each philosopher requires three chopsticks to
eat. Resource requests are still issued one at a time. Describe some simple rules for determining whether a particular
request can be satisfied without causing deadlock given the current allocation of chopsticks to philosophers.
9.5.20 Deadlock: Galvin Edition 9 Exercise 7 Question 24 (Page No. 344) https://gateoverflow.in/307027
What is the optimistic assumption made in the deadlock-detection algorithm ? How can this assumption be violated ?
galvin operating-system deadlock descriptive
9.5.21 Deadlock: Galvin Edition 9 Exercise 7 Question 25 (Page No. 344) https://gateoverflow.in/307028
A single-lane bridge connects the two Vermont villages of North Tunbridge and South Tunbridge. Farmers in the two
villages use this bridge to deliver their produce to the neighboring town. The bridge can become deadlocked if a
northbound and a southbound farmer get on the bridge at the same time. (Vermont farmers are stubborn and are unable to back
up.) Using semaphores and/or mutex lock design an algorithm in pseudo code that prevents deadlock. Initially, do not be
concerned about starvation (the situation in which northbound farmers prevent southbound farmers from using the bridge, or
vice versa).
galvin operating-system deadlock descriptive
9.5.22 Deadlock: Galvin Edition 9 Exercise 7 Question 26 (Page No. 344) https://gateoverflow.in/307029
9.5.23 Deadlock: Galvin Edition 9 Exercise 7 Question 6 (Page No. 340) https://gateoverflow.in/306994
Consider a computer system that runs 5,000 jobs per month and has no deadlock-prevention or deadlock-avoidance
scheme. Deadlocks occur about twice per month, and the operator must terminate and re run about ten jobs per
deadlock. Each job is worth about two dollars (in CPU time), and the jobs terminated tend to be about half done when they are
aborted.
A systems programmer has estimated that a deadlock-avoidance algorithm (like the banker’s algorithm) could be installed in
the system
with an increase of about 10 percent in the average execution time per job. Since the machine currently has 30 percent idle
time, all 5,000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average.
a. What are the arguments for installing the deadlock-avoidance algorithm ?
b. What are the arguments against installing the deadlock-avoidance algorithm?
galvin operating-system deadlock
9.5.24 Deadlock: Galvin Edition 9 Exercise 7 Question 7 (Page No. 341) https://gateoverflow.in/306995
Can a system detect that some of its processes are starving? If you answer “yes,” explain how it can. If you answer
“no,” explain how the system can deal with the starvation problem.
galvin operating-system deadlock
9.6.1 Deadlock Detection Algorithm: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 42 (Page No. 470)
https://gateoverflow.in/325122
Write a program to implement the deadlock detection algorithm with multiple resources of each
type. Your program should read from a file the following inputs: the number of processes, the number of resource
types, the number of resources of each type in existence (vector E), the current allocation matrix C (first row,
followed by the second row, and so on), the request matrix R (first row, followed by the second row, and so on). The output of
your program should indicate whether there is a deadlock in the system. In case there is, the program should print out the
identities of all processes that are deadlocked.
tanenbaum operating-system deadlock-detection-algorithm descriptive
9.7.1 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 11 (Page No.
466) https://gateoverflow.in/325078
Suppose that there is a resource deadlock in a system. Give an example to show that the set of processes deadlocked
can include processes that are not in the circular chain in the corresponding resource allocation graph.
tanenbaum operating-system deadlock deadlock-prevention-avoidance-detection descriptive
9.7.2 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 12 (Page No.
466) https://gateoverflow.in/325079
In order to control traffic, a network router, A periodically sends a message to its neighbor, B, telling it to increase or
decrease the number of packets that it can handle. At some point in time, Router A is flooded with traffic and sends B a
message telling it to cease sending traffic. It does this by specifying that the number of bytes B may send ( A′ s window size) is
0. As traffic surges decrease, A sends a new message, telling B to restart transmission. It does this by increasing the window
size from 0 to a positive number. That message is lost. As described, neither side will ever transmit. What type of deadlock is
this?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.3 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 13 (Page No.
466) https://gateoverflow.in/325080
The discussion of the ostrich algorithm mentions the possibility of process-table slots or other system tables filling up.
Can you suggest a way to enable a system administrator to recover from such a situation?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.4 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 14 (Page No.
466) https://gateoverflow.in/325081
Consider the following state of a system with four processes , P 1, P 2, P 3, and P 4, and five types of resources,
RS1, RS2, RS3, RS4, and RS5 :
Using the deadlock detection algorithm described in Section 6.4.2, show that there is a deadlock in the system. Identify the
processes that are deadlocked.
9.7.5 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 15 (Page No.
467) https://gateoverflow.in/325082
Explain how the system can recover from the deadlock in previous problem using
9.7.6 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 16 (Page No.
467) https://gateoverflow.in/325084
Suppose that in Fig. 6-6 Cij + Rij > Ej for some i. What implications does this have for the system?
9.7.7 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 17 (Page No.
467) https://gateoverflow.in/325085
All the trajectories in Fig. 6-8 are horizontal or vertical. Can you envision any circumstances in which diagonal
trajectories are also possible?
9.7.8 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 18 (Page No.
467) https://gateoverflow.in/325086
Can the resource trajectory scheme of Fig. 6-8 also be used to illustrate the problem of deadlocks with three processes
and three resources? If so, how can this be done? If not, why not?
9.7.9 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 19 (Page No.
467) https://gateoverflow.in/325088
In theory, resource trajectory graphs could be used to avoid deadlocks. By clever scheduling, the operating system
could avoid unsafe regions. Is there a practical way of actually doing this?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.10 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 20 (Page
No. 467) https://gateoverflow.in/325089
Can a system be in a state that is neither deadlocked nor safe? If so, give an example. If not, prove that all states are
either deadlocked or safe.
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.11 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 21 (Page
No. 467) https://gateoverflow.in/325090
Take a careful look at Fig. 6-11(b). If D asks for one more unit, does this lead to a safe state or an unsafe one? What if
the request came from C instead of D?
9.7.12 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 22 (Page
No. 467) https://gateoverflow.in/325091
A system has two processes and three identical resources. Each process needs a maximum of two resources. Is deadlock
possible? Explain your answer.
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.13 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 23 (Page
No. 467) https://gateoverflow.in/325092
Consider the previous problem again, but now with p processes each needing a maximum of m resources and a total of
r resources available. What condition must hold to make the system deadlock free?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.14 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 24 (Page
No. 467) https://gateoverflow.in/325093
Suppose that process A in Fig. 6-12 requests the last tape drive. Does this action lead to a deadlock?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.15 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 25 (Page
No. 467) https://gateoverflow.in/325094
The banker’s algorithm is being run in a system with m resource classes and n processes. In the limit of large m and
n, the number of operations that must be performed to check a state for safety is proportional to ma nb . What are the
values of a and b?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.16 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 26 (Page
No. 467) https://gateoverflow.in/325095
A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows:
9.7.17 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 27 (Page
No. 467) https://gateoverflow.in/325096
One way to eliminate circular wait is to have rule saying that a process is entitled only to a single resource at any
moment. Give an example to show that this restriction is unacceptable in many cases.
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.18 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 28 (Page
No. 468) https://gateoverflow.in/325097
Two processes, A and B, each need three records, 1, 2, and 3, in a database. If A asks for them in the order 1, 2, 3,
and B asks for them in the same order, deadlock is not possible. However, if B asks for them in the order 3, 2, 1, then
deadlock is possible. With three resources, there are 3! or six possible combinations in which each process can request them.
What fraction of all the combinations is guaranteed to be deadlock free?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.19 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 30 (Page
No. 468) https://gateoverflow.in/325099
In an electronic funds transfer system, there are hundreds of identical processes that work as follows. Each process
reads an input line specifying an amount of money, the account to be credited, and the account to be debited. Then it locks both
accounts and transfers the money, releasing the locks when done. With many processes running in parallel, there is a very real
danger that a process having locked account x will be unable to lock y because y has been locked by a process now waiting for
x. Devise a scheme that avoids deadlocks. Do not release an account record until you have completed the transactions. (In
other words, solutions that lock one account and then release it immediately if the other is locked are not allowed.)
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.20 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 31 (Page
No. 468) https://gateoverflow.in/325102
One way to prevent deadlocks is to eliminate the hold-and-wait condition. In the text it was proposed that before asking
for a new resource, a process must first release whatever resources it already holds (assuming that is possible).
However, doing so introduces the danger that it may get the new resource but lose some of the existing ones to competing
processes. Propose an improvement to this scheme.
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.21 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 32 (Page
No. 468) https://gateoverflow.in/325103
A computer science student assigned to work on deadlocks thinks of the following brilliant way to eliminate deadlocks.
When a process requests a resource, it specifies a time limit. If the process blocks because the resource is not available,
a timer is started. If the time limit is exceeded, the process is released and allowed to run again. If you were the professor, what
grade would you give this proposal and why?
tanenbaum deadlock-prevention-avoidance-detection deadlock descriptive
9.7.22 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 33 (Page
No. 468) https://gateoverflow.in/325104
Main memory units are preempted in swapping and virtual memory systems. The processor is preempted in time-
sharing environments. Do you think that these preemption methods were developed to handle resource deadlock or for
other purposes? How high is their overhead?
tanenbaum operating-system deadlock-prevention-avoidance-detection deadlock descriptive
9.7.23 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 34 (Page
No. 468) https://gateoverflow.in/325105
9.7.24 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 35 (Page
No. 468) https://gateoverflow.in/325106
Assume two processes are issuing a seek command to reposition the mechanism to access the disk and enable a read
command. Each process is interrupted before executing its read, and discovers that the other has moved the disk arm.
Each then reissues the seek command, but is again interrupted by the other. This sequence continually repeats. Is this a
resource deadlock or a livelock? What methods would you recommend to handle the anomaly?
tanenbaum operating-system deadlock-prevention-avoidance-detection descriptive
9.7.25 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 6 (Page No.
465 - 466) https://gateoverflow.in/324882
City streets are vulnerable to a circular blocking condition called gridlock, in which intersections are blocked by cars
that then block cars behind them that then block the cars that are trying to enter the previous intersection, etc. All
intersections around a city block are filled with vehicles that block the oncoming traffic in a circular manner. Gridlock is a
resource deadlock and a problem in competition synchronization. New York City’s prevention algorithm, called "don’t block
the box," prohibits cars from entering an intersection unless the space following the intersection is also available. Which
prevention algorithm is this? Can you provide any other prevention algorithms for gridlock?
tanenbaum operating-system deadlock deadlock-prevention-avoidance-detection descriptive
9.7.26 Deadlock Prevention Avoidance Detection: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 7 (Page No.
466) https://gateoverflow.in/324883
Suppose four cars each approach an intersection from four different directions simultaneously. Each corner of the
intersection has a stop sign. Assume that traffic regulations require that when two cars approach adjacent stop signs at
the same time, the car on the left must yield to the car on the right. Thus, as four cars each drive up to their individual stop
signs, each waits (indefinitely) for the car on the left to proceed. Is this anomaly a communication deadlock? Is it a resource
deadlock?
tanenbaum operating-system deadlock deadlock-prevention-avoidance-detection descriptive
9.7.27 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 16 (Page No. 342-343)
https://gateoverflow.in/307004
In a real computer system, neither the resources available nor the demands of processes for
resources are consistent over long periods (months). Resources break or are replaced, new processes come and go, and
new resources are bought and added to the system. If deadlock is controlled by the banker’s algorithm, which of the following
changes can be made safely (without introducing the possibility of deadlock), and under what circumstances ?
c. Increase Max for one process (the process needs or wants more resources than allowed).
d. Decrease Max for one process (the process decides it does not need that many resources).
9.7.28 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 17 (Page No. 343)
https://gateoverflow.in/307005
Consider a system consisting of four resources of the same type that are shared by three
processes, each of which needs at most two resources. Show that the system is deadlock free.
galvin operating-system deadlock deadlock-prevention-avoidance-detection
9.7.29 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 18 (Page No. 343)
https://gateoverflow.in/307006
Consider a system consisting of m resources of the same type being shared by n
processes.Aprocess can request or release only one resource at a time. Show that the system is deadlock free if the
following two conditions hold:
a. The maximum need of each process is between one resource and m resources.
9.7.30 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 19 (Page No. 343)
https://gateoverflow.in/307007
Consider the version of the dining-philosophers problem in which the chopsticks are placed at
the center of the table and any two of them can be used by a philosopher. Assume that requests for chopsticks are made
one at a time. Describe a simple rule for determining whether a particular request can be satisfied without causing deadlock
given the current allocation of chopsticks to philosophers.
galvin operating-system deadlock deadlock-prevention-avoidance-detection
9.7.31 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 21 (Page No. 343)
https://gateoverflow.in/307022
We can obtain the banker’s algorithm for a single resource type from the general banker’s
algorithm simply by reducing the dimensionality of the various arrays by 1. Show through an example that we cannot
implement the multiple-resource-type banker’s scheme by applying the single-resource-type scheme to each resource type
individually.
galvin operating-system deadlock deadlock-prevention-avoidance-detection
9.7.32 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 22 (Page No. 343)
https://gateoverflow.in/307024
Consider the following snapshot of a system:
Allocation Max
ABCD ABCD
P0 3 0 1 4 5 1 1 7
P1 2 2 1 0 3 2 1 1
P2 3 1 2 1 3 3 2 1
P3 0 5 1 0 4 6 1 2
P4 4 2 1 2 6 3 2 5
Using the banker’s algorithm, determine whether or not each of the following states is unsafe. If the state is safe, illustrate the
order in which the processes may complete.Otherwise, illustrate why the state is unsafe.
a. Available = (0, 3, 0, 1)
b. Available = (1, 0, 0, 2)
9.7.33 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 23 (Page No. 344)
https://gateoverflow.in/307026
Consider the following snapshot of a system:
Allocation Max Available
ABCD ABCD ABCD
P0 2 0 0 1 4 2 1 2 3 3 2 1
P1 3 1 2 1 5 2 5 2
P2 2 1 0 3 2 3 1 6
P3 1 3 1 2 1 4 2 4
P4 1 4 3 2 3 6 6 5
Answer the following questions using the banker’s algorithm:
a. Illustrate that the system is in a safe state by demonstrating an order in which the processes may complete.
b. If a request from process P1 arrives for (1, 1, 0, 0), can the request be granted immediately ?
c. If a request from process P4 arrives for (0, 0, 2, 0), can the request be granted immediately?
9.7.34 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 3 (Page No. 340)
https://gateoverflow.in/306991
Consider the following snapshot of a system:
Allocation Max Available
A B CD A B CD A B CD
P0 0 0 1 2 0 0 1 2 1 5 2 0
P1 1 0 0 0 1 7 5 0
P2 1 3 5 4 2 3 5 6
P3 0 6 3 2 0 6 5 2
P4 0 0 1 4 0 6 5 6
9.7.36 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 8 (Page No. 341)
https://gateoverflow.in/306996
Consider the following resource-allocation policy. Requests for and releases of resources are
allowed at any time. If a request for resources cannot be satisfied because the resources are not available, then we check
any processes that are blocked waiting for resources. If a blocked process has the desired resources, then these resources are
taken away from it and are given to the requesting process. The vector of resources for which the blocked process is waiting is
increased to include the resources that were taken away.
For example, a system has three resource types, and the vector Available is initialized to (4, 2, 2). If process P0 asks for
(2, 2, 1), it gets them. If P1 asks for (1, 0, 1), it gets them. Then, if P0 asks for (0, 0, 1), it is blocked (resource not available).
If P2 now asks for (2, 0, 0), it gets the available one (1, 0, 0), as well as one that was allocated to P0 (since P0 is blocked). P0
Allocation vector goes down to (1, 2, 1), and its Need vector goes up to (1, 0, 1).
a. Can deadlock occur ? If you answer “yes,” give an example. If you answer “no,” specify which necessary condition cannot
occur.
b. Can indefinite blocking occur ? Explain your answer.
galvin operating-system deadlock deadlock-prevention-avoidance-detection
9.7.37 Deadlock Prevention Avoidance Detection: Galvin Edition 9 Exercise 7 Question 9 (Page No. 341)
https://gateoverflow.in/306998
Suppose that you have coded the deadlock-avoidance safety algorithm and now have been asked
to implement the deadlock-detection algorithm. Can you do so by simply using the safety algorithm code and
redefining Maxi = Waitingi + Allocationi , where Waitingi is a vector specifying the resources for which process i is
waiting and Allocationi specifies the resources currently allocated to process Pi ? Explain your answer.
galvin operating-system deadlock deadlock-prevention-avoidance-detection
9.8.1 Dining Philosophers Problem: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 54 (Page No. 178)
https://gateoverflow.in/324566
In the solution to the dining philosophers problem (Fig. 2 − 47), why is the state variable set to
HUNGRY in the procedure take_forks?
9.9.1 Disk Block: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 11 (Page No. 333)
https://gateoverflow.in/324724
Contiguous allocation of files leads to disk fragmentation, as mentioned in the text, because
some space in the last disk block will be wasted in files whose length is not an integral number of blocks. Is this
internal fragmentation or external fragmentation? Make an analogy with something discussed in the previous chapter.
tanenbaum operating-system file-system fragmentation disk-block descriptive
9.10.1 Disk Controller: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 26 (Page No. 431)
https://gateoverflow.in/324842
If a disk controller writes the bytes it receives from the disk to memory as fast as it receives
them, with no internal buffering, is interleaving conceivably useful? Discuss your answer.
tanenbaum operating-system input-output disk-controller descriptive
9.11.1 Disk Scheduling: Galvin Edition 9 Exercise 10 Question 1 (Page No. 497) https://gateoverflow.in/307209
Is disk scheduling, other than FCFS scheduling, useful in a single-user environment ? Explain your answer.
galvin operating-system disk-scheduling descriptive
9.11.2 Disk Scheduling: Galvin Edition 9 Exercise 10 Question 10 (Page No. 498) https://gateoverflow.in/307220
Explain why SSDs (Solid State Drives) often use an FCFS disk-scheduling algorithm.
galvin operating-system disk-scheduling descriptive
9.11.3 Disk Scheduling: Galvin Edition 9 Exercise 10 Question 11 (Page No. 498-499) https://gateoverflow.in/307221
Suppose that a disk drive has 5, 000 cylinders, numbered 0 to 4, 999. The drive is currently serving a request at
cylinder 2, 150, and the previous request was at cylinder 1, 805. The queue of pending requests, in FIFO order, is:
2, 069, 1, 212, 2, 296, 2, 800, 544, 1, 618, 356, 1, 523, 4, 965, 3681
Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the
pending requests for each of the following disk-scheduling algorithms ?
a. FCFS
b. SSTF
c. SCAN
d. LOOK
e. C − SCAN
f. C − LOOK
galvin operating-system disk-scheduling descriptive
9.11.4 Disk Scheduling: Galvin Edition 9 Exercise 10 Question 15 (Page No. 499-500) https://gateoverflow.in/307222
Compare the performance of C − SCAN and SCAN scheduling, assuming a uniform distribution of requests.
Consider the average response time (the time between the arrival of a request and the completion of that request’s
service), the variation in response time, and the effective bandwidth. How does performance depend on the relative sizes of
seek time and rotational latency ?
galvin operating-system disk-scheduling descriptive
9.11.5 Disk Scheduling: Galvin Edition 9 Exercise 10 Question 2 (Page No. 497) https://gateoverflow.in/307210
Explain why SSTF scheduling tends to favor middle cylinders over the innermost and outermost cylinders.
galvin operating-system disk-scheduling descriptive
9.11.6 Disk Scheduling: Galvin Edition 9 Exercise 10 Question 3 (Page No. 497) https://gateoverflow.in/307212
Why is rotational latency usually not considered in disk scheduling ? How would you modify SSTF , SCAN , and
C − SCAN to include latency optimization ?
galvin operating-system disk-scheduling descriptive
9.11.7 Disk Scheduling: Galvin Edition 9 Exercise 10 Question 9 (Page No. 498) https://gateoverflow.in/307218
None of the disk-scheduling disciplines, except FCFS , is truly fair (starvation may occur).
a. Explain why this assertion is true.
b. Describe a way to modify algorithms such as SCAN to ensure fairness.
c. Explain why fairness is an important goal in a time-sharing system.
d. Give three or more examples of circumstances in which it is important that the operating system be unfair in serving I /O
requests.
galvin operating-system disk-scheduling descriptive
9.12.1 Disk Space: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 19 (Page No. 334)
https://gateoverflow.in/324767
It has been suggested that efficiency could be improved and disk space saved by storing the data
of a short file within the i-node. For the i-node of Fig. 4 − 13, how many bytes of data could be stored inside the i-
node?
tanenbaum operating-system file-system disk-space descriptive
9.13.1 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 14 (Page No. 333) https://gateoverflow.in/324727
In light of the answer to the previous question, does compacting the disk ever make any sense?
tanenbaum operating-system file-system disks descriptive
9.13.2 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 36 (Page No. 335) https://gateoverflow.in/324786
Consider the idea behind Fig. 4 − 21, but now for a disk with a mean seek time of 6 msec, a rotational rate of
15, 000 rpm, and 1, 048, 576 bytes per track. What are the data rates for block sizes of 1 KB, 2 KB, and 4 KB,
respectively?
A certain file system uses 4 − KB disk blocks. The median file size is 1KB. If all files were exactly 1KB, what
fraction of the disk space would be wasted? Do you think the wastage for a real file system will be higher than this
number or lower than it? Explain your answer.
tanenbaum operating-system file-system disks descriptive
9.13.4 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 38 (Page No. 336) https://gateoverflow.in/324788
Given a disk-block size of 4 KB and block-pointer address value of 4 bytes, what is the largest file size (in bytes) that
can be accessed using 10 direct addresses and one indirect block?
tanenbaum operating-system file-system disks descriptive
9.13.5 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 40 (Page No. 336) https://gateoverflow.in/324794
A UNIX file system has 4 − KB blocks and 4−byte disk addresses. What is the maximum file size if i-nodes contain
10 direct entries, and one single, double, and triple indirect entry each?
tanenbaum operating-system file-system disks descriptive
9.13.6 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 41 (Page No. 336) https://gateoverflow.in/324795
How many disk operations are needed to fetch the i-node for a file with the path name /usr/ast/courses/os/handout.t?
Assume that the i-node for the root directory is in memory, but nothing else along the path is in memory. Also assume
that all directories fit in one disk block.
9.13.7 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 42 (Page No. 336) https://gateoverflow.in/324796
In many UNIX systems, the i-nodes are kept at the start of the disk. An alternative design is to allocate an i-node when
a file is created and put the i-node at the start of the first block of the file. Discuss the pros and cons of this alternative.
tanenbaum operating-system file-system disks descriptive
9.13.8 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 43 (Page No. 336) https://gateoverflow.in/324797
Write a program that reverses the bytes of a file, so that the last byte is now first and the first byte is now last. It must
work with an arbitrarily long file, but try to make it reasonably efficient.
tanenbaum operating-system file-system disks descriptive
9.13.9 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 44 (Page No. 336) https://gateoverflow.in/324798
Write a program that starts at a given directory and descends the file tree from that point recording the sizes of all the
files it finds. When it is all done, it should print a histogram of the file sizes using a bin width specified as a parameter
(e.g., with 1024, file sizes of 0 to 1023 go in one bin, 1024 to 2047 go in the next bin, etc.).
tanenbaum operating-system file-system disks descriptive
9.13.10 Disks: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 48 (Page No. 336)
https://gateoverflow.in/324804
Implement a simulated file system that will be fully contained in a single regular file stored on
the disk. This disk file will contain directories, i-nodes, free-block information, file data blocks, etc. Choose appropriate
algorithms for maintaining free-block information and for allocating data blocks (contiguous, indexed, linked). Your program
will accept system commands from the user to create/delete directories, create/delete/open files, read/write from/to a selected
file, and to list directory contents.
tanenbaum operating-system file-system disks descriptive
9.13.11 Disks: Galvin Edition 9 Exercise 10 Question 23 (Page No. 501) https://gateoverflow.in/307223
Discuss the reasons why the operating system might require accurate information on how blocks are stored on a disk.
How could the operating system improve file-system performance with this knowledge ?
galvin operating-system file-system disks
9.13.12 Disks: Galvin Edition 9 Exercise 10 Question 7 (Page No. 497-498) https://gateoverflow.in/307214
It is sometimes said that tape is a sequential-access medium, whereas a magnetic disk is a random-access medium. In
fact, the suitability of a storage device for random access depends on the transfer size. The term “streaming transfer
rate” denotes the rate for a data transfer that is underway, excluding the effect of access latency. In contrast, the “effective
transfer rate” is the ratio of total bytes per total seconds, including overhead time such as access latency.
Suppose we have a computer with the following characteristics: the level-2 cache has an access latency of 8 nanoseconds and a
streaming transfer rate of 800 megabytes per second, the main memory has an access latency of 60 nanoseconds and a
streaming transfer rate of 80 megabytes per second, the magnetic disk has an access latency of 15 milliseconds and a streaming
transfer rate of 5 megabytes per second, and a tape drive has an access latency of 60 seconds and a streaming transfer rate of 2
megabytes per second.
a. Random access causes the effective transfer rate of a device to decrease, because no data are transferred during the access
time. For the disk described, what is the effective transfer rate if an average access is followed by a streaming transfer of
(1)512 bytes,
(2)8 kilobytes, (3)1 megabyte, and (4)16 megabytes ?
b. The utilization of a device is the ratio of effective transfer rate to streaming transfer rate. Calculate the utilization of the disk
drive for each of the four transfer sizes given in part a.
c. Suppose that a utilization of 25 percent (or higher) is considered acceptable. Using the performance figures given, compute
the smallest transfer size for disk that gives acceptable utilization.
d. Complete the following sentence: A disk is a random-access device for transfers larger than bytes and is a sequential access
device for smaller transfers.
e. Compute the minimum transfer sizes that give acceptable utilization for cache, memory, and tape.
9.14.1 File Allocation Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 35 (Page No. 335)
https://gateoverflow.in/324784
Consider a disk that has 10 data blocks starting from block 14 through 23. Let there be 2 files
on the disk: f1 and f2. The directory structure lists that the first data blocks of f1 and f2 are respectively 22 and 16.
Given the FAT table entries as below, what are the data blocks allotted to f1 and
f2?(14, 18); (15, 17); (16, 23); (17, 21); (18, 20); (19, 15); (20, −1); (21, −1); (22, 19); (23, 14). In the above notation,
(x, y) indicates that the value stored in table entry x points to data block y.
tanenbaum operating-system file-system file-allocation-table descriptive
9.14.2 File Allocation Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 39 (Page No. 336)
https://gateoverflow.in/324793
Files in MS − DOS have to compete for space in the FAT − 16 table in memory. If one file
uses k entries, that is k entries that are not available to any other file, what constraint does this place on the total length
of all files combined?
tanenbaum operating-system file-system file-allocation-table descriptive
9.15.1 File Organization: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 12 (Page No. 333)
https://gateoverflow.in/324725
Describe the effects of a corrupted data block for a given file for:
a. contiguous,
b. linked, and
c. indexed (or table based).
9.16.2 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 13 (Page No. 333)
https://gateoverflow.in/324726
One way to use contiguous allocation of the disk and not suffer from holes is to compact the disk
every time a file is removed. Since all files are contiguous, copying a file requires a seek and rotational delay to read
the file, followed by the transfer at full speed. Writing the file back requires the same work. Assuming a seek time of 5 msec,
a rotational delay of 4 msec, a transfer rate of 80 MB/sec, and an average file size of 8 KB, how long does it take to read a
file into main memory and then write it back to the disk at a new location? Using these numbers, how long would it take to
compact half of a 16 − GB disk?
tanenbaum operating-system file-system memory-management descriptive
9.16.3 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 17 (Page No. 334)
https://gateoverflow.in/324763
For a given class, the student records are stored in a file. The records are randomly accessed and
updated. Assume that each student’s record is of fixed size. Which of the three allocation schemes (contiguous, linked
and table/indexed) will be most appropriate?
tanenbaum operating-system file-system memory-management descriptive
9.16.4 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 18 (Page No. 334)
https://gateoverflow.in/324764
Consider a file whose size varies between 4 KB and 4 MB during its lifetime. Which of the
three allocation schemes (contiguous, linked and table/indexed) will be most appropriate?
tanenbaum operating-system file-system memory-management descriptive
9.16.5 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 2 (Page No. 332)
https://gateoverflow.in/324715
In Windows, when a user double clicks on a file listed by Windows Explorer, a program is run
and given that file as a parameter. List two different ways the operating system could know which program to run.
tanenbaum operating-system file-system descriptive
9.16.6 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 20 (Page No. 334)
https://gateoverflow.in/324768
Two computer science students, Carolyn and Elinor, are having a discussion about i-nodes.
Carolyn maintains that memories have gotten so large and so cheap that when a file is opened, it is simpler and faster
just to fetch a new copy of the i-node into the i-node table, rather than search the entire table to see if it is already there. Elinor
disagrees. Who is right?
tanenbaum operating-system file-system descriptive
9.16.7 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 21 (Page No. 334)
https://gateoverflow.in/324769
Name one advantage of hard links over symbolic links and one advantage of symbolic links over
hard links.
tanenbaum operating-system file-system descriptive
9.16.8 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 22 (Page No. 334)
https://gateoverflow.in/324770
Explain how hard links and soft links differ with respective to i-node allocations.
tanenbaum operating-system file-system memory-management descriptive
9.16.9 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 23 (Page No. 334)
https://gateoverflow.in/324771
Consider a 4 − TB disk that uses 4 − KB blocks and the free-list method. How many block
addresses can be stored in one block?
tanenbaum operating-system file-system memory-management descriptive
9.16.10 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 24 (Page No. 334)
https://gateoverflow.in/324772
Free disk space can be kept track of using a free list or a bitmap. Disk addresses require D bits.
For a disk with B blocks, F of which are free, state the condition under which the free list uses less space than the
bitmap. For D having the value 16 bits, express your answer as a percentage of the disk space that must be free.
tanenbaum operating-system file-system memory-management descriptive
9.16.11 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 25 (Page No. 334)
https://gateoverflow.in/324773
The beginning of a free-space bitmap looks like this after the disk partition is first formatted
: 1000 0000 0000 0000 (the first block is used by the root directory). The system always searches for free blocks
starting at the lowest-numbered block, so after writing file A, which uses six blocks, the bitmap looks like this
: 1111 1110 0000 0000. Show the bitmap after each of the following additional actions:
a. File B is written, using five blocks. b. File A is deleted.
c. File C is written, using eight blocks. d. File B is deleted.
tanenbaum operating-system file-system memory-management descriptive
9.16.12 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 26 (Page No. 334)
https://gateoverflow.in/324774
What would happen if the bitmap or free list containing the information about free disk blocks
was completely lost due to a crash? Is there any way to recover from this disaster, or is it bye-bye disk? Discuss your
answers for UNIX and the FAT − 16 file system separately.
tanenbaum operating-system file-system memory-management descriptive
9.16.13 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 27 (Page No. 335)
https://gateoverflow.in/324775
Oliver Owl’s night job at the university computing center is to change the tapes used for
overnight data backups. While waiting for each tape to complete, he works on writing his thesis that proves
Shakespeare’s plays were written by extraterrestrial visitors. His text processor runs on the system being backed up since that
is the only one they have. Is there a problem with this arrangement?
tanenbaum operating-system file-system descriptive
9.16.14 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 31 (Page No. 335)
https://gateoverflow.in/324779
Consider Fig. 4 − 27. Is it possible that for some particular block number the counters in both
lists have the value 2? How should this problem be corrected?
9.16.15 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 32 (Page No. 335)
https://gateoverflow.in/324780
The performance of a file system depends upon the cache hit rate (fraction of blocks found in the
cache). If it takes 1 msec to satisfy a request from the cache, but 40 msec to satisfy a request if a disk read is needed,
give a formula for the mean time required to satisfy a request if the hit rate is h. Plot this function for values of h varying from
0 to 1.0.
tanenbaum operating-system file-system cache-memory descriptive
9.16.16 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 34 (Page No. 335)
https://gateoverflow.in/324783
Consider an application where students’ records are stored in a file. The application takes a
student ID as input and subsequently reads, updates, and writes the corresponding student record; this is repeated till
the application quits. Would the "block read ahead" technique be useful here?
tanenbaum operating-system file-system descriptive
9.16.17 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 5 (Page No. 333)
https://gateoverflow.in/324718
Systems that support sequential files always have an operation to rewind files. Do systems that
support random-access files need this, too?
tanenbaum operating-system file-system descriptive
9.16.18 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 6 (Page No. 333)
https://gateoverflow.in/324719
Some operating systems provide a system call rename to give a file a new name. Is there any
difference at all between using this call to rename a file and just copying the file to a new file with the new name,
followed by deleting the old one?
9.16.19 File System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 8 (Page No. 333)
https://gateoverflow.in/324721
A simple operating system supports only a single directory but allows it to have arbitrarily many
files with arbitrarily long file names. Can something approximating a hierarchical file system be simulated? How?
tanenbaum operating-system file-system descriptive
9.16.20 File System: Galvin Edition 9 Exercise 11 Question 1 (Page No. 539) https://gateoverflow.in/307162
Some systems automatically delete all user files when a user logs off or
a job terminates, unless the user explicitly requests that they be kept.
Other systems keep all files unless the user explicitly deletes them.
Discuss the relative merits of each approach.
operating-system galvin file-system descriptive
9.16.21 File System: Galvin Edition 9 Exercise 11 Question 10 (Page No. 540) https://gateoverflow.in/307171
The open-file table is used to maintain information about files that are
currently open. Should the operating system maintain a separate table
for each user or maintain just one table that contains references to files
that are currently being accessed by all users? If the same file is being
accessed by two different programs or users, should there be separate
entries in the open-file table? Explain.
operating-system galvin descriptive file-system
9.16.22 File System: Galvin Edition 9 Exercise 11 Question 11 (Page No. 540) https://gateoverflow.in/307172
9.16.23 File System: Galvin Edition 9 Exercise 11 Question 12 (Page No. 540) https://gateoverflow.in/307225
9.16.25 File System: Galvin Edition 9 Exercise 11 Question 16 (Page No. 540) https://gateoverflow.in/307230
9.16.26 File System: Galvin Edition 9 Exercise 11 Question 17 (Page No. 540) https://gateoverflow.in/307231
9.16.27 File System: Galvin Edition 9 Exercise 11 Question 18 (Page No. 541) https://gateoverflow.in/307232
9.16.28 File System: Galvin Edition 9 Exercise 11 Question 2 (Page No. 539) https://gateoverflow.in/307163
Why do some systems keep track of the type of a file, while others leave
it to the user and others simply do not implement multiple file types?
Which system is “better”?
9.16.29 File System: Galvin Edition 9 Exercise 11 Question 4 (Page No. 539) https://gateoverflow.in/307165
9.16.30 File System: Galvin Edition 9 Exercise 11 Question 5 (Page No. 539) https://gateoverflow.in/307166
9.16.31 File System: Galvin Edition 9 Exercise 11 Question 6 (Page No. 539) https://gateoverflow.in/307167
9.16.32 File System: Galvin Edition 9 Exercise 11 Question 7 (Page No. 539) https://gateoverflow.in/307168
Consider a system that supports 5,000 users. Suppose that you want to
allow 4,990 of these users to be able to access one file.
a. How would you specify this protection scheme in UNIX?
b. Can you suggest another protection scheme that can be used more
effectively for this purpose than the scheme provided by UNIX?
operating-system galvin descriptive file-system
9.16.33 File System: Galvin Edition 9 Exercise 11 Question 8 (Page No. 539) https://gateoverflow.in/307169
9.16.34 File System: Galvin Edition 9 Exercise 11 Question 9 (Page No. 540) https://gateoverflow.in/307170
Consider a file system in which a file can be deleted and its disk space
reclaimed while links to that file still exist.What problems may occur if
a new file is created in the same storage area or with the same absolute
path name? How can these problems be avoided?
operating-system galvin descriptive file-system
9.16.35 File System: Galvin Edition 9 Exercise 12 Question 1 (Page No. 581) https://gateoverflow.in/307139
Consider a file currently consisting of 100 blocks. Assume that the filecontrol
block (and the index block, in the case of indexed allocation)
is already in memory. Calculate how many disk I/O operations are
required for contiguous, linked, and indexed (single-level) allocation
strategies, if, for one block, the following conditions hold. In the
contiguous-allocation case, assume that there is no room to grow at
the beginning but there is room to grow at the end. Also assume that
the block information to be added is stored in memory.
a. The block is added at the beginning.
b. The block is added in the middle.
c. The block is added at the end.
d. The block is removed from the beginning.
e. The block is removed from the middle.
f. The block is removed from the end.
operating-system galvin file-system
9.16.36 File System: Galvin Edition 9 Exercise 12 Question 10 (Page No. 582) https://gateoverflow.in/307150
9.16.37 File System: Galvin Edition 9 Exercise 12 Question 11 (Page No. 582) https://gateoverflow.in/307152
What are the advantages of the variant of linked allocation that uses a
FAT to chain together the blocks of a file?
operating-system galvin descriptive file-system
9.16.38 File System: Galvin Edition 9 Exercise 12 Question 12 (Page No. 582) https://gateoverflow.in/307153
9.16.39 File System: Galvin Edition 9 Exercise 12 Question 13 (Page No. 582) https://gateoverflow.in/307154
9.16.40 File System: Galvin Edition 9 Exercise 12 Question 14 (Page No. 582) https://gateoverflow.in/307155
9.16.41 File System: Galvin Edition 9 Exercise 12 Question 15 (Page No. 583) https://gateoverflow.in/307156
Consider a file system on a disk that has both logical and physical
block sizes of 512 bytes. Assume that the information about each
file is already in memory. For each of the three allocation strategies
(contiguous, linked, and indexed), answer these questions:
a. How is the logical-to-physical address mapping accomplished
in this system? (For the indexed allocation, assume that a file is
always less than 512 blocks long.)
b. If we are currently at logical block 10 (the last block accessed was
block 10) and want to access logical block 4, how many physical
blocks must be read from the disk?
operating-system galvin file-system
9.16.42 File System: Galvin Edition 9 Exercise 12 Question 16 (Page No. 583) https://gateoverflow.in/307157
Consider a file system that uses inodes to represent files. Disk blocks
are 8 KB in size, and a pointer to a disk block requires 4 bytes. This file
system has 12 direct disk blocks, as well as single, double, and triple
indirect disk blocks. What is the maximum size of a file that can be
stored in this file system?
operating-system galvin file-system
9.16.43 File System: Galvin Edition 9 Exercise 12 Question 17 (Page No. 582) https://gateoverflow.in/307158
9.16.45 File System: Galvin Edition 9 Exercise 12 Question 19 (Page No. 583) https://gateoverflow.in/307160
Explain why logging metadata updates ensures recovery of a file system after a file-system crash.
operating-system galvin file-system descriptive
9.16.46 File System: Galvin Edition 9 Exercise 12 Question 2 (Page No. 581) https://gateoverflow.in/307140
9.16.47 File System: Galvin Edition 9 Exercise 12 Question 3 (Page No. 581) https://gateoverflow.in/307141
Why must the bit map for file allocation be kept on mass storage, rather
than in main memory?
galvin operating-system file-system
9.16.48 File System: Galvin Edition 9 Exercise 12 Question 4 (Page No. 581) https://gateoverflow.in/307142
9.16.49 File System: Galvin Edition 9 Exercise 12 Question 5 (Page No. 581) https://gateoverflow.in/307145
One problem with contiguous allocation is that the user must preallocate
enough space for each file. If the file grows to be larger than the
space allocated for it, special actions must be taken. One solution to this
problem is to define a file structure consisting of an initial contiguous
area (of a specified size). If this area is filled, the operating system
automatically defines an overflow area that is linked to the initial
contiguous area. If the overflow area is filled, another overflow area
is allocated. Compare this implementation of a file with the standard
contiguous and linked implementations.
operating-system galvin file-system
9.16.50 File System: Galvin Edition 9 Exercise 12 Question 6 (Page No. 582) https://gateoverflow.in/307146
9.16.51 File System: Galvin Edition 9 Exercise 12 Question 7 (Page No. 582) https://gateoverflow.in/307147
9.16.53 File System: Galvin Edition 9 Exercise 12 Question 9 (Page No. 582) https://gateoverflow.in/307149
a. All extents are of the same size, and the size is predetermined.
b. Extents can be of any size and are allocated dynamically.
c. Extents can be of a few fixed sizes, and these sizes are predetermined.
galvin operating-system descriptive file-system
9.17.1 Fsm: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 13 (Page No. 174) https://gateoverflow.in/324489
In the text, we described a multithreaded Web server, showing why it is better than a single-threaded server and a
finite-state machine server. Are there any circumstances in which a single-threaded server might be better? Give an
example.
tanenbaum operating-system process-and-threads fsm descriptive
9.18.1 Galvin: Galvin Edition 9 Exercise 5 Question 1 (Page No. 242) https://gateoverflow.in/306863
disabling interrupts frequently can affect the system’s clock. Explain why this can occur and how such effects can be
minimized.
galvin operating-system process-synchronization descriptive
9.18.2 Galvin: Galvin Edition 9 Exercise 5 Question 10 (Page No. 243) https://gateoverflow.in/306873
Explain why implementing synchronization primitives by disabling interrupts is not appropriate in a single-processor
system if the synchronization primitives are to be used in user-level programs.
galvin operating-system process-synchronization descriptive
9.18.3 Galvin: Galvin Edition 9 Exercise 5 Question 11 (Page No. 244) https://gateoverflow.in/306874
Explain why interrupts are not appropriate for implementing synchronization primitives in multiprocessor systems.
galvin operating-system process-synchronization descriptive
9.18.4 Galvin: Galvin Edition 9 Exercise 5 Question 12 (Page No. 244) https://gateoverflow.in/306875
The Linux kernel has a policy that a process cannot hold a spin lock while attempting to acquire a semaphore. Explain
why this policy is in place.
galvin operating-system process-synchronization descriptive
9.18.5 Galvin: Galvin Edition 9 Exercise 5 Question 13 (Page No. 244) https://gateoverflow.in/306876
Describe two kernel data structures in which race conditions are possible.Be sure to include a description of how a race
condition can occur.
galvin operating-system process-synchronization descriptive
9.18.6 Galvin: Galvin Edition 9 Exercise 5 Question 14 (Page No. 244) https://gateoverflow.in/306877
Describe how the compare_and_swap() instruction can be used to provide mutual exclusion that satisfies the bounded-
waiting requirement.
galvin operating-system process-synchronization descriptive
9.18.7 Galvin: Galvin Edition 9 Exercise 5 Question 15 (Page No. 244) https://gateoverflow.in/306878
Consider how to implement a mutex lock using an atomic hardware instruction. Assume that the following structure
defining the mutex
lock is available:
typedef struct {
int available;
} lock;
(available == 0) indicates that the lock is available, and a value of 1 indicates that the lock is unavailable. Using this struct,
illustrate how the following functions can be implemented using the test and set() and compare and swap() instructions:
• voidacquire(lock ∗ mutex)
•voidrelease(lock ∗ mutex)
Be sure to include any initialization that may be necessary.
galvin operating-system process-synchronization descriptive
9.18.8 Galvin: Galvin Edition 9 Exercise 5 Question 17 (Page No. 245) https://gateoverflow.in/306880
Assume that a system has multiple processing cores. For each of the following scenarios, describe which is a better
locking mechanism—a spinlock or a mutex lock where waiting processes sleep while waiting for the lock to become
available:
• The lock is to be held for a short duration.
• The lock is to be held for a long duration.
• A thread may be put to sleep while holding the lock.
galvin operating-system process-synchronization descriptive
9.18.9 Galvin: Galvin Edition 9 Exercise 5 Question 18 (Page No. 246) https://gateoverflow.in/306881
Assume that a context switch takes T time. Suggest an upper bound (in terms of T) for holding a spinlock. If the
spinlock is held for any longer, a mutex lock (where waiting threads are put to sleep) is a better alternative.
galvin operating-system process-synchronization descriptive
9.18.10 Galvin: Galvin Edition 9 Exercise 5 Question 19 (Page No. 246) https://gateoverflow.in/306882
A multithreaded web server wishes to keep track of the number of requests it services (known as hits). Consider the two
following
strategies to prevent a race condition on the variable hits. The first strategy is to use a basic mutex lock when updating hits:
int hits;
mutex lock hit lock;
hit lock.acquire();
hits++;
hit lock.release();
A second strategy is to use an atomic integer:
atomic t hits;
atomic inc(&hits);
Explain which of these two strategies is more efficient.
galvin operating-system process-synchronization descriptive
9.18.11 Galvin: Galvin Edition 9 Exercise 5 Question 2 (Page No. 242) https://gateoverflow.in/306865
Explain why Windows, Linux, and Solaris implement multiple locking mechanisms. Describe the circumstances under
which they use spin locks,mutex locks, semaphores, adaptive mutex locks, and condition variables. In each case,
explain why the mechanism is needed.
galvin operating-system process-synchronization descriptive
9.18.12 Galvin: Galvin Edition 9 Exercise 5 Question 20 (Page No. 246-247) https://gateoverflow.in/306883
Consider the code example for allocating and releasing processes shown below:
9.18.13 Galvin: Galvin Edition 9 Exercise 5 Question 21 (Page No. 247) https://gateoverflow.in/306884
Servers can be designed to limit the number of open connections. For example, a server may wish to have only N
socket connections at any point in time. As soon as N connections are made, the server will not accept another
incoming connection until an existing connection is released. Explain how semaphores can be used by a server to limit the
number of concurrent connections.
galvin operating-system process-synchronization descriptive
9.18.14 Galvin: Galvin Edition 9 Exercise 5 Question 22 (Page No. 247) https://gateoverflow.in/306885
Windows Vista provides a lightweight synchronization tool called slim reader–writer locks. Whereas most
implementations of reader–writer locks favor either readers or writers, or perhaps order waiting threads using a FIFO
policy, slim reader–writer locks favor neither readers nor writers, nor are waiting threads ordered in a FIFO queue. Explain
the benefits of providing such a synchronization tool.
galvin operating-system process-synchronization descriptive
9.18.15 Galvin: Galvin Edition 9 Exercise 5 Question 23 (Page No. 247) https://gateoverflow.in/306886
Show how to implement the wait() and signal() semaphore operations in multiprocessor environments using the
testandset()instruction. The solution should exhibit minimal busy waiting.
galvin operating-system process-synchronization descriptive
9.18.16 Galvin: Galvin Edition 9 Exercise 5 Question 25 (Page No. 247) https://gateoverflow.in/306887
Demonstrate that monitors and semaphores are equivalent in so far as they can be used to implement solutions to the
same types of synchronization problems.
galvin operating-system process-synchronization descriptive
9.18.17 Galvin: Galvin Edition 9 Exercise 5 Question 26 (Page No. 247) https://gateoverflow.in/306941
Design an algorithm for a bounded-buffer monitor in which the buffers (portions) are embedded within the monitor
itself.
galvin operating-system process-synchronization descriptive
9.18.18 Galvin: Galvin Edition 9 Exercise 5 Question 28 (Page No. 247) https://gateoverflow.in/306942
Discuss the tradeoff between fairness and throughput of operations in the readers–writers problem. Propose a method
for solving the readers–writers problem without causing starvation.
galvin operating-system process-synchronization descriptive
9.18.19 Galvin: Galvin Edition 9 Exercise 5 Question 29 (Page No. 248) https://gateoverflow.in/306943
How does the signal() operation associated with monitors differ from the corresponding operation defined for
semaphores?
galvin operating-system process-synchronization descriptive
9.18.20 Galvin: Galvin Edition 9 Exercise 5 Question 3 (Page No. 243) https://gateoverflow.in/306866
What is the meaning of the term busy waiting ? What other kinds of waiting are there in an operating system ? Can
busy waiting be avoided altogether ? Explain your answer.
galvin operating-system process-synchronization descriptive
9.18.21 Galvin: Galvin Edition 9 Exercise 5 Question 31 (Page No. 248) https://gateoverflow.in/306944
Consider a system consisting of processes P1 , P2 , . . . , Pn , each of which has a unique priority number. Write a
monitor that allocates three identical printers to these processes, using the priority numbers for deciding the order of
allocation.
galvin operating-system process-synchronization descriptive
9.18.22 Galvin: Galvin Edition 9 Exercise 5 Question 32 (Page No. 248) https://gateoverflow.in/306945
A file is to be shared among different processes, each of which has a unique number. The file can be accessed
simultaneously by several processes, subject to the following constraint: the sum of all unique numbers associated with
all the processes currently accessing the file must be less than n.Write a monitor to coordinate access to the file.
galvin operating-system process-synchronization descriptive
9.18.23 Galvin: Galvin Edition 9 Exercise 5 Question 33 (Page No. 248) https://gateoverflow.in/306946
When a signal is performed on a condition inside a monitor, the signaling process can either continue its execution or
transfer control to the process that is signaled. How would the solution to the preceding exercise differ with these two
different ways in which signaling can be performed?
galvin operating-system process-synchronization descriptive
9.18.24 Galvin: Galvin Edition 9 Exercise 5 Question 34 (Page No. 248) https://gateoverflow.in/306947
Suppose we replace the wait() and signal() operations of monitors with a single construct a wait(B), where B is a
general Boolean expression that causes the process executing it to wait until B becomes true.
9.18.25 Galvin: Galvin Edition 9 Exercise 5 Question 35 (Page No. 248) https://gateoverflow.in/306948
Design an algorithm for a monitor that implements an alarm clock that enables a calling program to delay itself for a
specified number of time units (ticks). You may assume the existence of a real hardware clock that invokes a function
tick() in your monitor at regular intervals.
galvin operating-system process-synchronization descriptive
9.18.26 Galvin: Galvin Edition 9 Exercise 5 Question 4 (Page No. 243) https://gateoverflow.in/306867
Explain why spin locks are not appropriate for single-processor systems yet are often used in multiprocessor systems.
galvin operating-system process-synchronization descriptive
9.18.27 Galvin: Galvin Edition 9 Exercise 5 Question 5 (Page No. 243) https://gateoverflow.in/306868
Show that, if the wait() and signal() semaphore operations are not executed atomically, then mutual exclusion may
be violated.
galvin operating-system process-synchronization descriptive
9.18.28 Galvin: Galvin Edition 9 Exercise 5 Question 6 (Page No. 243) https://gateoverflow.in/306869
Illustrate how a binary semaphore can be used to implement mutual exclusion among n processes.
galvin operating-system process-synchronization descriptive
9.18.29 Galvin: Galvin Edition 9 Exercise 5 Question 7 (Page No. 243) https://gateoverflow.in/306870
Race conditions are possible in many computer systems. Consider a banking system that maintains an account balance
with two functions: deposit(amount) and withdraw(amount). These two functions are passed the amount that is
to be deposited or withdrawn from the bank account balance. Assume that a husband and wife share a bank account.
Concurrently, the husband calls the withdraw() function and the wife calls deposit(). Describe how a race condition is
possible and what might be done to prevent the race condition from occurring.
galvin operating-system process-synchronization descriptive
9.18.30 Galvin: Galvin Edition 9 Exercise 5 Question 8 (Page No. 243-244) https://gateoverflow.in/306871
The first known correct software solution to the critical-section problem for two processes was developed by Dekker.
The two processes, P0 and P1, share the following variables:
boolean flag[2]; /* initially false */
int turn;
The structure of process Pi (i == 0 or 1) is shown below. The other process is Pj (j == 1 or 0). Prove that the algorithm satisfies
all three requirements for the critical-section problem.
do {
flag[i] = true;
while (flag[j]) {
if (turn == j) {
flag[i] = false;
while (turn == j)
; /* do nothing */
flag[i] = true;
}
}
/* critical section */
turn = j;
flag[i] = false;
/* remainder section */
} while (true);
galvin operating-system process-synchronization descriptive
9.18.31 Galvin: Galvin Edition 9 Exercise 5 Question 9 (Page No. 243-245) https://gateoverflow.in/306872
The first known correct software solution to the critical-section problem for n processes with a lower bound on waiting
of n − 1 turns was presented by Eisenberg and McGuire. The processes share the following variables:
enum pstate idle, wantin, incs;
pstate flag[n];
int turn;
All the elements of flag are initially idle. The initial value of turn is immaterial (between 0 and n-1). The structure of process Pi
is shown below. Prove that the algorithm satisfies all three requirements for the critical-section problem.
$do {
while (true) {
flag[i] = want in;
j = turn;
while (j != i) {
if (flag[j] != idle) {
j = turn;
else
j = (j + 1) % n;
}
flag[i] = in cs;
j = 0;
while ( (j < n) && (j == i || flag[j] != in cs))
j++;
if ( (j >= n) && (turn == i || flag[turn] == idle))
break;
}
/* critical section */
j = (turn + 1) % n;
while (flag[j] == idle)
j = (j + 1) % n;
turn = j;
flag[i] = idle;
/* remainder section */
} while (true);$
galvin operating-system process-synchronization descriptive
9.18.32 Galvin: Galvin Edition 9 Exercise 6 Question 1 (Page No. 305) https://gateoverflow.in/306949
A CPU-scheduling algorithm determines an order for the execution of its scheduled processes. Given n processes to be
scheduled on one processor, how many different schedules are possible? Give a formula in terms of n.
galvin operating-system process-scheduling descriptive
9.18.33 Galvin: Galvin Edition 9 Exercise 6 Question 10 (Page No. 307) https://gateoverflow.in/306961
Why is it important for the scheduler to distinguish I /O − bound programs from CP U − bound programs?
9.18.34 Galvin: Galvin Edition 9 Exercise 6 Question 11 (Page No. 307) https://gateoverflow.in/306962
Discuss how the following pairs of scheduling criteria conflict in certain settings.
a. CP U utilization and response time
b. Average turnaround time and maximum waiting time
c. I /O device utilization and CP U utilization
9.18.35 Galvin: Galvin Edition 9 Exercise 6 Question 12 (Page No. 307) https://gateoverflow.in/306963
One technique for implementing lotteryscheduling works by assigning processes lottery tickets, which are used for
allocating CP U time.Whenever a scheduling decision has to be made, a lottery ticket is chosen at random, and the
process holding that ticket gets the CP U . The BTV operating system implements lottery scheduling by holding a lottery 50
times each second, with each lottery winner getting 20 milliseconds of CP U time (20 milliseconds × 50 = 1 second).
Describe how the BTV scheduler can ensure that higher-priority threads receive more attention from the CP U than lower-
priority threads.
galvin operating-system process-scheduling descriptive
9.18.36 Galvin: Galvin Edition 9 Exercise 6 Question 15 (Page No. 308) https://gateoverflow.in/306965
A variation of the round-robin scheduler is the regressive round − robin scheduler. This scheduler assigns each
process a time quantum and a priority. The initial value of a time quantum is 50 milliseconds. However, every time a
process has been allocated the CP U and uses its entire time quantum (does not block for I /O ), 10 milliseconds is added to its
time quantum, and its priority level is boosted. (The time quantum for a process can be increased to a maximum of 100
milliseconds.) When a process blocks before using its entire time quantum, its time quantum is reduced by 5 milliseconds, but
its priority remains the same. What type of process (CP U − bound or I /Obound ) does the regressive round-robin scheduler
favor ? Explain.
galvin operating-system process-scheduling descriptive
9.18.37 Galvin: Galvin Edition 9 Exercise 6 Question 16 (Page No. 308) https://gateoverflow.in/306966
Consider the following set of processes, with the length of the CPU burst given in milliseconds:
P1 2 2
P2 1 1
P3 8 4
P4 4 2
P5 5 3
The processes are assumed to have arrived in the order P1 , P2 , P3 , P4 , P5 , all at time 0.
a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS ,
SJF , non preemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2).
b. What is the turnaround time of each process for each of the scheduling algorithms in part a ?
c. What is the waiting time of each process for each of these scheduling algorithms ?
d. Which of the algorithms results in the minimum average waiting time (over all processes)?
galvin operating-system process-scheduling descriptive
9.18.38 Galvin: Galvin Edition 9 Exercise 6 Question 18 (Page No. 309) https://gateoverflow.in/306968
The nice command is used to set the nice value of a process on Linux, as well as on other UNIX systems. Explain why
some systems may allow any user to assign a process a nice value >= 0 yet allow only the root user to assign nice
values < 0.
galvin operating-system process-scheduling descriptive
9.18.39 Galvin: Galvin Edition 9 Exercise 6 Question 19 (Page No. 309) https://gateoverflow.in/306969
c. Round robin
d. P riority
galvin operating-system process-scheduling
9.18.40 Galvin: Galvin Edition 9 Exercise 6 Question 2 (Page No. 306) https://gateoverflow.in/306950
9.18.41 Galvin: Galvin Edition 9 Exercise 6 Question 20 (Page No. 309) https://gateoverflow.in/306970
Consider a variant of the RR scheduling algorithm in which the entries in the ready queue are pointers to the P CBs.
a. What would be the effect of putting two pointers to the same process in the ready queue ?
b. What would be two major advantages and two disadvantages of this scheme?
c. How would you modify the basic RR algorithm to achieve the same effect without the duplicate pointers?
galvin operating-system process-scheduling descriptive
9.18.42 Galvin: Galvin Edition 9 Exercise 6 Question 21 (Page No. 309-310) https://gateoverflow.in/306972
Consider a system running ten I /O − bound tasks and one CP U − bound task. Assume that the I /O − bound
tasks issue an I /O operation once for every millisecond of CPU computing and that each I /O operation takes 10
milliseconds to complete. Also assume that the context-switching overhead is 0.1 millisecond and that all processes are long-
running tasks. Describe the CP U utilization for a round-robin scheduler when:
9.18.43 Galvin: Galvin Edition 9 Exercise 6 Question 22 (Page No. 310) https://gateoverflow.in/306973
Consider a system implementing multilevel queue scheduling. What strategy can a computer user employ to maximize
the amount of CP U time allocated to the user’s process ?
galvin operating-system process-scheduling descriptive
9.18.44 Galvin: Galvin Edition 9 Exercise 6 Question 23 (Page No. 310) https://gateoverflow.in/306974
Consider a preemptive priority scheduling algorithm based on dynamically changing priorities. Larger priority numbers
imply higher priority. When a process is waiting for the CP U (in the ready queue, but not running), its priority
changes at a rate β. When it is running, its priority changes at a rate α. All processes are given a priority of 0 when they enter
the ready queue. The parameters β and α can be set to give many different scheduling algorithms.
9.18.45 Galvin: Galvin Edition 9 Exercise 6 Question 24 (Page No. 310) https://gateoverflow.in/306975
Explain the differences in how much the following scheduling algorithms discriminate in favor of short processes:
a. FCFS
b. RR
c. Multilevelfeedbackqueues
galvin operating-system process-scheduling descriptive
9.18.46 Galvin: Galvin Edition 9 Exercise 6 Question 25 (Page No. 310) https://gateoverflow.in/306976
Using the Windows scheduling algorithm, determine the numeric priority of each of the following threads.
a. A thread in the REALTIME _P RIORITY _CLASS with a relative priority of NORMAL
b. A thread in the ABOV E _NORMAL _P RIORITY _CLASS with a relative priority of HIGHEST
c. A thread in the BELOW _NORMAL _P RIORITY _CLASS with a relative priority of ABOV E _NORMAL
galvin operating-system process-scheduling descriptive
9.18.47 Galvin: Galvin Edition 9 Exercise 6 Question 26 (Page No. 310) https://gateoverflow.in/306977
Assuming that no threads belong to the REALTIME _P RIORITY _CLASS and that none may be assigned a
TIME _CRITICAL priority, what combination of priority class and priority corresponds to the highest possible
relative priority in Windows scheduling?
galvin operating-system process-scheduling descriptive
9.18.48 Galvin: Galvin Edition 9 Exercise 6 Question 27 (Page No. 310) https://gateoverflow.in/306978
Consider the scheduling algorithm in the Solaris operating system for time-sharing threads.
a. What is the time quantum (inmilliseconds) for a thread with priority 15? With priority 40?
b. Assume that a thread with priority 50 has used its entire time quantum without blocking. What new priority will the
scheduler assign this thread?
c. Assume that a thread with priority 20 blocks for I /O before its time quantum has expired. What new priority will the
scheduler assign this thread
galvin operating-system process-scheduling descriptive
9.18.49 Galvin: Galvin Edition 9 Exercise 6 Question 28 (Page No. 311) https://gateoverflow.in/306979
Assume that two tasks A and B are running on a Linux system. The nice values of A and B are −5 and +5,
respectively. Using the CFS scheduler as a guide, describe how the respective values of vruntime vary between the
two processes given each of the following scenarios:
• Both A and B are CP U − bound.
• A is I /O − bound , and B is CP U − bound.
• A is CP U − bound, and B is I /O − bound .
9.18.50 Galvin: Galvin Edition 9 Exercise 6 Question 29 (Page No. 311) https://gateoverflow.in/306980
Discuss ways in which the priority inversion problem could be addressed in a real-time system. Also discuss whether
the solutions could be implemented within the context of a proportional share scheduler
operating-system galvin process-scheduling descriptive
9.18.51 Galvin: Galvin Edition 9 Exercise 6 Question 3 (Page No. 306) https://gateoverflow.in/306952
Suppose that the following processes arrive for execution at the times indicated. Each process will run for the amount of
time listed. In answering the questions, use non preemptive scheduling, and base all decisions on the information you
have at the time the decision must be made.
P1 0.0 8
P2 0.4 4
P3 1.0 1
a. What is the average turnaround time for these processes with the FCFS scheduling algorithm ?
b. What is the average turnaround time for these processes with the SJF scheduling algorithm ?
c. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at time 0 because we
did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is
left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 are waiting during this idle
time, so their waiting time may increase. This algorithm could be called future-knowledge scheduling.
galvin operating-system process-scheduling descriptive
9.18.52 Galvin: Galvin Edition 9 Exercise 6 Question 30 (Page No. 311) https://gateoverflow.in/306981
9.18.53 Galvin: Galvin Edition 9 Exercise 6 Question 32 (Page No. 311) https://gateoverflow.in/306982
Explain why interrupt and dispatch latency times must be bounded in a hard real-time system ?
galvin operating-system process-scheduling descriptive
9.18.54 Galvin: Galvin Edition 9 Exercise 6 Question 4 (Page No. 306) https://gateoverflow.in/306953
What advantage is there in having different time-quantum sizes at different levels of a multilevel queueing system ?
galvin operating-system process-scheduling descriptive
9.18.55 Galvin: Galvin Edition 9 Exercise 6 Question 5 (Page No. 306) https://gateoverflow.in/306955
Many CPU-scheduling algorithms are parametrized. For example, the RR algorithm requires a parameter to indicate
the time slice. Multilevel feedback queues require parameters to define the number of queues, the scheduling algorithm
for each queue, the criteria used to move processes between queues, and so on. These algorithms are thus really sets of
algorithms (for example, the set of RR algorithms for all time slices, and so on). One set of algorithms may include another
(for example, the FCFS algorithm is the RR algorithm with an infinite time quantum). What (if any) relation holds between
the following pairs of algorithm sets ?
9.18.56 Galvin: Galvin Edition 9 Exercise 6 Question 6 (Page No. 306-307) https://gateoverflow.in/306956
Suppose that a scheduling algorithm (at the level of short-term CP U scheduling) favors those processes that have used
the least processor time in the recent past. Why will this algorithm favor I /O − bound programs and yet not
permanently starve CP U − bound programs ?
galvin operating-system process-scheduling descriptive
9.18.57 Galvin: Galvin Edition 9 Exercise 6 Question 7 (Page No. 307) https://gateoverflow.in/306957
Distinguish between P CS(Process Contention Scope) and SCS (Source Contention Scope) scheduling.
galvin operating-system process-scheduling descriptive
9.18.58 Galvin: Galvin Edition 9 Exercise 6 Question 8 (Page No. 307) https://gateoverflow.in/306958
Assume that an operating system maps user-level threads to the kernel using the many-to-many model and that the
mapping is done through the use of LWP (Light Weight Processes). Furthermore, the system allows program
developers to create real-time threads. Is it necessary to bind a real-time thread to an LWP?
galvin operating-system process-scheduling descriptive
9.18.59 Galvin: Galvin Edition 9 Exercise 6 Question 9 (Page No. 307) https://gateoverflow.in/306959
The traditional UNIX scheduler enforces an inverse relationship between priority numbers and priorities: the higher
the number, the lower the priority. The scheduler recalculates process priorities once per second using the following
function:
Priority = (recent CP U usage / 2) + base
where base = 60 and recent CP U usage refers to a value indicating how often a process has used the CP U since priorities
were last recalculated.
Assume that recent CP U usage is 40 for process P1 , 18 for process P2 , and 10 for process P3 . What will be the new priorities
for these three processes when priorities are recalculated? Based on this information, does the traditional UNIX scheduler raise
or lower the relative priority of a CP U − bound process?
galvin operating-system process-scheduling descriptive
9.18.60 Galvin: Galvin Edition 9 Exercise 8 Question 1 (Page No. 390) https://gateoverflow.in/307030
9.18.61 Galvin: Galvin Edition 9 Exercise 8 Question 10 (Page No. 391) https://gateoverflow.in/307042
Consider the following process for generating binaries. A compiler is used to generate the object code for individual
modules, and a linkage editor is used to combine multiple object modules into a single program binary. How does the
linkage editor change the binding of instructions and data to memory addresses ? What information needs to be passed from
the compiler to the linkage editor to facilitate the memory-binding tasks of the linkage editor ?
galvin operating-system memory-management descriptive
9.18.62 Galvin: Galvin Edition 9 Exercise 8 Question 11 (Page No. 391) https://gateoverflow.in/307043
Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750KB and 125KB (in order), how would
the first − fit, best − fit, and worst − fit algorithms place processes of size 115 KB, 500 KB, 358KB, 200
KB, and 375 KB (in order) ? Rank the algorithms in terms of how efficiently they use memory.
galvin operating-system memory-management
9.18.63 Galvin: Galvin Edition 9 Exercise 8 Question 12 (Page No. 391) https://gateoverflow.in/307044
Most systems allow a program to allocate more memory to its address space during execution. Allocation of data in the
heap segments of programs is an example of such allocated memory. What is required to support dynamic memory
allocation in the following schemes ?
9.18.64 Galvin: Galvin Edition 9 Exercise 8 Question 13 (Page No. 391) https://gateoverflow.in/307046
Compare the memory organization schemes of contiguous memory allocation, pure segmentation, and pure paging with
respect to the following issues:
a. External fragmentation
b. Internal fragmentation
c. Ability to share code across processes
galvin operating-system memory-management
9.18.65 Galvin: Galvin Edition 9 Exercise 8 Question 14 (Page No. 391) https://gateoverflow.in/307047
On a system with paging, a process cannot access memory that it does not own. Why ? How could the operating system
allow access to other memory ? Why should it or should it not ?
galvin operating-system memory-management descriptive
9.18.66 Galvin: Galvin Edition 9 Exercise 8 Question 15 (Page No. 392) https://gateoverflow.in/307048
Explain why mobile operating systems such as iOS and Android do not support swapping ?
galvin operating-system memory-management descriptive
9.18.67 Galvin: Galvin Edition 9 Exercise 8 Question 16 (Page No. 392) https://gateoverflow.in/307049
Although Android does not support swapping on its boot disk, it is possible to set up a swap space using a separate SD
nonvolatile memory card. Why would Android disallow swapping on its boot disk yet allow it on a secondary disk ?
galvin operating-system memory-management descriptive
9.18.68 Galvin: Galvin Edition 9 Exercise 8 Question 17 (Page No. 392) https://gateoverflow.in/307050
Compare paging with segmentation with respect to how much memory the address translation structures require to
convert virtual addresses to physical addresses.
galvin operating-system memory-management descriptive
9.18.69 Galvin: Galvin Edition 9 Exercise 8 Question 18 (Page No. 392) https://gateoverflow.in/307051
9.18.70 Galvin: Galvin Edition 9 Exercise 8 Question 19 (Page No. 392) https://gateoverflow.in/307052
Program binaries in many systems are typically structured as follows. Code is stored starting with a small, fixed virtual
address, such as 0. The code segment is followed by the data segment that is used for storing the program variables.
When the program starts executing, the stack is allocated at the other end of the virtual address space and is allowed to grow
toward lower virtual addresses. What is the significance of this structure for the following schemes ?
Consider a system in which a program can be separated into two parts: code and data. The CP U knows whether it
wants an instruction (instruction fetch) or data (data fetch or store). Therefore, two base–limit register pairs are
provided: one for instructions and one for data.The instruction base–limit register pair is automatically read-only, so programs
can be shared among different users. Discuss the advantages and disadvantages of this scheme.
galvin operating-system memory-management descriptive
9.18.72 Galvin: Galvin Edition 9 Exercise 8 Question 20 (Page No. 392) https://gateoverflow.in/307053
Assuming a 1 KB page size, what are the page numbers and offsets for the following address references (provided as
decimal numbers):
a. 3085
b. 42095
c. 215201
d. 650000
e. 2000001
galvin operating-system memory-management
9.18.73 Galvin: Galvin Edition 9 Exercise 8 Question 21 (Page No. 392) https://gateoverflow.in/307054
The BTV operating system has a 21 − bit virtual address, yet on certain embedded devices, it has only a 16 − bit
physical address. It also has a 2 − KB page size. How many entries are there in each of the following ?
9.18.74 Galvin: Galvin Edition 9 Exercise 8 Question 22 (Page No. 392) https://gateoverflow.in/307055
9.18.75 Galvin: Galvin Edition 9 Exercise 8 Question 23 (Page No. 392) https://gateoverflow.in/307056
Consider a logical address space of 256 pages with a 4 − KB page size, mapped onto a physical memory of 64
frames.
9.18.76 Galvin: Galvin Edition 9 Exercise 8 Question 25 (Page No. 393) https://gateoverflow.in/307057
a. If a memory reference takes 50 nanoseconds, how long does a paged memory reference take ?
b. If we add TLBs, and 75 percent of all page-table references are found in the TLBs, what is the effective memory reference
time ? (Assume that finding a page-table entry in the TLBs takes 2 nanoseconds, if the entry is present.)
galvin operating-system memory-management
9.18.77 Galvin: Galvin Edition 9 Exercise 8 Question 26 (Page No. 393) https://gateoverflow.in/307058
Why are segmentation and paging sometimes combined into one scheme ?
galvin operating-system memory-management descriptive
9.18.78 Galvin: Galvin Edition 9 Exercise 8 Question 27 (Page No. 393) https://gateoverflow.in/307059
Explain why sharing a reentrant module is easier when segmentation is used than when pure paging is used.
galvin operating-system memory-management descriptive
9.18.79 Galvin: Galvin Edition 9 Exercise 8 Question 28 (Page No. 393) https://gateoverflow.in/307061
0 219 600
1 2300 14
2 90 100
3 1327 580
4 1952 96
What are the physical addresses for the following logical addresses ?
a. 0, 430
b. 1, 10
c. 2, 500
d. 3, 400
e. 4, 112
galvin operating-system memory-management
9.18.80 Galvin: Galvin Edition 9 Exercise 8 Question 29 (Page No. 393) https://gateoverflow.in/307063
9.18.81 Galvin: Galvin Edition 9 Exercise 8 Question 3 (Page No. 390) https://gateoverflow.in/307032
9.18.82 Galvin: Galvin Edition 9 Exercise 8 Question 30 (Page No. 393) https://gateoverflow.in/307064
Consider the hierarchical paging scheme used by the V AX architecture. How many memory operations are performed
when a user program executes a memory-load operation ?
galvin operating-system memory-management
9.18.83 Galvin: Galvin Edition 9 Exercise 8 Question 31 (Page No. 393) https://gateoverflow.in/307065
Compare the segmented paging scheme with the hashed page table scheme for handling large address spaces. Under
what circumstances is one scheme preferable to the other ?
galvin operating-system memory-management descriptive
9.18.84 Galvin: Galvin Edition 9 Exercise 8 Question 32 (Page No. 393-394) https://gateoverflow.in/307066
a. Describe all the steps taken by the Intel Pentium in translating a logical address into a physical address.
b. What are the advantages to the operating system of hardware that provides such complicated memory translation ?
c. Are there any disadvantages to this address-translation system? If so, what are they? If not, why is this scheme not used by
every manufacturer ?
galvin operating-system memory-management
9.18.85 Galvin: Galvin Edition 9 Exercise 8 Question 4 (Page No. 390) https://gateoverflow.in/307033
Consider a logical address space of 64 pages of 1, 024 words each, mapped onto a physical memory of 32 frames.
a. How many bits are there in the logical address ?
b. How many bits are there in the physical address ?
galvin operating-system memory-management
9.18.86 Galvin: Galvin Edition 9 Exercise 8 Question 5 (Page No. 390) https://gateoverflow.in/307034
What is the effect of allowing two entries in a page table to point to the same page frame in memory? Explain how this
effect could be used to decrease the amount of time needed to copy a large amount of memory from one place to
another. What effect would updating some byte on the one page have on the other page ?
galvin operating-system memory-management descriptive
9.18.87 Galvin: Galvin Edition 9 Exercise 8 Question 6 (Page No. 390) https://gateoverflow.in/307035
Describe a mechanism by which one segment could belong to the address space of two different processes.
galvin operating-system memory-management descriptive
9.18.88 Galvin: Galvin Edition 9 Exercise 8 Question 7 (Page No. 390) https://gateoverflow.in/307036
Sharing segments among processes without requiring that they have the same segment number is possible in a
dynamically linked segmentation system.
a. Define a system that allows static linking and sharing of segments without requiring that the segment numbers be the same.
b. Describe a paging scheme that allows pages to be shared without requiring that the page numbers be the same.
galvin operating-system memory-management descriptive
9.18.89 Galvin: Galvin Edition 9 Exercise 8 Question 8 (Page No. 390-391) https://gateoverflow.in/307040
In the IBM/370, memory protection is provided through the use of keys. A key is a 4-bit quantity. Each 2-K block of
memory has a key (the storage key) associated with it. The CPU also has a key (the protection key) associated with it.
A store operation is allowed only if both keys are equal or if either is 0. Which of the following memory-management schemes
could be used successfully with this hardware?
a. Bare machine
b. Single-user system
c. Multiprogramming with a fixed number of processes
d. Multiprogramming with a variable number of processes
e. Paging
f .Segmentation
galvin operating-system memory-management descriptive
9.18.90 Galvin: Galvin Edition 9 Exercise 8 Question 9 (Page No. 391) https://gateoverflow.in/307041
9.20.1 I Node: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 16 (Page No. 334)
https://gateoverflow.in/324729
Consider the i-node shown in Fig. 4 − 13. If it contains 10 direct addresses and these were 8
bytes each and all disk blocks were 1024 KB, what would the largest possible file be?
9.21.1 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 1 (Page No. 429)
https://gateoverflow.in/324815
Advances in chip technology have made it possible to put an entire controller, including all the
bus access logic, on an inexpensive chip. How does that affect the model of Fig. 1 − 6?
tanenbaum operating-system input-output descriptive
9.21.2 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 10 (Page No. 430)
https://gateoverflow.in/324825
In Fig. 5-9(b), the interrupt is not acknowledged until after the next character has been output to
the printer. Could it have equally well been acknowledged right at the start of the interrupt service procedure? If so,
give one reason for doing it at the end, as in the text. If not, why not?
9.21.3 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 13 (Page No. 430)
https://gateoverflow.in/324828
Explain how an OS can facilitate installation of a new device without any need for recompiling
the OS.
tanenbaum operating-system input-output descriptive
9.21.4 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 14 (Page No. 430)
https://gateoverflow.in/324829
In which of the four I/O software layers is each of the following done.
9.21.6 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 16 (Page No. 431)
https://gateoverflow.in/324831
Why are output files for the printer normally spooled on disk before being printed?
tanenbaum operating-system input-output disks descriptive
9.21.7 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 17 (Page No. 431)
https://gateoverflow.in/324832
How much cylinder skew is needed for a 7200-RPM disk with a track-to-track seek time of
1 msec? The disk has 200 sectors of 512 bytes each on each track.
tanenbaum operating-system input-output disks descriptive
9.21.8 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 18 (Page No. 431)
https://gateoverflow.in/324834
A disk rotates at 7200 RPM. It has 500 sectors of 512 bytes around the outer cylinder. How
long does it take to read a sector?
tanenbaum operating-system input-output disks descriptive
9.21.9 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 19 (Page No. 431)
https://gateoverflow.in/324835
Calculate the maximum data rate in bytes/sec for the disk described in the previous problem.
tanenbaum operating-system input-output disks descriptive
9.21.10 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 2 (Page No. 429)
https://gateoverflow.in/324816
Given the speeds listed in Fig. 5 − 1, is it possible to scan documents from a scanner and
transmit them over an 802.11g network at full speed? Defend your answer.
tanenbaum operating-system input-output descriptive
9.21.11 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 20 (Page No. 431)
https://gateoverflow.in/324836
RAID level 3 is able to correct single-bit errors using only one parity drive. What is the point of
RAID level 2? After all, it also can only correct one error and takes more drives to do so.
tanenbaum operating-system input-output disks descriptive
9.21.12 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 21 (Page No. 431)
https://gateoverflow.in/324837
A RAID can fail if two or more of its drives crash within a short time interval. Suppose that the
probability of one drive crashing in a given hour is p. What is the probability of a k-drive RAID failing in a given
hour?
tanenbaum operating-system input-output disks descriptive
9.21.13 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 22 (Page No. 431)
https://gateoverflow.in/324838
Compare RAID level 0 through 5 with respect to read performance, write performance, space
overhead, and reliability.
tanenbaum operating-system input-output disks descriptive
9.21.14 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 23 (Page No. 431)
https://gateoverflow.in/324839
How many pebibytes are there in a zebibyte?
tanenbaum operating-system input-output easy descriptive
9.21.15 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 24 (Page No. 431)
https://gateoverflow.in/324840
Why are optical storage devices inherently capable of higher data density than magnetic storage
devices? Note: This problem requires some knowledge of high-school physics and how magnetic fields are generated.
tanenbaum operating-system input-output disks descriptive
9.21.16 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 25 (Page No. 431)
https://gateoverflow.in/324841
What are the advantages and disadvantages of optical disks versus magnetic disks?
tanenbaum operating-system input-output disks descriptive
9.21.17 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 27 (Page No. 431)
https://gateoverflow.in/324843
If a disk has double interleaving, does it also need cylinder skew in order to avoid missing data
when making a track-to-track seek? Discuss your answer.
tanenbaum operating-system input-output disks descriptive
9.21.18 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 30 (Page No. 432)
https://gateoverflow.in/324846
A computer manufacturer decides to redesign the partition table of a Pentium hard disk to
provide more than four partitions. What are some consequences of this change?
tanenbaum operating-system input-output disks descriptive
9.21.19 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 31 (Page No. 432)
https://gateoverflow.in/324847
Disk requests come in to the disk driver for cylinders 10, 22, 20, 2, 40, 6, and 38, in that order.
A seek takes 6 msec per cylinder. How much seek time is needed for
9.21.20 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 32 (Page No. 432)
https://gateoverflow.in/324848
A slight modification of the elevator algorithm for scheduling disk requests is to always scan in
the same direction. In what respect is this modified algorithm better than the elevator algorithm?
tanenbaum operating-system input-output disk-scheduling descriptive
9.21.21 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 33 (Page No. 432)
https://gateoverflow.in/324849
A personal computer salesman visiting a university in South-West Amsterdam remarked during
his sales pitch that his company had devoted substantial effort to making their version of UNIX very fast. As an
example, he noted that their disk driver used the elevator algorithm and also queued multiple requests within a cylinder in
sector order. A student, Harry Hacker, was impressed and bought one. He took it home and wrote a program to randomly read
10, 000 blocks spread across the disk. To his amazement, the performance that he measured was identical to what would be
expected from first-come, first-served. Was the salesman lying?
tanenbaum operating-system input-output unix disks descriptive
9.21.22 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 34 (Page No. 432)
https://gateoverflow.in/324850
In the discussion of stable storage using nonvolatile RAM, the following point was glossed over.
What happens if the stable write completes but a crash occurs before the operating system can write an invalid block
number in the nonvolatile RAM? Does this race condition ruin the abstraction of stable storage? Explain your answer.
tanenbaum operating-system input-output disks descriptive
9.21.23 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 35 (Page No. 432)
https://gateoverflow.in/324851
In the discussion on stable storage, it was shown that the disk can be recovered to a consistent
state (a write either completes or does not take place at all) if a CPU crash occurs during a write. Does this property
hold if the CPU crashes again during a recovery procedure. Explain your answer.
tanenbaum operating-system input-output disks descriptive
9.21.24 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 36 (Page No. 432)
https://gateoverflow.in/324852
In the discussion on stable storage, a key assumption is that a CPU crash that corrupts a sector
leads to an incorrect ECC. What problems might arise in the five crash-recovery scenarios shown in Figure 5-27 if this
assumption does not hold?
9.21.25 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 37 (Page No. 432)
https://gateoverflow.in/324853
The clock interrupt handler on a certain computer requires 2 msec (including process switching
overhead) per clock tick. The clock runs at 60 Hz. What fraction of the CPU is devoted to the clock?
tanenbaum operating-system input-output interrupts descriptive
9.21.26 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 38 (Page No. 432)
https://gateoverflow.in/324854
A computer uses a programmable clock in square-wave mode. If a 500 MHz crystal is used,
what should be the value of the holding register to achieve a clock resolution of
9.21.27 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 39 (Page No. 433)
https://gateoverflow.in/324855
A system simulates multiple clocks by chaining all pending clock requests together as shown in
Fig. 5-30. Suppose the current time is 5000 and there are pending clock requests for time 5008, 5012, 5015, 5029, 4
and 5037. Show the values of Clock header, Current time, and Next signal at times 5000, 5005, and 5013. Suppose a new
(pending) signal arrives at time 5017 for 5033. Show the values of Clock header, Current time and Next signal at time 5023.
9.21.28 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 4 (Page No. 429)
https://gateoverflow.in/324818
Explain the tradeoffs between precise and imprecise interrupts on a superscalar machine.
tanenbaum operating-system input-output interrupts descriptive
9.21.29 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 40 (Page No. 433)
https://gateoverflow.in/324856
Many versions of UNIX use an unsigned 32-bit integer to keep track of the time as the number
of seconds since the origin of time. When will these systems wrap around (year and month)? Do you expect this to
actually happen?
tanenbaum operating-system input-output disks unix descriptive
9.21.30 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 41 (Page No. 433)
https://gateoverflow.in/324858
A bitmap terminal contains 1600 by 1200 pixels. To scroll a window, the CPU (or controller)
must move all the lines of text upward by copying their bits from one part of the video RAM to another. If a particular
window is 80 lines high by 80 characters wide (6400 characters, total ), and a character’s box is 8 pixels wide by 16 pixels
high, how long does it take to scroll the whole window at a copying rate of 50 nsec per byte? If all lines are 80 characters
long, what is the equivalent baud rate of the terminal? Putting a character on the screen takes 5 μsec. How many lines per
second can be displayed?
tanenbaum operating-system input-output disks descriptive
9.21.31 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 42 (Page No. 433)
https://gateoverflow.in/324859
After receiving a DEL (SIGINT) character, the display driver discards all output currently
queued for that display. Why?
tanenbaum operating-system input-output descriptive
9.21.32 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 43 (Page No. 433)
https://gateoverflow.in/324860
A user at a terminal issues a command to an editor to delete the word on line 5 occupying
character positions 7 through and including 12. Assuming the cursor is not on line 5 when the command is given, what
ANSI escape sequence should the editor emit to delete the word?
tanenbaum operating-system input-output descriptive
9.21.33 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 44 (Page No. 433)
https://gateoverflow.in/324862
The designers of a computer system expected that the mouse could be moved at a maximum rate
o f 20 cm/sec. If a mickey is 0.1 mm and each mouse message is 3 bytes, what is the maximum data rate of the
mouse assuming that each mickey is reported separately?
tanenbaum operating-system input-output descriptive
9.21.34 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 45 (Page No. 433)
https://gateoverflow.in/324863
The primary additive colors are red, green, and blue, which means that any color can be
constructed from a linear superposition of these colors. Is it possible that someone could have a color photograph that
cannot be represented using full 24-bit color?
tanenbaum operating-system input-output descriptive
9.21.35 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 46 (Page No. 433)
https://gateoverflow.in/324864
One way to place a character on a bitmapped screen is to use BitBlt from a font table. Assume
that a particular font uses characters that are 16 × 24 pixels in true RGB color.
9.21.36 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 48 (Page No. 433)
https://gateoverflow.in/324866
In Fig. 5-36 there is a class to RegisterClass. In the corresponding X Window code, in Fig. 5-
34, there is no such call or anything like it. Why not?
tanenbaum operating-system input-output descriptive
9.21.37 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 49 (Page No. 433 - 434)
https://gateoverflow.in/324867
In the text we gave an example of how to draw a rectangle on the screen using the Windows
GDI:
Is there any real need for the first parameter (hdc), and if so, what? After all, the coordinates of the rectangle are explicitly
specified as parameters.
9.21.38 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 5 (Page No. 429)
https://gateoverflow.in/324819
A DMA controller has five channels. The controller is capable of requesting a 32-bit word every
40 nsec. A response takes equally long. How fast does the bus have to be to avoid being a bottleneck?
tanenbaum operating-system input-output dma descriptive
9.21.39 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 50 (Page No. 434)
https://gateoverflow.in/324868
A thin-client terminal is used to display a Web page containing an animated cartoon of size
400 pixels × 160 pixels running at 10 frames/sec. What fraction of a 100-Mbps Fast Ethernet is consumed by
displaying the cartoon?
tanenbaum operating-system input-output descriptive
9.21.40 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 51 (Page No. 434)
https://gateoverflow.in/324869
It has been observed that a thin-client system works well with a 1-Mbps network in a test. Are
any problems likely in a multiuser situation? (Hint: Consider a large number of users watching a scheduled TV show
and the same number of users browsing the World Wide Web.)
tanenbaum operating-system input-output descriptive
9.21.41 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 52 (Page No. 434)
https://gateoverflow.in/324870
Describe two advantages and two disadvantages of thin client computing?
tanenbaum operating-system input-output descriptive
9.21.42 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 53 (Page No. 434)
https://gateoverflow.in/324871
If a CPU’s maximum voltage, V , is cut to V /n, its power consumption drops to 1/n2 of its
original value and its clock speed drops to 1/n of its original value. Suppose that a user is typing at 1 char/sec, but
the CPU time required to process each character is 100 msec. What is the optimal value of n and what is the corresponding
energy saving in percent compared to not cutting the voltage? Assume that an idle CPU consumes no energy at all.
tanenbaum operating-system input-output descriptive
9.21.43 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 54 (Page No. 434)
https://gateoverflow.in/324872
A notebook computer is set up to take maximum advantage of power saving features including
shutting down the display and the hard disk after periods of inactivity. A user sometimes runs UNIX programs in text
mode, and at other times uses the X Window System. She is surprised to find that battery life is significantly better when she
uses text-only programs. Why?
tanenbaum operating-system input-output unix descriptive
9.21.44 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 55 (Page No. 434)
https://gateoverflow.in/324873
Write a program that simulates stable storage. Use two large fixed-length files on your disk to
simulate the two disks.
tanenbaum operating-system input-output descriptive
9.21.45 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 56 (Page No. 434)
https://gateoverflow.in/324874
Write a program to implement the three disk-arm scheduling algorithms. Write a driver program
that generates a sequence of cylinder numbers (0– 999) at random, runs the three algorithms for this sequence and
prints out the total distance (number of cylinders) the arm needs to traverse in the three algorithms.
tanenbaum operating-system input-output disk-scheduling descriptive
9.21.46 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 57 (Page No. 434)
https://gateoverflow.in/324875
Write a program to implement multiple timers using a single clock. Input for this program
consists of a sequence of four types of commands (S < int >, T < int >, E < int >, P < int >) : S < int >
sets the current time to < int >; T is a clock tick; and E < int > schedules a signal to occur at time < int >; P prints out
the values of Current time, Next signal, and Clock header. Your program should also print out a statement whenever it is time
to raise a signal.
tanenbaum operating-system input-output descriptive
9.21.47 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 6 (Page No. 429 - 430)
https://gateoverflow.in/324821
Suppose that a system uses DMA for data transfer from disk controller to main memory. Further
assume that it takes t1 nsec on average to acquire the bus and t2 nsec to transfer one word over the bus (t1 >> t2 ).
After the CPU has programmed the DMA controller, how long will it take to transfer 1000 words from the disk controller to
main memory, if
Assume that commanding the disk controller requires acquiring the bus to send one word and acknowledging a transfer also
requires acquiring the bus to send one word.
9.21.48 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 7 (Page No. 430)
https://gateoverflow.in/324822
One mode that some DMA controllers use is to have the device controller send the word to the
DMA controller, which then issues a second bus request to write to memory. How can this mode be used to perform
memory to memory copy? Discuss any advantage or disadvantage of using this method instead of using the CPU to perform
memory to memory copy.
tanenbaum operating-system input-output dma descriptive
9.21.49 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 8 (Page No. 430)
https://gateoverflow.in/324823
Suppose that a computer can read or write a memory word in 5nsec. Also suppose that when an
interrupt occurs, all 32 CPU registers, plus the program counter and PSW are pushed onto the stack. What is the
maximum number of interrupts per second this machine can process?
tanenbaum operating-system input-output interrupts descriptive
9.21.50 Input Output: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 9 (Page No. 430)
https://gateoverflow.in/324824
CPU architects know that operating system writers hate imprecise interrupts. One way to please
the OS folks is for the CPU to stop issuing new instructions when an interrupt is signaled, but allow all the instructions
currently being executed to finish, then force the interrupt. Does this approach have any disadvantages? Explain your answer.
tanenbaum operating-system input-output interrupts descriptive
9.22.1 Instruction Format: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 6 (Page No. 81)
https://gateoverflow.in/324329
Instructions related to accessing I/O devices are typically privileged instructions, that is, they can
be executed in kernel mode but not in user mode. Give a reason why these instructions are privileged.
tanenbaum operating-system introduction instruction-format descriptive
9.23.1 Interrupt Driven: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 12 (Page No. 430)
https://gateoverflow.in/324827
A typical printed page of text contains 50 lines of 80 characters each. Imagine that a certain
printer can print 6 pages per minute and that the time to write a character to the printer’s output register is so short it
can be ignored. Does it make sense to run this printer using interrupt-driven I/O if each character printed requires an interrupt
that takes 50 μsec all-in to service?
9.24.1 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 1 (Page No. 81)
https://gateoverflow.in/310019
What are the two main functions of an operating system?
tanenbaum operating-system introduction descriptive
9.24.2 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 11 (Page No. 81)
https://gateoverflow.in/324334
A 255-GB disk has 65, 536 cylinders with 255 sectors per track and 512 bytes per sector. How
many platters and heads does this disk have? Assuming an average cylinder seek time of 11 ms, average rotational
delay of 7 msec and reading rate of 100 MB/sec, calculate the average time it will take to read 400 KB from one sector.
tanenbaum operating-system introduction descriptive
9.24.3 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 19 (Page No. 82)
https://gateoverflow.in/324342
Is there any reason why you might want to mount a file system on a nonempty directory? If so,
what is it?
tanenbaum operating-system introduction file-system descriptive
9.24.4 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 2 (Page No. 81)
https://gateoverflow.in/324120
In Section 1.4, nine different types of operating systems are described. Give a list of applications
for each of these systems (one per operating systems type).
tanenbaum operating-system introduction descriptive
9.24.5 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 22 (Page No. 82)
https://gateoverflow.in/324345
Can the
call return any value in count other than nbytes? If so, why?
tanenbaum operating-system introduction descriptive
9.24.6 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 24 (Page No. 83)
https://gateoverflow.in/324347
Suppose that a 10-MB file is stored on a disk on the same track (track 50) in consecutive
sectors. The disk arm is currently situated over track number 100. How long will it take to retrieve this file from the
disk? Assume that it takes about 1 ms to move the arm from one cylinder to the next and about 5 ms for the sector where the
beginning of the file is stored to rotate under the head. Also, assume that reading occurs at a rate of 200 MB/s.
tanenbaum operating-system introduction disks descriptive
9.24.7 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 25 (Page No. 83)
https://gateoverflow.in/324349
What is the essential difference between a block special file and a character special file?
tanenbaum operating-system introduction descriptive
9.24.8 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 26 (Page No. 83)
https://gateoverflow.in/324350
In the example given in Fig. 1 − 17, the library procedure is called read and the system call
itself is called read. Is it essential that both of these have the same name? If not, which one is more important?
tanenbaum operating-system introduction descriptive
9.24.9 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 27 (Page No. 83)
https://gateoverflow.in/324351
Modern operating systems decouple a process address space from the machine’s physical
memory. List two advantages of this design.
tanenbaum operating-system introduction memory-management descriptive
9.24.10 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 3 (Page No. 81)
https://gateoverflow.in/324121
What is the difference between timesharing and multiprogramming systems?
tanenbaum operating-system introduction descriptive
9.24.11 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 30 (Page No. 83)
https://gateoverflow.in/324354
A portable operating system is one that can be ported from one system architecture to another
without any modification. Explain why it is infeasible to build an operating system that is completely portable.
Describe two high-level layers that you will have in designing an operating system that is highly portable.
tanenbaum operating-system introduction descriptive
9.24.12 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 31 (Page No. 83)
https://gateoverflow.in/324355
Explain how separation of policy and mechanism aids in building microkernel-based operating
systems.
tanenbaum operating-system introduction descriptive
9.24.13 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 33 (Page No. 83)
https://gateoverflow.in/324357
Here are some questions for practicing unit conversions:
9.24.14 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 34 (Page No. 83)
https://gateoverflow.in/324358
Write a shell that is similar to Fig. 1 − 19 but contains enough code that it actually works so
you can test it. You might also add some features such as redirection of input and output, pipes, and background jobs.
9.24.15 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 4 (Page No. 81)
https://gateoverflow.in/324122
To use cache memory, main memory is divided into cache lines, typically 32 or 64 bytes long.
An entire cache line is cached at once. What is the advantage of caching an entire line instead of a single byte or word
at a time?
tanenbaum operating-system introduction cache-memory descriptive
9.24.16 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 7 (Page No. 81)
https://gateoverflow.in/324330
The family-of-computers idea was introduced in the 1960s with the IBM System /360
mainframes. Is this idea now dead as a doornail or does it live on?
tanenbaum operating-system introduction descriptive
9.24.17 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 8 (Page No. 81)
https://gateoverflow.in/324331
One reason GUIs were initially slow to be adopted was the cost of the hardware needed to
support them. How much video RAM is needed to support a 25 − line × 80 − row character monochrome text
screen? How much for a 1200 × 900− pixel 24 − bit color bitmap? What was the cost of this RAM at 1980 prices
($5/KB)? How much is it now?
tanenbaum operating-system introduction descriptive
9.24.18 Introduction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 9 (Page No. 81)
https://gateoverflow.in/324332
There are several design goals in building an operating system, for example, resource utilization,
timeliness, robustness, and so on. Give an example of two design goals that may contradict one another.
tanenbaum operating-system introduction descriptive
9.24.19 Introduction: Galvin Edition 9 Exercise 1 Question 1 (Page No. 49) https://gateoverflow.in/306621
9.24.20 Introduction: Galvin Edition 9 Exercise 1 Question 10 (Page No. 50) https://gateoverflow.in/306641
Give two reasons why caches are useful. What problems do they solve ? What problems do they cause ? If a cache can
be made as large as the device for which it is caching (for instance, a cache as large as a disk), why not make it that
large and eliminate the device ?
galvin operating-system introduction descriptive
9.24.21 Introduction: Galvin Edition 9 Exercise 1 Question 11 (Page No. 50) https://gateoverflow.in/306643
9.24.22 Introduction: Galvin Edition 9 Exercise 1 Question 12 (Page No. 50) https://gateoverflow.in/306646
In a multiprogramming and time-sharing environment, several users share the system simultaneously. This situation
can result in various security problems.
a. What are two such problems ?
b. Can we ensure the same degree of security in a time-shared machine as in a dedicated machine ? Explain your answer.
galvin operating-system introduction descriptive
9.24.23 Introduction: Galvin Edition 9 Exercise 1 Question 13 (Page No. 50) https://gateoverflow.in/306648
The issue of resource utilization shows up in different forms in different types of operating systems. List what resources
must be managed carefully in the following settings:
a. Mainframe or minicomputer systems
b. Workstations connected to servers
c. Mobile computers
galvin operating-system introduction descriptive
9.24.24 Introduction: Galvin Edition 9 Exercise 1 Question 14 (Page No. 51) https://gateoverflow.in/306649
Under what circumstances would a user be better off using a timesharing system than a PC or a single-user workstation
?
galvin operating-system introduction descriptive
9.24.25 Introduction: Galvin Edition 9 Exercise 1 Question 15 (Page No. 51) https://gateoverflow.in/306650
Describe the differences between symmetric and asymmetric multiprocessing. What are three advantages and one
disadvantage of multiprocessor systems ?
galvin operating-system introduction descriptive
9.24.26 Introduction: Galvin Edition 9 Exercise 1 Question 16 (Page No. 51) https://gateoverflow.in/306651
How do clustered systems differ from multiprocessor systems ? What is required for two machines belonging to a
cluster to cooperate to provide a highly available service ?
galvin operating-system introduction descriptive
9.24.27 Introduction: Galvin Edition 9 Exercise 1 Question 17 (Page No. 51) https://gateoverflow.in/306652
Consider a computing cluster consisting of two nodes running a database. Describe two ways in which the cluster
software can manage access to the data on the disk. Discuss the benefits and disadvantages of each.
galvin operating-system introduction descriptive
9.24.28 Introduction: Galvin Edition 9 Exercise 1 Question 18 (Page No. 51) https://gateoverflow.in/306653
How are network computers different from traditional personal computers ? Describe some usage scenarios in which it
is advantageous to use network computers.
galvin operating-system introduction descriptive
9.24.29 Introduction: Galvin Edition 9 Exercise 1 Question 19 (Page No. 51) https://gateoverflow.in/306655
What is the purpose of interrupts ? How does an interrupt differ from a trap ? Can traps be generated intentionally by a
user program ? If so, for what purpose ?
galvin operating-system introduction descriptive
9.24.30 Introduction: Galvin Edition 9 Exercise 1 Question 2 (Page No. 49) https://gateoverflow.in/306623
We have stressed the need for an operating system to make efficient use of the computing hardware. When is it
appropriate for the operating system to forsake this principle and to “waste” resources ? Why is such a system not
really wasteful ?
galvin operating-system introduction descriptive
9.24.31 Introduction: Galvin Edition 9 Exercise 1 Question 20 (Page No. 51) https://gateoverflow.in/306656
Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU’s execution load.
a. How does the CPU interface with the device to coordinate the transfer ?
b. How does the CPU know when the memory operations are complete ?
c. The CPU is allowed to execute other programs while the DMA controller is transferring data. Does this process interfere
with the execution of the user programs ? If so, describe what forms of interference are caused.
galvin operating-system introduction descriptive
9.24.32 Introduction: Galvin Edition 9 Exercise 1 Question 21 (Page No. 51) https://gateoverflow.in/306658
Some computer systems do not provide a privileged mode of operation in hardware. Is it possible to construct a secure
operating system for these computer systems ? Give arguments both that it is and that it is not possible.
galvin operating-system introduction descriptive
9.24.33 Introduction: Galvin Edition 9 Exercise 1 Question 22 (Page No. 51) https://gateoverflow.in/306659
Many SMP(Symmetric Multiprocessing) systems have different levels of caches; one level is local to each processing
core, and another level is shared among all processing cores. Why are caching systems designed this way ?
galvin operating-system introduction descriptive
9.24.34 Introduction: Galvin Edition 9 Exercise 1 Question 23 (Page No. 51) https://gateoverflow.in/306672
Consider an SMP system similar to the one shown in Figure 1.6. Illustrate with an example how data residing in
memory could in fact have a different value in each of the local caches.
9.24.35 Introduction: Galvin Edition 9 Exercise 1 Question 24 (Page No. 51) https://gateoverflow.in/306663
Discuss, with examples, how the problem of maintaining coherence of cached data manifests itself in the following
processing environments:
a. Single-processor systems
b. Multiprocessor systems
c. Distributed systems
galvin operating-system introduction descriptive
9.24.36 Introduction: Galvin Edition 9 Exercise 1 Question 25 (Page No. 52) https://gateoverflow.in/306665
Describe a mechanism for enforcing memory protection in order to prevent a program from modifying the memory
associated with other programs.
galvin operating-system introduction descriptive
9.24.37 Introduction: Galvin Edition 9 Exercise 1 Question 26 (Page No. 52) https://gateoverflow.in/306667
9.24.38 Introduction: Galvin Edition 9 Exercise 1 Question 27 (Page No. 52) https://gateoverflow.in/306668
Describe some of the challenges of designing operating systems for mobile devices compared with designing operating
systems for traditional PCs.
galvin operating-system introduction descriptive
9.24.39 Introduction: Galvin Edition 9 Exercise 1 Question 28 (Page No. 52) https://gateoverflow.in/306669
9.24.40 Introduction: Galvin Edition 9 Exercise 1 Question 29 (Page No. 52) https://gateoverflow.in/306670
Describe some distributed applications that would be appropriate for a peer-to-peer system.
galvin operating-system introduction descriptive
9.24.41 Introduction: Galvin Edition 9 Exercise 1 Question 3 (Page No. 49) https://gateoverflow.in/306627
What is the main difficulty that a programmer must overcome in writing an operating system for a real-time
environment ?
galvin operating-system introduction descriptive
9.24.42 Introduction: Galvin Edition 9 Exercise 1 Question 30 (Page No. 52) https://gateoverflow.in/306671
Identify several advantages and several disadvantages of open-source operating systems. Include the types of people
who would find each aspect to be an advantage or a disadvantage.
galvin operating-system introduction descriptive
9.24.43 Introduction: Galvin Edition 9 Exercise 1 Question 4 (Page No. 49) https://gateoverflow.in/306630
Keeping in mind the various definitions of operating system, consider whether the operating system should include
applications such as web browsers and mail programs. Argue both that it should and that it should not, and support your
answers.
galvin operating-system introduction descriptive
9.24.44 Introduction: Galvin Edition 9 Exercise 1 Question 5 (Page No. 50) https://gateoverflow.in/306632
How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security)
system ?
galvin operating-system introduction descriptive
9.24.45 Introduction: Galvin Edition 9 Exercise 1 Question 6 (Page No. 50) https://gateoverflow.in/306634
9.24.46 Introduction: Galvin Edition 9 Exercise 1 Question 7 (Page No. 50) https://gateoverflow.in/306637
Some early computers protected the operating system by placing it in a memory partition that could not be modified by
either the user job or the operating system itself. Describe two difficulties that you think could arise with such a
scheme.
galvin operating-system introduction descriptive
9.24.47 Introduction: Galvin Edition 9 Exercise 1 Question 8 (Page No. 50) https://gateoverflow.in/306639
Some CPUs provide for more than two modes of operation. What are two possible uses of these multiple modes ?
galvin operating-system introduction descriptive
9.24.48 Introduction: Galvin Edition 9 Exercise 1 Question 9 (Page No. 50) https://gateoverflow.in/306640
Timers could be used to compute the current time. Provide a short description of how this could be accomplished.
galvin operating-system introduction descriptive
9.24.49 Introduction: Galvin Edition 9 Exercise 2 Question 1 (Page No. 94) https://gateoverflow.in/306693
9.24.50 Introduction: Galvin Edition 9 Exercise 2 Question 10 (Page No. 95) https://gateoverflow.in/306706
Why do some systems store the operating system in firmware, while others store it on disk ?
galvin operating-system introduction descriptive
9.24.51 Introduction: Galvin Edition 9 Exercise 2 Question 11 (Page No. 95) https://gateoverflow.in/306707
How could a system be designed to allow a choice of operating systems from which to boot ? What would the bootstrap
program need to do ?
galvin operating-system introduction descriptive
9.24.52 Introduction: Galvin Edition 9 Exercise 2 Question 12 (Page No. 95) https://gateoverflow.in/306708
The services and functions provided by an operating system can be divided into two main categories. Briefly describe
the two categories,and discuss how they differ.
galvin operating-system introduction descriptive
9.24.53 Introduction: Galvin Edition 9 Exercise 2 Question 13 (Page No. 95) https://gateoverflow.in/306709
Describe three general methods for passing parameters to the operating system.
galvin operating-system introduction descriptive
9.24.54 Introduction: Galvin Edition 9 Exercise 2 Question 14 (Page No. 95) https://gateoverflow.in/306710
Describe how you could obtain a statistical profile of the amount of time spent by a program executing different
sections of its code. Discuss the importance of obtaining such a statistical profile.
galvin operating-system introduction descriptive
9.24.55 Introduction: Galvin Edition 9 Exercise 2 Question 15 (Page No. 95) https://gateoverflow.in/306711
What are the five major activities of an operating system with regard to file management ?
galvin operating-system introduction descriptive
9.24.56 Introduction: Galvin Edition 9 Exercise 2 Question 16 (Page No. 95) https://gateoverflow.in/306712
What are the advantages and disadvantages of using the same system call interface for manipulating both files and
devices?
galvin operating-system introduction descriptive
9.24.57 Introduction: Galvin Edition 9 Exercise 2 Question 17 (Page No. 95) https://gateoverflow.in/306713
Would it be possible for the user to develop a new command interpreter using the system-call interface provided by the
operating system?
galvin operating-system introduction descriptive
9.24.58 Introduction: Galvin Edition 9 Exercise 2 Question 18 (Page No. 95) https://gateoverflow.in/306714
What are the two models of inter process communication ? What are the strengths and weaknesses of the two
approaches ?
galvin operating-system introduction descriptive
9.24.59 Introduction: Galvin Edition 9 Exercise 2 Question 19 (Page No. 95) https://gateoverflow.in/306716
9.24.60 Introduction: Galvin Edition 9 Exercise 2 Question 2 (Page No. 94) https://gateoverflow.in/306694
What are the five major activities of an operating system with regard to process management ?
galvin operating-system introduction descriptive
9.24.61 Introduction: Galvin Edition 9 Exercise 2 Question 20 (Page No. 95) https://gateoverflow.in/306717
It is sometimes difficult to achieve a layered approach if two components of the operating system are dependent on
each other. Identify a scenario in which it is unclear how to layer two system components that require tight coupling of
their functionalities.
galvin operating-system introduction descriptive
9.24.62 Introduction: Galvin Edition 9 Exercise 2 Question 21 (Page No. 95) https://gateoverflow.in/306719
What is the main advantage of the micro kernel approach to system design ? How do user programs and system
services interact micro kernel architecture ? What are the disadvantages of using the micro kernel approach ?
galvin operating-system introduction descriptive
9.24.63 Introduction: Galvin Edition 9 Exercise 2 Question 22 (Page No. 95) https://gateoverflow.in/306720
9.24.64 Introduction: Galvin Edition 9 Exercise 2 Question 23 (Page No. 96) https://gateoverflow.in/306721
How are iOS and Android similar ? How are they different ?
galvin operating-system introduction descriptive
9.24.65 Introduction: Galvin Edition 9 Exercise 2 Question 24 (Page No. 96) https://gateoverflow.in/306722
Explain why Java programs running on Android systems do not use the standard Java API and virtual machine ?
galvin operating-system introduction descriptive
9.24.66 Introduction: Galvin Edition 9 Exercise 2 Question 25 (Page No. 96) https://gateoverflow.in/306723
The experimental Synthesis operating system has an assembler incorporated in the kernel. To optimize system-call
performance, the kernel assembles routines within kernel space to minimize the path that the system call must take
through the kernel. This approach is the antithesis of the layered approach, in which the path through the kernel is extended to
make building the operating system easier. Discuss the pros and cons of the Synthesis approach to kernel design and system-
performance optimization.
galvin operating-system introduction descriptive
9.24.67 Introduction: Galvin Edition 9 Exercise 2 Question 3 (Page No. 94) https://gateoverflow.in/306695
What are the three major activities of an operating system with regard to memory management?
galvin operating-system introduction descriptive
9.24.68 Introduction: Galvin Edition 9 Exercise 2 Question 4 (Page No. 94) https://gateoverflow.in/306698
What are the three major activities of an operating system with regard to secondary-storage management?
galvin operating-system introduction descriptive
9.24.69 Introduction: Galvin Edition 9 Exercise 2 Question 5 (Page No. 94) https://gateoverflow.in/306700
What is the purpose of the command interpreter ? Why is it usually separate from the kernel ?
galvin operating-system introduction descriptive
9.24.70 Introduction: Galvin Edition 9 Exercise 2 Question 6 (Page No. 95) https://gateoverflow.in/306701
What system calls have to be executed by a command interpreter or shell in order to start a new process ?
galvin operating-system introduction descriptive
9.24.71 Introduction: Galvin Edition 9 Exercise 2 Question 7 (Page No. 95) https://gateoverflow.in/306702
9.24.72 Introduction: Galvin Edition 9 Exercise 2 Question 8 (Page No. 95) https://gateoverflow.in/306703
What is the main advantage of the layered approach to system design ?What are the disadvantages of the layered
approach ?
galvin operating-system introduction descriptive
9.24.73 Introduction: Galvin Edition 9 Exercise 2 Question 9 (Page No. 95) https://gateoverflow.in/306705
List five services provided by an operating system, and explain how each creates convenience for users. In which cases
would it be impossible for user-level programs to provide these services ? Explain your answer.
galvin operating-system introduction descriptive
9.25.1 Inverted Page Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 25 (Page No. 256)
https://gateoverflow.in/324664
A computer with an 8 − KB page, a 256 − KB main memory, and a 64 − GB virtual address
space uses an inverted page table to implement its virtual memory. How big should the hash table be to ensure a mean
hash chain length of less than 1? Assume that the hash table size is a power of two.
tanenbaum operating-system memory-management virtual-memory inverted-page-table descriptive
9.26.1 Io System: Galvin Edition 9 Exercise 11 Question 13 (Page No. 540) https://gateoverflow.in/307226
Some systems automatically open a file when it is referenced for the first
time and close the file when the job terminates. Discuss the advantages
and disadvantages of this scheme compared with the more traditional
one, where the user has to open and close the file explicitly
operating-system galvin io-system descriptive
9.26.2 Io System: Galvin Edition 9 Exercise 11 Question 14 (Page No. 540) https://gateoverflow.in/307227
9.26.3 Io System: Galvin Edition 9 Exercise 13 Question 1 (Page No. 619) https://gateoverflow.in/307121
9.26.4 Io System: Galvin Edition 9 Exercise 13 Question 10 (Page No. 619) https://gateoverflow.in/307130
9.26.5 Io System: Galvin Edition 9 Exercise 13 Question 11 (Page No. 619) https://gateoverflow.in/307131
9.26.6 Io System: Galvin Edition 9 Exercise 13 Question 12 (Page No. 619) https://gateoverflow.in/307132
9.26.7 Io System: Galvin Edition 9 Exercise 13 Question 14 (Page No. 620) https://gateoverflow.in/307134
9.26.8 Io System: Galvin Edition 9 Exercise 13 Question 15 (Page No. 620) https://gateoverflow.in/307133
9.26.10 Io System: Galvin Edition 9 Exercise 13 Question 16 (Page No. 620) https://gateoverflow.in/307136
9.26.11 Io System: Galvin Edition 9 Exercise 13 Question 3 (Page No. 619) https://gateoverflow.in/307122
9.26.12 Io System: Galvin Edition 9 Exercise 13 Question 4 (Page No. 619) https://gateoverflow.in/307123
Polling for an I/O completion can waste a large number of CPU cycles
if the processor iterates a busy-waiting loop many times before the I/O
completes. But if the I/O device is ready for service, polling can be much
more efficient than is catching and dispatching an interrupt. Describe
a hybrid strategy that combines polling, sleeping, and interrupts for
I/O device service. For each of these three strategies (pure polling, pure
interrupts, hybrid), describe a computing environment in which that
strategy is more efficient than is either of the others.
operating-system galvin descriptive io-system
9.26.13 Io System: Galvin Edition 9 Exercise 13 Question 5 (Page No. 619) https://gateoverflow.in/307124
9.26.14 Io System: Galvin Edition 9 Exercise 13 Question 6 (Page No. 619) https://gateoverflow.in/307125
9.26.15 Io System: Galvin Edition 9 Exercise 13 Question 7 (Page No. 619) https://gateoverflow.in/307126
9.26.16 Io System: Galvin Edition 9 Exercise 13 Question 8 (Page No. 619) https://gateoverflow.in/307127
9.27.1 Kernel Mode: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 12 (Page No. 82)
https://gateoverflow.in/324335
Which of the following instructions should be allowed only in kernel mode?
a. Disable all interrupts. b. Read the time-of-day clock.
c. Set the time-of-day clock. d. Change the memory map
tanenbaum operating-system introduction kernel-mode easy
9.28.1 Kernel User Mode: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 10 (Page No. 81)
https://gateoverflow.in/324333
What is the difference between kernel and user mode? Explain how having two distinct modes
aids in designing an operating system.
tanenbaum operating-system introduction kernel-user-mode descriptive
9.29.1 Lru: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 31 (Page No. 257) https://gateoverflow.in/324674
Give a simple example of a page reference sequence where the first page selected for replacement will be different for
the clock and LRU page replacement algorithms. Assume that a process is allocated 3 = three frames, and the
reference string contains page numbers from the set 0, 1, 2, 3.
tanenbaum operating-system memory-management page-replacement lru descriptive
9.30.1 Memory: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 7 (Page No. 333)
https://gateoverflow.in/324720
In some systems it is possible to map part of a file into memory. What restrictions must such
systems impose? How is this partial mapping implemented?
tanenbaum operating-system file-system memory descriptive
9.31.1 Memory Management: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 1 (Page No. 254)
https://gateoverflow.in/324578
The IBM 360 had a scheme of locking 2 − KB blocks by assigning each one a 4 − bit key
and having the CPU compare the key on every memory reference to the 4 − bit key in the P SW . Name two
drawbacks of this scheme not mentioned in the text.
tanenbaum operating-system memory-management descriptive
9.31.2 Memory Management: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 10 (Page No. 255)
https://gateoverflow.in/324649
Copy on write is an interesting idea used on server systems. Does it make any sense on a
smartphone?
tanenbaum operating-system memory-management descriptive
9.31.3 Memory Management: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 2 (Page No. 254)
https://gateoverflow.in/324579
In Fig. 3 − 3 the base and limit registers contain the same value, 16, 384. Is this just an
accident, or are they always the same? It is just an accident, why are they the same in this example?
tanenbaum operating-system memory-management descriptive
9.31.4 Memory Management: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 3 (Page No. 254)
https://gateoverflow.in/324580
A swapping system eliminates holes by compaction. Assuming a random distribution of many
holes and many data segments and a time to read or write a 32 − bit memory word of 4 nsec, about how long does it
take to compact 4 GB? For simplicity, assume that word 0 is part of a hole and that the highest word in memory contains valid
data.
tanenbaum operating-system memory-management descriptive
9.31.5 Memory Management: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 4 (Page No. 254)
https://gateoverflow.in/324582
Consider a swapping system in which memory consists of the following hole sizes in memory
order: 10 MB, 4 MB, 20 MB, 18 MB, 7 MB, 9 MB, 12 MB, and 15 MB. Which hole is taken for successive
segment requests of
a. 12 MB
b. 10 MB
c. 9 MB
for first fit? Now repeat the question for best fit, worst fit, and next fit.
9.32.1 Memory Mapped: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 3 (Page No. 429)
https://gateoverflow.in/324817
Figure 5 − 3(b) shows one way of having memory-mapped I/O even in the presence of separate
buses for memory and I/O devices, namely, to first try the memory bus and if that fails try the I/O bus. A clever
computer science student has thought of an improvement on this idea: try both in parallel, to speed up the process of accessing
I/O devices. What do you think of this idea?
tanenbaum operating-system input-output memory-mapped descriptive
9.32.2 Memory Mapped: Andrew S. Tanenbaum (OS) Edition 4 Exercise 5 Question 47 (Page No. 433)
https://gateoverflow.in/324865
Assuming that it takes 2 nsec to copy a byte, how much time does it take to completely rewrite
the screen of an 80 character × 25 line text mode memory-mapped screen? What about a 1024 × 768 pixel graphics
screen with 24-bit color?
tanenbaum operating-system input-output memory-mapped descriptive
9.33.1 Monitors: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 59 (Page No. 179)
https://gateoverflow.in/324571
Solve the dining philosophers problem using monitors instead of semaphores.
tanenbaum operating-system process-and-threads semaphores monitors descriptive
9.34.1 Multi Programming: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 5 (Page No. 81)
https://gateoverflow.in/324123
On early computers, every byte of data read or written was handled by the CPU (i.e., there was
no DMA). What implications does this have for multiprogramming?
tanenbaum operating-system multi-programming dma descriptive
9.35.1 Multilevel Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 19 (Page No. 256)
https://gateoverflow.in/324658
A computer with a 32 − bit address uses a two-level page table. Virtual addresses are split into
a 9 − bit top-level page table field, an 11 − bit second-level page table field, and an offset. How large are the pages
and how many are there in the address space?
tanenbaum operating-system memory-management multilevel-paging page-table descriptive
9.36.1 Multiplexing: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 21 (Page No. 82)
https://gateoverflow.in/324344
What type of multiplexing (time, space, or both) can be used for sharing the following resources:
CPU, memory, disk, network card, printer, keyboard, and display?
tanenbaum operating-system introduction multiplexing descriptive
9.37.1 Multiprocessors: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 28 (Page No. 176)
https://gateoverflow.in/324505
When a computer is being developed, it is usually first simulated by a program that runs one
instruction at a time. Even multiprocessors are simulated strictly sequentially like this. Is it possible for a race condition
to occur when there are no simultaneous events like this?
tanenbaum operating-system process-and-threads multiprocessors descriptive
9.37.2 Multiprocessors: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 29 (Page No. 176)
https://gateoverflow.in/324506
The producer-consumer problem can be extended to a system with multiple producers and
consumers that write (or read) to (from) one shared buffer. Assume that each producer and consumer runs in its own
thread. Will the solution presented in Fig. 2 − 28, using semaphores, work for this system?
9.38.1 Multithreaded: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 12 (Page No. 174)
https://gateoverflow.in/324488
In Fig. 2 − 8, a multithreaded Web server is shown. If the only way to read from a file is the
normal blocking read system call, do you think user-level threads or kernel-level threads are being used for the Web
server? Why?
tanenbaum operating-system process-and-threads multithreaded descriptive
9.38.2 Multithreaded: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 64 (Page No. 179 - 180)
https://gateoverflow.in/324576
The objective of this exercise is to implement a multithreaded solution to find if a given number
is a perfect number. N is a perfect number if the sum of all its factors, excluding itself, is N; examples are 6 and 28.
The input is an integer, N . The output is true if the number is a perfect number and false otherwise. The main program will
read the numbers N and P from the command line. The main process will spawn a set of P threads. The numbers from 1 to N
will be partitioned among these threads so that two threads do not work on the name number. For each number in this set, the
thread will determine if the number is a factor of N . If it is, it adds the number to a shared buffer that stores factors of N . The
parent process waits till all the threads complete. Use the appropriate synchronization primitive here. The parent will then
determine if the input number is perfect, that is, if N is a sum of all its factors and then report accordingly. (Note: You can
make the computation faster by restricting the numbers searched from 1 to the square root of N. )
/* Other code */
Critical Section /* . . . */
tur n = 0;
/* Other code */
For process P 1, replace 0 by 1 in above code. Determine if the solution meets all the required conditions for a correct mutual-
exclusion solution.
9.40.1 Page Fault: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 13 (Page No. 255)
https://gateoverflow.in/324652
If an instruction takes 1 nsec and a page fault takes an additional n nsec, give a formula for the
effective instruction time if page faults occur every k instructions.
tanenbaum operating-system memory-management paging page-fault descriptive
9.40.2 Page Fault: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 39 (Page No. 259)
https://gateoverflow.in/324691
You have been hired by a cloud computing company that deploys thousands of servers at each of
its data centers. They have recently heard that it would be worthwhile to handle a page fault at server A by reading the
page from the RAM memory of some other server rather than its local disk drive.
9.40.3 Page Fault: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 42 (Page No. 259)
https://gateoverflow.in/324695
It has been observed that the number of instructions executed between page faults is directly
proportional to the number of page frames allocated to a program. If the available memory is doubled, the mean
interval between page faults is also doubled. Suppose that a normal instruction takes 1 microsec, but if a page fault occurs, it
takes 2001 μsec(i. e. , 2 msec) to handle the fault. If a program takes 60 sec to run, during which time it gets 15, 000 page
faults, how long would it take to run if twice as much memory were available?
tanenbaum operating-system memory-management paging page-fault descriptive
9.40.4 Page Fault: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 44 (Page No. 259)
https://gateoverflow.in/324697
A machine-language instruction to load a 32 − bit word into a register contains the 32 − bit
address of the word to be loaded. What is the maximum number of page faults this instruction can cause?
tanenbaum operating-system memory-management paging page-fault descriptive
9.40.5 Page Fault: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 47 (Page No. 259 - 260)
https://gateoverflow.in/324702
We consider a program which has the two segments shown below consisting of instructions in
segment 0, and read/write data in segment 1. Segment 0 has read/execute protection, and segment 1 has just read/write
protection. The memory system is a demand- paged virtual memory system with virtual addresses that have a 4 − bit page
number, and a 10 − bit offset. The page tables and protection are as follows (all numbers in the table are in decimal):
For each of the following cases, either give the real (actual) memory address which results from dynamic address translation or
identify the type of fault which occurs (either page or protection fault).
9.40.6 Page Fault: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 51 (Page No. 260)
https://gateoverflow.in/324706
Write a program that simulates a paging system using the aging algorithm. The number of page
frames is a parameter. The sequence of page references should be read from a file. For a given input file, plot the
number of page faults per 1000 memory references as a function of the number of page frames available.
tanenbaum operating-system memory-management paging page-fault descriptive
9.40.7 Page Fault: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 52 (Page No. 260 - 261)
https://gateoverflow.in/324708
Write a program that simulates a toy paging system that uses the WSClock algorithm. The
system is a toy in that we will assume there are no write references (not very realistic), and process termination and
creation are ignored (eternal life). The inputs will be:
9.40.8 Page Fault: Galvin Edition 9 Exercise 9 Question 19 (Page No. 453) https://gateoverflow.in/307095
Assume that we have a demand-paged memory. The page table is held in registers. It takes 8 milliseconds to service a
page fault if an empty frame is available or if the replaced page is not modified and 20 milliseconds if the replaced
page is modified. Memory-access time is 100 nanoseconds. Assume that the page to be replaced is modified 70 percent of the
time. What is the maximum acceptable page-fault rate for an effective access time of no more than 200 nanoseconds ?
galvin operating-system virtual-memory page-fault
9.40.9 Page Fault: Galvin Edition 9 Exercise 9 Question 20 (Page No. 453) https://gateoverflow.in/307096
When a page fault occurs, the process requesting the page must block while waiting for the page to be brought from
disk into physical memory. Assume that there exists a process with five user-level threads and that the mapping of user
threads to kernel threads is one to one. If one user thread incurs a page fault while accessing its stack, would the other user
threads belonging to the same process also be affected by the page fault—that is, would they also have to wait for the faulting
page to be brought into memory? Explain.
galvin operating-system virtual-memory page-fault descriptive
9.40.10 Page Fault: Galvin Edition 9 Exercise 9 Question 21 (Page No. 453) https://gateoverflow.in/307097
7, 2, 3, 1, 2, 5, 3, 4, 6, 7, 7, 1, 0, 5, 4, 6, 2, 3, 0, 1.
Assuming demand paging with three frames, how many page faults would occur for the following replacement algorithms ?
∙ LRU replacement
∙ FIFO replacement
∙ Optimal replacement
galvin operating-system virtual-memory page-fault
9.41.1 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 26 (Page No. 256)
https://gateoverflow.in/324665
A student in a compiler design course proposes to the professor a project of writing a compiler
that will produce a list of page references that can be used to implement the optimal page replacement algorithm. Is this
possible? Why or why not? Is there anything that could be done to improve paging efficiency at run time?
tanenbaum operating-system memory-management paging page-replacement descriptive
9.41.2 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 27 (Page No. 256 - 257)
https://gateoverflow.in/324667
Suppose that the virtual page reference stream contains repetitions of long sequences of page
references followed occasionally by a random page reference. For example, the sequence
: 0, 1, … , 511, 431, 0, 1, … , 511, 332, 0, 1, … consists of repetitions of the sequence 0, 1, … , 511 followed by a random
reference to pages 431 and 332.
a. Why will the standard replacement algorithms (LRU, FIFO, clock) not be effective in handling this workload for a page
allocation that is less than the sequence length?
b. If this program were allocated 500 page frames, describe a page replacement approach that would perform much better
than the LRU, FIFO, or clock algorithms.
9.41.3 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 28 (Page No. 257)
https://gateoverflow.in/324669
I f FIFO page replacement is used with four page frames and eight pages, how many page
faults will occur with the reference string 0172327103 if the four frames are initially empty? Now repeat this problem
forLRU.
tanenbaum operating-system memory-management page-replacement descriptive
9.41.4 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 29 (Page No. 257)
https://gateoverflow.in/324671
Consider the page sequence of Fig. 3 − 15(b). Suppose that the R bits for the pages B through
A are 11011011, respectively. Which page will second chance remove?
tanenbaum operating-system memory-management page-replacement descriptive
9.41.5 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 30 (Page No. 257)
https://gateoverflow.in/324672
A small computer on a smart card has four page frames. At the first clock tick, the R bits are
0111 (page 0 is 0, the rest are 1). At subsequent clock ticks, the values are 1011, 1010, 1101, 0010, 1010, 1100, and
0001. If the aging algorithm is used with an 8 − bit counter, give the values of the four counters after the last tick.
tanenbaum operating-system memory-management page-replacement descriptive
9.41.6 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 32 (Page No. 257)
https://gateoverflow.in/324675
In the WSClock algorithm of Fig. 3 − 20(c), the hand points to a page with R = 0. If
τ = 400, will this page be removed? What about if τ = 1000?
9.41.7 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 33 (Page No. 257)
https://gateoverflow.in/324676
Suppose that the WSClock page replacement algorithm uses a τ of two ticks, and the system
state is the following:
where the three flag bits V , R, and M stand for Valid, Referenced, and Modified, respectively.
a. If a clock interrupt occurs at tick 10, show the contents of the new table entries. Explain. (You can omit entries that are
unchanged.)
b. Suppose that instead of a clock interrupt, a page fault occurs at tick 10 due to a read request to page 4. Show the contents
of the new table entries. Explain. (You can omit entries that are unchanged.)
9.41.8 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 34 (Page No. 257)
https://gateoverflow.in/324677
A student has claimed that ‘‘in the abstract, the basic page replacement algorithms (FIFO, LRU,
optimal) are identical except for the attribute used for selecting the page to be replaced.’’
a. What is that attribute for the FIFO algorithm? LRU algorithm? Optimal algorithm?
b. Give the generic algorithm for these page replacement algorithms.
9.41.9 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 35 (Page No. 258)
https://gateoverflow.in/324678
How long does it take to load a 64 − KB program from a disk whose average seek time is
5 msec, whose rotation time is 5msec, and whose tracks hold 1 MB
a. for a 2 − KB page size?
b. for a 4 − KB page size?
The pages are spread randomly around the disk and the number of cylinders is so large that the chance of two pages being on
the same cylinder is negligible.
9.41.10 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 36 (Page No. 258)
https://gateoverflow.in/324679
A computer has four page frames. The time of loading, time of last access, and the R and
M bits for each page are as shown below (the times are in clock ticks):
a. Which page will NRU replace? b. Which page will FIFO replace?
c. Which page will LRU replace? d. Which page will second chance
replace?
tanenbaum operating-system memory-management page-replacement descriptive
9.41.11 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 37 (Page No. 258)
https://gateoverflow.in/324680
Suppose that two processes A and B share a page that is not in memory. If process A faults on
the shared page, the page table entry for process A must be updated once the page is read into memory.
a. Under what conditions should the page table update for process B be delayed even though the handling of process
A′ s page fault will bring the shared page into memory? Explain.
b. What is the potential cost of delaying the page table update?
9.41.12 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 38 (Page No. 258)
https://gateoverflow.in/324690
Consider the following two-dimensional array:
int X[64][64];
Suppose that a system has four page frames and each frame is 128 words (an integer occupies one word). Programs that
manipulate the X array fit into exactly one page and always occupy page 0. The data are swapped in and out of the other three
frames. The X array is stored in row-major order (i. e. , X[0][1] follows X[0][0] in memory ). Which of the two code
fragments shown below will generate the lowest number of page faults? Explain and compute the total number of page faults.
Fragment A
for (int j = 0; j < 64; j++)
for (int i = 0; i < 64; i++) X[i][j] = 0;
Fragment B
for (int i = 0; i < 64; i++)
for (int j = 0; j < 64; j++) X[i][j] = 0;
9.41.13 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 40 (Page No. 259)
https://gateoverflow.in/324693
One of the first timesharing machines, the DEC P DP − 1, had a (core) memory of
4K 18 − bit words. It held one process at a time in its memory. When the scheduler decided to run another process,
the process in memory was written to a paging drum, with 4K 18 − bit words around the circumference of the drum. The
drum could start writing (or reading) at any word, rather than only at word 0. Why do you suppose this drum was chosen?
tanenbaum operating-system memory-management paging page-replacement descriptive
9.41.14 Page Replacement: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 54 (Page No. 261)
https://gateoverflow.in/324711
Write a program that will demonstrate the difference between using a local page replacement
policy and a global one for the simple case of two processes. You will need a routine that can generate a page reference
string based on a statistical model. This model has N states numbered from 0 to N − 1 representing each of the possible page
references and a probability pi associated with each state i representing the chance that the next reference is to the same page.
Otherwise, the next page reference will be one of the other pages with equal probability.
a. Demonstrate that the page reference string-generation routine behaves properly for some small N.
b. Compute the page fault rate for a small example in which there is one process and a fixed number of page frames. Explain
why the behavior is correct.
c. Repeat part (b) with two processes with independent page reference sequences and twice as many page frames as in part
(b).
d. Repeat part (c) but using a global policy instead of a local one. Also, contrast the per-process page fault rate with that of
the local policy approach.
9.42.1 Page Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 14 (Page No. 255)
https://gateoverflow.in/324653
A machine has a 32 − bit address space and an 8 − KB page. The page table is entirely in
hardware, with one 32 − bit word per entry. When a process starts, the page table is copied to the hardware from
memory, at one word every 100 nsec. If each process runs for 100 msec (including the time to load the page table), what
fraction of the CP U time is devoted to loading the page tables?
tanenbaum operating-system memory-management paging page-table descriptive
9.42.2 Page Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 15 (Page No. 255)
https://gateoverflow.in/324654
Suppose that a machine has 48 − bit virtual addresses and 32 − bit physical addresses.
a. If pages are 4 KB, how many entries are in the page table if it has only a single level? Explain.
b. Suppose this same system has a TLB (Translation Lookaside Buffer) with 32 entries. Furthermore, suppose that a
program contains instructions that fit into one page and it sequentially reads long integer elements from an array that spans
thousands of pages. How effective will the TLB be for this case?
9.42.3 Page Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 17 (Page No. 255)
https://gateoverflow.in/324656
Suppose that a machine has 438 − bit virtual addresses and 32 − bit physical addresses.
a. What is the main advantage of a multilevel page table over a single-level one?
b. With a two-level page table, 16 − KB pages, and 4 − byte entries, how many bits should be allocated for the top-level
page table field and how many for the next level page table field? Explain.
9.42.4 Page Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 18 (Page No. 256)
https://gateoverflow.in/324657
Section 3.3.4 states that the Pentium Pro extended each entry in the page table hierarchy to 64
bits but still could only address only 4 GB of memory. Explain how this statement can be true when page table entries
have 64 bits.
tanenbaum operating-system memory-management paging page-table descriptive
9.42.5 Page Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 20 (Page No. 256)
https://gateoverflow.in/324659
A computer has 32 − bit virtual addresses and 4 − KB pages. The program and data together
fit in the lowest page (0– 4095) The stack fits in the highest page. How many entries are needed in the page table if
traditional (one-level) paging is used? How many page table entries are needed for two-level paging, with 10 bits in each part?
tanenbaum operating-system memory-management paging page-table descriptive
9.42.6 Page Table: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 24 (Page No. 256)
https://gateoverflow.in/324663
A machine has 48 − bit virtual addresses and 32 − bit physical addresses. Pages are 8 KB.
How many entries are needed for a single-level linear page table?
tanenbaum operating-system memory-management paging page-table descriptive
9.43.1 Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 21 (Page No. 256)
https://gateoverflow.in/324660
Below is an execution trace of a program fragment for a computer with 512 − byte pages. The
program is located at address 1020, and its stack pointer is at 8192 (the stack grows toward 0). Give the page
reference string generated by this program. Each instruction occupies 4 bytes (1word) including immediate constants. Both
instruction and data references count in the reference string.
9.43.2 Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 41 (Page No. 259)
https://gateoverflow.in/324694
A computer provides each process with 65, 536 bytes of address space divided into pages of
4096 bytes each. A particular program has a text size of 32, 768 bytes, a data size of 16, 386 bytes, and a stack size of
15, 870 bytes. Will this program fit in the machine’s address space? Suppose that instead of 4096 bytes, the page size were
512 bytes, would it then fit? Each page must contain either text, data, or stack, not a mixture of two or three of them.
tanenbaum operating-system memory-management paging descriptive
9.43.3 Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 43 (Page No. 259)
https://gateoverflow.in/324696
A group of operating system designers for the Frugal Computer Company are thinking about
ways to reduce the amount of backing store needed in their new operating system. The head guru has just suggested not
bothering to save the program text in the swap area at all, but just page it in directly from the binary file whenever it is needed.
Under what conditions, if any, does this idea work for the program text? Under what conditions, if any, does it work for the
data?
tanenbaum operating-system memory-management paging descriptive
9.43.4 Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 48 (Page No. 260)
https://gateoverflow.in/324703
Can you think of any situations where supporting virtual memory would be a bad idea, and what
would be gained by not having to support virtual memory? Explain.
tanenbaum operating-system memory-management virtual-memory paging descriptive
9.43.5 Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 49 (Page No. 260)
https://gateoverflow.in/324704
Virtual memory provides a mechanism for isolating one process from another. What memory
management difficulties would be involved in allowing two operating systems to run concurrently? How might these
difficulties be addressed?
tanenbaum operating-system memory-management paging virtual-memory descriptive
9.43.6 Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 50 (Page No. 260)
https://gateoverflow.in/324705
Plot a histogram and calculate the mean and median of the sizes of executable binary files on a
computer to which you have access. On a Windows system, look at all .exe and .dll files; on a UNIX system look at all
executable files in /bin, /usr/bin, and /local/bin that are not scripts (or use the file utility to find all executables). Determine the
optimal page size for this computer just considering the code (not data). Consider internal fragmentation and page table size,
making some reasonable assumption about the size of a page table entry. Assume that all programs are equally likely to be run
and thus should be weighted equally.
tanenbaum operating-system memory-management paging descriptive
9.43.7 Paging: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 9 (Page No. 255) https://gateoverflow.in/324648
What kind of hardware support is needed for a paged virtual memory to work?
tanenbaum operating-system memory-management virtual-memory paging descriptive
9.43.8 Paging: Galvin Edition 9 Exercise 9 Question 38 (Page No. 456) https://gateoverflow.in/307202
Consider a system that allocates pages of different sizes to its processes. What are the advantages of such a paging
scheme ? What modifications to the virtual memory system provide this functionality ?
galvin operating-system memory-management paging
9.44.1 Physical Address: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 5 (Page No. 254)
https://gateoverflow.in/324583
What is the difference between a physical address and a virtual address?
tanenbaum operating-system memory-management physical-address virtual-memory descriptive
9.44.2 Physical Address: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 7 (Page No. 254)
https://gateoverflow.in/324646
Using the page table of Fig. 3 − 9, give the physical address corresponding to each of the
following virtual addresses:
a. 20
b. 4100
c. 8300
tanenbaum operating-system memory-management physical-address virtual-memory descriptive
9.45.1 Preemptable Nonpreemptable: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 3 (Page No. 465)
https://gateoverflow.in/324879
In the preceding question, which resources are preemptable and which are nonpreemptable?
9.46.1 Process: Galvin Edition 9 Exercise 3 Question 1 (Page No. 149) https://gateoverflow.in/306724
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
int value = 5;
int main()
{
pid t pid;
pid = fork();
if (pid == 0) { /* child process */
value += 15;
return 0;
}
else if (pid > 0) { /* parent process */
wait(NULL);
printf("PARENT: value = %d",value); /* LINE A */
return 0;
}
}
Construct a process tree similar to Figure 3.8. To obtain process information for the UNIX or Linux system, use the
command ps -ael.Use the command man ps to get more information about the ps command.The task manager on
Windows systems does not provide the
parent process ID, but the process monitor tool, available from technet.microsoft.com, provides a process-tree tool.
9.46.3 Process: Galvin Edition 9 Exercise 3 Question 11 (Page No. 152) https://gateoverflow.in/306737
Explain the role of the init process on UNIX and Linux systems in regard to process termination.
galvin operating-system process descriptive
9.46.4 Process: Galvin Edition 9 Exercise 3 Question 12 (Page No. 152) https://gateoverflow.in/306738
Including the initial parent process, how many processes are created by the program shown below-
#include <stdio.h>
#include <unistd.h>
int main()
{
int i;
for (i = 0; i < 4; i++)
fork();
return 0;
}
galvin operating-system process programming
9.46.5 Process: Galvin Edition 9 Exercise 3 Question 13 (Page No. 152) https://gateoverflow.in/306739
Explain the circumstances under which which the line of code marked printf("LINE J") in following program will be
reached.
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
pid t pid;
/* fork a child process */
pid = fork();
if (pid < 0) { /* error occurred */
fprintf(stderr, "Fork Failed");
return 1;
}
else if (pid == 0) { /* child process */
execlp("/bin/ls","ls",NULL);
printf("LINE J");
}
else { /* parent process */
/* parent will wait for the child to complete */
wait(NULL);
printf("Child Complete");
}
return 0;
}
galvin operating-system process programming
9.46.6 Process: Galvin Edition 9 Exercise 3 Question 14 (Page No. 152) https://gateoverflow.in/306740
Using the program in Figure 3.34, identify the values of pid at lines A, B, C, and D. (Assume that the actual pids of the
parent and child are 2600 and 2603, respectively.)
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
pid t pid, pid1;
/* fork a child process */
pid = fork();
if (pid < 0) { /* error occurred */
fprintf(stderr, "Fork Failed");
return 1;
}
else if (pid == 0) { /* child process */
pid1 = getpid();
printf("child: pid = %d",pid); /* A */
printf("child: pid1 = %d",pid1); /* B */
}
else { /* parent process */
pid1 = getpid();
printf("parent: pid = %d",pid); /* C */
printf("parent: pid1 = %d",pid1); /* D */
wait(NULL);
}
return 0;
}
galvin operating-system process programming
9.46.7 Process: Galvin Edition 9 Exercise 3 Question 15 (Page No. 153) https://gateoverflow.in/306741
Give an example of a situation in which ordinary pipes are more suitable than named pipes and an example of a
situation in which named pipes are more suitable than ordinary pipes.
galvin operating-system process descriptive
9.46.8 Process: Galvin Edition 9 Exercise 3 Question 16 (Page No. 153) https://gateoverflow.in/306742
Consider the RPC mechanism. Describe the undesirable consequences that could arise from not enforcing either the “at
most once” or “exactly once” semantic. Describe possible uses for a mechanism that has neither of these guarantees.
galvin operating-system process descriptive
9.46.9 Process: Galvin Edition 9 Exercise 3 Question 17 (Page No. 153) https://gateoverflow.in/306743
Using the program shown below, explain what the output will be at lines X and Y.
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#define SIZE 5
int nums[SIZE] = {0,1,2,3,4};
int main()
{
int i;
pid t pid;
pid = fork();
if (pid == 0) {
for (i = 0; i < SIZE; i++) {
nums[i] *= -i;
printf("CHILD: %d ",nums[i]); /* LINE X */
}
}
else if (pid > 0) {
wait(NULL);
for (i = 0; i < SIZE; i++)
printf("PARENT: %d ",nums[i]); /* LINE Y */
}
return 0;
}
galvin operating-system process programming
9.46.10 Process: Galvin Edition 9 Exercise 3 Question 18 (Page No. 153) https://gateoverflow.in/306744
What are the benefits and the disadvantages of each of the following ? Consider both the system level and the
programmer level.
a. Synchronous and asynchronous communication
b. Automatic and explicit buffering
c. Send by copy and send by reference
d. Fixed-sized and variable-sized messages
galvin operating-system process descriptive
9.46.11 Process: Galvin Edition 9 Exercise 3 Question 2 (Page No. 149-150) https://gateoverflow.in/306725
Including the initial parent process, how many processes are created by the following program.
#include <stdio.h>
#include <unistd.h>
int main()
{
fork();
fork();
fork();
return 0;
}
galvin operating-system process programming
9.46.12 Process: Galvin Edition 9 Exercise 3 Question 3 (Page No. 150) https://gateoverflow.in/306726
Original versions of Apple’s mobile iOS operating system provided no means of concurrent processing. Discuss three
major complications that concurrent processing adds to an operating system.
galvin operating-system process descriptive
9.46.13 Process: Galvin Edition 9 Exercise 3 Question 4 (Page No. 150) https://gateoverflow.in/306727
The Sun UltraSPARC processor has multiple register sets. Describe what happens when a context switch occurs if the
new context is already loaded into one of the register sets. What happens if the new context is in memory rather than in
a register set and all the register sets are in use ?
galvin operating-system process descriptive
9.46.14 Process: Galvin Edition 9 Exercise 3 Question 5 (Page No. 150) https://gateoverflow.in/306728
When a process creates a new process using the fork() operation, which of the following states is shared between the
parent process and the child process ?
a. Stack
b. Heap
c. Shared memory segments
galvin operating-system process descriptive
9.46.15 Process: Galvin Edition 9 Exercise 3 Question 6 (Page No. 150) https://gateoverflow.in/306729
Consider the “exactly once”semantic with respect to the RPC mechanism. Does the algorithm for implementing this
semantic execute correctly even if the ACK message sent back to the client is lost due to a network problem? Describe
the sequence of messages, and discuss whether “exactly once” is still preserved.
galvin operating-system process descriptive
9.46.16 Process: Galvin Edition 9 Exercise 3 Question 7 (Page No. 150) https://gateoverflow.in/306730
Assume that a distributed system is susceptible to server failure. What mechanisms would be required to guarantee the
“exactly once” semantic for execution of RPCs?
galvin operating-system process descriptive
9.46.17 Process: Galvin Edition 9 Exercise 3 Question 8 (Page No. 151) https://gateoverflow.in/306733
Describe the differences among short-term, medium-term, and long term scheduling.
galvin operating-system process descriptive
9.46.18 Process: Galvin Edition 9 Exercise 3 Question 9 (Page No. 151) https://gateoverflow.in/306734
9.47.1 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 1 (Page No. 174)
https://gateoverflow.in/324362
In Fig. 2 − 2, three process states are shown. In theory, with three states, there could be six
transitions, two out of each state. However, only four transitions are shown. Are there any circumstances in which
either or both of the missing transitions might occur?
9.47.2 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 10 (Page No. 174)
https://gateoverflow.in/324486
In the text it was stated that the model of Fig. 2 − 11(a) was not suited to a file server using a
cache in memory. Why not? Could each process have its own cache?
tanenbaum operating-system process-and-threads cache-memory descriptive
9.47.3 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 11 (Page No. 174)
https://gateoverflow.in/324487
If a multithreaded process forks, a problem occurs if the child gets copies of all the parent’s
threads. Suppose that one of the original threads was waiting for keyboard input. Now two threads are waiting for
keyboard input, one in each process. Does this problem ever occur in single-threaded processes?
tanenbaum operating-system process-and-threads threads descriptive
9.47.4 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 14 (Page No. 175)
https://gateoverflow.in/324490
In Fig. 2 − 12 the register set is listed as a per-thread rather than a per-process item. Why? After
all, the machine has only one set of registers.
tanenbaum operating-system process-and-threads descriptive
9.47.5 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 15 (Page No. 175)
https://gateoverflow.in/324491
Why would a thread ever voluntarily give up the CPU by calling thread yield? After all, since
there is no periodic clock interrupt, it may never get the CPU back.
tanenbaum operating-system process-and-threads interrupts descriptive
9.47.6 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 16 (Page No. 175)
https://gateoverflow.in/324492
Can a thread ever be preempted by a clock interrupt? If so, under what circumstances? If not,
why not?
tanenbaum operating-system process-and-threads interrupts descriptive
9.47.7 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 17 (Page No. 175)
https://gateoverflow.in/324493
In this problem, you are to compare reading a file using a single-threaded file server and a
multithreaded server. It takes 12 msec to get a request for work, dispatch it, and do the rest of the necessary processing,
assuming that the data needed are in the block cache. If a disk operation is needed, as is the case one-third of the time, an
additional 75 msec is required, during which time the thread sleeps. How many requests/sec can the server handle if it is single
threaded? If it is multithreaded?
tanenbaum operating-system process-and-threads descriptive
9.47.8 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 18 (Page No. 175)
https://gateoverflow.in/324494
What is the biggest advantage of implementing threads in user space? What is the biggest
disadvantage?
tanenbaum operating-system process-and-threads descriptive
9.47.9 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 19 (Page No. 175)
https://gateoverflow.in/324496
In Fig. 2 − 15 the thread creations and messages printed by the threads are interleaved at
random. Is there a way to force the order to be strictly thread 1 created, thread 1 prints message, thread 1 exits, thread 2
created, thread 2 prints message, thread 2 exists, and so on? If so, how? If not, why not?
tanenbaum operating-system process-and-threads descriptive
9.47.10 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 2 (Page No. 174)
https://gateoverflow.in/324477
Suppose that you were to design an advanced computer architecture that did process switching
in hardware, instead of having interrupts. What information would the CPU need? Describe how the hardware process
switching might work.
tanenbaum operating-system process-and-threads interrupts descriptive
9.47.11 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 20 (Page No. 175)
https://gateoverflow.in/324497
In the discussion on global variables in threads, we used a procedure create global to allocate
storage for a pointer to the variable, rather than the variable itself. Is this essential, or could the procedures work with
the values themselves just as well?
tanenbaum operating-system process-and-threads descriptive
9.47.12 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 21 (Page No. 175)
https://gateoverflow.in/324498
Consider a system in which threads are implemented entirely in user space, with the run-time
system getting a clock interrupt once a second. Suppose that a clock interrupt occurs while some thread is executing in
the run-time system. What problem might occur? Can you suggest a way to solve it?
tanenbaum operating-system process-and-threads interrupts descriptive
9.47.13 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 22 (Page No. 175)
https://gateoverflow.in/324499
Suppose that an operating system does not have anything like the select system call to see in
advance if it is safe to read from a file, pipe, or device, but it does allow alarm clocks to be set that interrupt blocked
system calls. Is it possible to implement a threads package in user space under these conditions? Discuss.
tanenbaum operating-system process-and-threads interrupts descriptive
9.47.14 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 23 (Page No. 175)
https://gateoverflow.in/324500
Does the busy waiting solution using the turn variable (Fig. 2 − 23) work when the two
processes are running on a shared-memory multiprocessor, that is, two CPUs sharing a common memory?
tanenbaum operating-system process-and-threads descriptive
9.47.15 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 24 (Page No. 175)
https://gateoverflow.in/324501
Does Peterson’s solution to the mutual-exclusion problem shown in Fig. 2 − 24 work when
process scheduling is preemptive? How about when it is nonpreemptive?
9.47.16 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 25 (Page No. 175)
https://gateoverflow.in/324502
Can the priority inversion problem discussed in Sec. 2.3.4 happen with user-level threads? Why
or why not?
tanenbaum operating-system process-and-threads descriptive
9.47.17 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 26 (Page No. 175)
https://gateoverflow.in/324503
In Sec. 2.3.4, a situation with a high-priority process, H, and a low-priority process, L, was
described, which led to H looping forever. Does the same problem occur if round-robin scheduling is used instead of
priority scheduling? Discuss.
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.18 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 27 (Page No. 175)
https://gateoverflow.in/324504
In a system with threads, is there one stack per thread or one stack per process when user-level
threads are used? What about when kernel-level threads are used? Explain.
tanenbaum operating-system process-and-threads threads descriptive
9.47.19 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 3 (Page No. 174)
https://gateoverflow.in/324478
On all current computers, at least part of the interrupt handlers are written in assembly language.
Why?
tanenbaum operating-system process-and-threads interrupts descriptive
9.47.20 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 31 (Page No. 176)
https://gateoverflow.in/324539
How could an operating system that can disable interrupts implement semaphores?
tanenbaum operating-system process-and-threads interrupts semaphores descriptive
9.47.21 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 32 (Page No. 176)
https://gateoverflow.in/324540
Show how counting semaphores (i.e., semaphores that can hold an arbitrary value) can be
implemented using only binary semaphores and ordinary machine instructions.
tanenbaum operating-system process-and-threads machine-instructions descriptive
9.47.22 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 33 (Page No. 176)
https://gateoverflow.in/324541
If a system has only two processes, does it make sense to use a barrier to synchronize them?
Why or why not?
tanenbaum operating-system process-and-threads process-synchronization descriptive
9.47.23 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 34 (Page No. 176)
https://gateoverflow.in/324542
Can two threads in the same process synchronize using a kernel semaphore if the threads are
implemented by the kernel? What if they are implemented in user space? Assume that no threads in any other processes
have access to the semaphore. Discuss your answers.
tanenbaum operating-system process-and-threads semaphores descriptive
9.47.24 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 35 (Page No. 176)
https://gateoverflow.in/324543
Synchronization within monitors uses condition variables and two special operations, wait and
signal. A more general form of synchronization would be to have a single primitive, waituntil, that had an arbitrary
Boolean predicate as parameter. Thus, one could say, for example,
9.47.25 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 36 (Page No. 176)
https://gateoverflow.in/324544
A fast-food restaurant has four kinds of employees: (1) order takers, who take customers’
orders; (2) cooks, who prepare the food; (3) packaging specialists, who stuff the food into bags; and (4) cashiers, who
give the bags to customers and take their money. Each employee can be regarded as a communicating sequential process. What
form of interprocess communication do they use? Relate this model to processes in UNIX.
tanenbaum operating-system process-and-threads descriptive
9.47.26 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 38 (Page No. 177)
https://gateoverflow.in/324546
T h e CDC 6600 computers could handle up to 10 I /O processes simultaneously using an
interesting form of round-robin scheduling called processor sharing. A process switch occurred after each instruction,
so instruction 1 came from process 1, instruction 2 came from process 2, etc. The process switching was done by special
hardware, and the overhead was zero. If a process needed T sec to complete in the absence of competition, how much time
would it need if processor sharing was used with n processes?
tanenbaum operating-system process-and-threads process-synchronization descriptive
9.47.27 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 39 (Page No. 177)
https://gateoverflow.in/324547
Consider the following piece of C code:
void main( ) {
fork( );
fork( );
exit( );
How many child processes are created upon execution of this program?
9.47.28 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 40 (Page No. 177)
https://gateoverflow.in/324548
Round-robin schedulers normally maintain a list of all runnable processes, with each process
occurring exactly once in the list. What would happen if a process occurred twice in the list? Can you think of any
reason for allowing this?
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.29 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 41 (Page No. 177)
https://gateoverflow.in/324550
Can a measure of whether a process is likely to be CPU bound or I/O bound be determined by
analyzing source code? How can this be determined at run time?
tanenbaum operating-system process-and-threads process descriptive
9.47.30 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 44 (Page No. 177)
https://gateoverflow.in/324553
Five jobs are waiting to be run. Their expected run times are 9, 6, 3, 5, and X . In what order
should they be run to minimize average response time? (Your answer will depend on X. )
9.47.31 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 45 (Page No. 177 - 178)
https://gateoverflow.in/324554
Five batch jobs. A through E, arrive at a computer center at almost the same time. They have
estimated running times of 10, 6, 2, 4, and 8 minutes. Their (externally determined) priorities are 3, 5, 2, 1, and 4,
respectively, with 5 being the highest priority. For each of the following scheduling algorithms, determine the mean
process turnaround time. Ignore process switching overhead.
a. Round robin. b. Priority scheduling.
c. First-come, first-served (run in order 10, 6, 2, 4, 8). d. Shortest job first.
F o r (a), assume that the system is multiprogrammed, and
that each job gets its fair share of the CPU. For (b) through (d), assume that only one job at a time runs, until it finishes. All
jobs are completely CPU bound.
9.47.32 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 46 (Page No. 178)
https://gateoverflow.in/324555
A process running on CTSS needs 30 quanta to complete. How many times must it be swapped
in, including the very first time (before it has run at all)?
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.33 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 47 (Page No. 178)
https://gateoverflow.in/324557
Consider a real-time system with two voice calls of periodicity 5 msec each with CPU time per
call of 1 msec, and one video stream of periodicity 33 ms with CPU time per call of 11 msec. Is this system
schedulable?
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.34 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 48 (Page No. 178)
https://gateoverflow.in/324558
For the above problem, can another video stream be added and have the system still be
schedulable?
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.35 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 49 (Page No. 178)
https://gateoverflow.in/324559
The aging algorithm with a = 1/2 is being used to predict run times. The previous four runs,
from oldest to most recent, are 40, 20, 40, and 15 msec. What is the prediction of the next time?
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.36 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 5 (Page No. 174)
https://gateoverflow.in/324481
A computer system has enough room to hold five programs in its main memory. These programs
are idle waiting for I/O half the time. What fraction of the CPU time is wasted?
tanenbaum operating-system process-and-threads descriptive
9.47.37 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 50 (Page No. 178)
https://gateoverflow.in/324560
A soft real-time system has four periodic events with periods of 50, 100, 200, and 250 msec
each. Suppose that the four events require 35, 20, 10, and x msec of CPU time, respectively. What is the largest value
of x for which the system is schedulable?
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.38 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 51 (Page No. 178)
https://gateoverflow.in/324561
In the dining philosophers problem, let the following protocol be used: An even-numbered
philosopher always picks up his left fork before picking up his right fork; an odd-numbered philosopher always picks
up his right fork before picking up his left fork. Will this protocol guarantee deadlock-free operation?
tanenbaum operating-system process-and-threads deadlock descriptive
9.47.39 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 52 (Page No. 178)
https://gateoverflow.in/324562
A real-time system needs to handle two voice calls that each run every 6 msec and consume 1
msec of CPU time per burst, plus one video at 25 frames/sec, with each frame requiring 20 msec of CPU time. Is this
system schedulable?
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.40 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 53 (Page No. 178)
https://gateoverflow.in/324565
Consider a system in which it is desired to separate policy and mechanism for the scheduling of
kernel threads. Propose a means of achieving this goal.
tanenbaum operating-system process-and-threads process-scheduling threads descriptive
9.47.41 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 55 (Page No. 178)
https://gateoverflow.in/324567
Consider the procedure put forks in Fig. 2 − 47. Suppose that the variable state[i] was set to
THINKING after the two calls to test, rather than before. How would this change affect the solution?
tanenbaum operating-system process-and-threads descriptive
9.47.42 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 56 (Page No. 178)
https://gateoverflow.in/324568
The readers and writers problem can be formulated in several ways with regard to which
category of processes can be started when. Carefully describe three different variations of the problem, each one
favoring (or not favoring) some category of processes. For each variation, specify what happens when a reader or a writer
becomes ready to access the database, and what happens when a process is finished.
tanenbaum operating-system process-and-threads process-synchronization descriptive
9.47.43 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 57 (Page No. 178 - 179)
https://gateoverflow.in/324569
Write a shell script that produces a file of sequential numbers by reading the last number in the
file, adding 1 to it, and then appending it to the file. Run one instance of the script in the background and one in the
foreground, each accessing the same file. How long does it take before a race condition manifests itself? What is the
critical region? Modify the script to prevent the race.
9.47.44 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 58 (Page No. 179)
https://gateoverflow.in/324570
Assume that you have an operating system that provides semaphores. Implement a message
system. Write the procedures for sending and receiving messages.
tanenbaum operating-system process-and-threads semaphores descriptive
9.47.45 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 6 (Page No. 174)
https://gateoverflow.in/324482
A computer has 4 GB of RAM of which the operating system occupies 512 MB. The processes
are all 256 MB (for simplicity) and have the same characteristics. If the goal is 99% CPU utilization, what is the
maximum I/O wait that can be tolerated?
tanenbaum operating-system process-and-threads descriptive
9.47.46 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 60 (Page No. 179)
https://gateoverflow.in/324572
Suppose that a university wants to show off how politically correct it is by applying the U.S.
Supreme Court’s ‘‘Separate but equal is inherently unequal’’ doctrine to gender as well as race, ending its long-
standing practice of gender-segregated bathrooms on campus. However, as a concession to tradition, it decrees that when a
woman is in a bathroom, other women may enter, but no men, and vice versa. A sign with a sliding marker on the door of each
bathroom indicates which of three possible states it is currently in:
Empty
Women present
Men present
In some programming language you like, write the following procedures: woman_ wants_to_enter, man_wants_to_enter,
woman_leaves, man_leaves. You may use whatever counters and synchronization techniques you like.
9.47.47 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 61 (Page No. 179)
https://gateoverflow.in/324573
Rewrite the program of Fig. 2 − 23 to handle more than two processes.
9.47.48 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 62 (Page No. 179)
https://gateoverflow.in/324574
Write a producer-consumer problem that uses threads and shares a common buffer. However, do
not use semaphores or any other synchronization primitives to guard the shared data structures. Just let each thread
access them when it wants to. Use sleep and wakeup to handle the full and empty conditions. See how long it takes for a fatal
race condition to occur. For example, you might have the producer print a number once in a while. Do not print more than one
number every minute because the I/O could affect the race conditions.
tanenbaum operating-system process-and-threads semaphores process-synchronization descriptive
9.47.49 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 63 (Page No. 179)
https://gateoverflow.in/324575
A process can be put into a round-robin queue more than once to give it a higher priority.
Running multiple instances of a program each working on a different part of a data pool can have the same effect. First
write a program that tests a list of numbers for primality. Then devise a method to allow multiple instances of the program to
run at once in such a way that no two instances of the program will work on the same number. Can you in fact get through the
list faster by running multiple copies of the program? Note that your results will depend upon what else your computer is
doing; on a personal computer running only instances of this program you would not expect an improvement, but on a system
with other processes, you should be able to grab a bigger share of the CPU this way.
tanenbaum operating-system process-and-threads process-scheduling descriptive
9.47.50 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 65 (Page No. 180)
https://gateoverflow.in/324577
Implement a program to count the frequency of words in a text file. The text file is partitioned
into N segments. Each segment is processed by a separate thread that outputs the intermediate frequency count for its
segment. The main process waits until all the threads complete; then it computes the consolidated word-frequency data based
on the individual threads’ output.
tanenbaum operating-system process-and-threads descriptive
9.47.51 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 7 (Page No. 174)
https://gateoverflow.in/324483
Multiple jobs can run in parallel and finish faster than if they had run sequentially. Suppose that
two jobs, each needing 20 minutes of CPU time, start simultaneously. How long will the last one take to complete if
they run sequentially? How long if they run in parallel? Assume 50% I/O wait.
tanenbaum operating-system process-and-threads descriptive
9.47.52 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 8 (Page No. 174)
https://gateoverflow.in/324484
Consider a multiprogrammed system with degree of 6 (i.e., six programs in memory at the same
time). Assume that each process spends 40% of its time waiting for I/O. What will be the CPU utilization?
tanenbaum operating-system process-and-threads descriptive
9.47.53 Process And Threads: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 9 (Page No. 174)
https://gateoverflow.in/324485
Assume that you are trying to download a large 2-GB file from the Internet. The file is available
from a set of mirror servers, each of which can deliver a subset of the file’s bytes; assume that a given request specifies
the starting and ending bytes of the file. Explain how you might use threads to improve the download time.
tanenbaum operating-system process-and-threads threads descriptive
9.48.1 Program: Galvin Edition 9 Exercise 13 Question 17 (Page No. 620) https://gateoverflow.in/307137
9.48.2 Program: Galvin Edition 9 Exercise 13 Question 18 (Page No. 620) https://gateoverflow.in/307138
9.49.1 Race Conditions: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 37 (Page No. 177)
https://gateoverflow.in/324545
Suppose that we have a message-passing system using mailboxes. When sending to a full
mailbox or trying to receive from an empty one, a process does not block. Instead, it gets an error code back. The
process responds to the error code by just trying again, over and over, until it succeeds. Does this scheme lead to race
conditions?
tanenbaum operating-system process-and-threads race-conditions descriptive
9.50 Resource Allocation (2)
9.50.1 Resource Allocation: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 43 (Page No. 470)
https://gateoverflow.in/325123
Write a program that detects if there is a deadlock in the system by using a resource allocation
graph. Your program should read from a file the following inputs: the number of processes and the number of
resources. For each process if should read four numbers: the number of resources it is currently holding, the IDs of resources it
is holding, the number of resources it is currently requesting, the IDs of resources it is requesting. The output of program
should indicate if there is a deadlock in the system. In case there is, the program should print out the identities of all processes
that are deadlocked.
tanenbaum operating-system deadlock resource-allocation descriptive
9.50.2 Resource Allocation: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 9 (Page No. 466)
https://gateoverflow.in/325075
Fig. 6-3 shows the concept of a resource graph. Do illegal graphs exist, that is, graphs that
structurally violate the model we have used of resource usage? If so, give an example of one.
9.51.1 Round Robin: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 42 (Page No. 177)
https://gateoverflow.in/324551
Explain how time quantum value and context switching time affect each other, in a round-robin
scheduling algorithm.
tanenbaum operating-system process-and-threads context-switch process-scheduling round-robin descriptive
9.51.2 Round Robin: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 43 (Page No. 177)
https://gateoverflow.in/324552
Measurements of a certain system have shown that the average process runs for a time T before
blocking on I /O . A process switch requires a time S , which is effectively wasted (overhead). For round-robin
scheduling with quantum Q, give a formula for the CPU efficiency for each of the following:
9.52.1 Segmentation: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 45 (Page No. 259)
https://gateoverflow.in/324698
Explain the difference between internal fragmentation and external fragmentation. Which one
occurs in paging systems? Which one occurs in systems using pure segmentation?
tanenbaum operating-system memory-management paging fragmentation segmentation descriptive
9.52.2 Segmentation: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 46 (Page No. 259)
https://gateoverflow.in/324699
When segmentation and paging are both being used, as in MULTICS, first the segment
descriptor must be looked up, then the page descriptor. Does the TLB also work this way, with two levels of lookup?
tanenbaum operating-system memory-management paging segmentation descriptive
9.53.1 Semaphores: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 39 (Page No. 469)
https://gateoverflow.in/325118
A student majoring in anthropology and minoring in computer science has embarked on a
research project to see if African baboons can be taught about deadlocks. He locates a deep canyon and fastens a rope
across it, so the baboons can cross hand-overhand. Several baboons can cross at the same time, provided that they are all going
in the same direction. If eastward-moving and westward-moving baboons ever get onto the rope at the same time, a deadlock
will result (the baboons will get stuck in the middle) because it is impossible for one baboon to climb over another one while
suspended over the canyon. If a baboon wants to cross the canyon, he must check to see that no other baboon is currently
crossing in the opposite direction. Write a program using semaphores that avoids deadlock. Do not worry about a series of
eastward-moving baboons holding up the westward-moving baboons indefinitely.
tanenbaum operating-system deadlock semaphores descriptive
9.54.1 Shared System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 35 (Page No. 83 - 84)
https://gateoverflow.in/324360
If you have a personal UNIX-like system (Linux, MINIX 3, FreeBSD, etc.) available that you
can safely crash and reboot, write a shell script that attempts to create an unlimited number of child processes and
observe what happens. Before running the experiment, type sync to the shell to flush the file system buffers to disk to avoid
ruining the file system. You can also do the experiment safely in a virtual machine.
Note: Do not try this on a shared system without first getting permission from the system administrator. The consequences will
be instantly obvious so you are likely to be caught and sanctions may follow.
9.55.1 Starvation: Andrew S. Tanenbaum (OS) Edition 4 Exercise 6 Question 40 (Page No. 469)
https://gateoverflow.in/325119
Repeat the previous problem, but now avoid starvation. When a baboon that wants to cross to the
east arrives at the rope and finds baboons crossing to the west, he waits until the rope is empty, but no more westward-
moving baboons are allowed to start until at least one baboon has crossed the other way.
tanenbaum operating-system deadlock starvation descriptive
9.56.1 System Call: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 16 (Page No. 82)
https://gateoverflow.in/324339
When a user program makes a system call to read or write a disk file, it provides an indication of
which file it wants, a pointer to the data buffer, and the count. Control is then transferred to the operating system, which
calls the appropriate driver. Suppose that the driver starts the disk and terminates until an interrupt occurs. In the case of
reading from the disk, obviously the caller will have to be blocked (because there are no data for it). What about the case of
writing to the disk? Need the caller be blocked awaiting completion of the disk transfer?
tanenbaum operating-system introduction system-call interrupts descriptive
9.56.2 System Call: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 20 (Page No. 82)
https://gateoverflow.in/324343
For each of the following system calls, give a condition that causes it to fail: fork, exec, and
unlink.
tanenbaum operating-system introduction system-call descriptive
9.56.3 System Call: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 23 (Page No. 82 - 83)
https://gateoverflow.in/324346
A file whose file descriptor is fd contains the following sequence of bytes
: 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5. The following system calls are made:
lseek(fd, 3, SEEK SET);
read(fd, &buffer, 4);
where the lseek call makes a seek to byte 3 of the file. What does buffer contain after the read has completed?
9.56.4 System Call: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 28 (Page No. 83)
https://gateoverflow.in/324352
To a programmer, a system call looks like any other call to a library procedure. Is it important
that a programmer know which library procedures result in system calls? Under what circumstances and why?
tanenbaum operating-system introduction system-call descriptive
9.56.5 System Call: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 29 (Page No. 83)
https://gateoverflow.in/324353
Figure 1 − 23 shows that a number of UNIX system calls have no Win32 API equivalents. For
each of the calls listed as having no Win32 equivalent, what are the consequences for a programmer of converting a
UNIX program to run under Windows?
9.56.6 System Call: Andrew S. Tanenbaum (OS) Edition 4 Exercise 2 Question 4 (Page No. 174)
https://gateoverflow.in/324480
When an interrupt or a system call transfers control to the operating system, a kernel stack area
separate from the stack of the interrupted process is generally used. Why?
tanenbaum operating-system process-and-threads system-call threads descriptive
9.56.7 System Call: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 9 (Page No. 333)
https://gateoverflow.in/324722
In UNIX and Windows, random access is done by having a special system call that moves the
‘‘current position’’ pointer associated with a file to a given byte in the file. Propose an alternative way to do random
access without having this system call.
tanenbaum operating-system file-system system-call descriptive
9.57.2 Threads: Galvin Edition 9 Exercise 4 Question 1 (Page No. 191) https://gateoverflow.in/306763
Provide two programming examples in which multithreading provides better performance than a single-threaded
solution.
galvin operating-system threads descriptive
9.57.3 Threads: Galvin Edition 9 Exercise 4 Question 11 (Page No. 192) https://gateoverflow.in/306775
9.57.4 Threads: Galvin Edition 9 Exercise 4 Question 12 (Page No. 192) https://gateoverflow.in/306776
Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two
processing cores and (b) four processing cores.
galvin operating-system threads descriptive
9.57.5 Threads: Galvin Edition 9 Exercise 4 Question 14 (Page No. 192-193) https://gateoverflow.in/306778
A system with two dual-core processors has four processors available for scheduling. A CPU-intensive application is
running on this system. All input is performed at program start-up, when a single file must be opened. Similarly, all
output is performed just before the program terminates, when the program results must be written to a single file. Between
startup and termination, the program is entirely CPU bound.Your task is to improve the performance of this application by
multithreading it. The application runs on a system that uses the one-to-one threading model (each user thread maps to a kernel
thread).
• How many threads will you create to perform the input and output ? Explain.
• How many threads will you create for the CPU-intensive portion of the application ? Explain.
galvin operating-system threads descriptive
9.57.6 Threads: Galvin Edition 9 Exercise 4 Question 15 (Page No. 193) https://gateoverflow.in/306779
pid t pid;
pid = fork();
if (pid == 0) { /* child process */
fork();
thread create( . . .);
}
fork();
9.57.7 Threads: Galvin Edition 9 Exercise 4 Question 2 (Page No. 191) https://gateoverflow.in/306764
What are two differences between user-level threads and kernel-level threads ? Under what circumstances is one type
better than the other ?
galvin operating-system threads descriptive
9.57.8 Threads: Galvin Edition 9 Exercise 4 Question 3 (Page No. 191) https://gateoverflow.in/306766
Describe the actions taken by a kernel to context-switch between kernel level threads.
galvin operating-system threads descriptive
9.57.9 Threads: Galvin Edition 9 Exercise 4 Question 4 (Page No. 191) https://gateoverflow.in/306768
What resources are used when a thread is created ? How do they differ from those used when a process is created ?
galvin operating-system threads descriptive
9.57.10 Threads: Galvin Edition 9 Exercise 4 Question 5 (Page No. 192) https://gateoverflow.in/306769
Assume that an operating system maps user-level threads to the kernel using the many-to-many model and that the
mapping is done through LWPs(Light Weight Processes). Furthermore, the system allows developers to create real-
time threads for use in real-time systems. Is it necessary to bind a real-time thread to an LWP(Light Weight Process) ?Explain.
galvin operating-system threads descriptive
9.57.11 Threads: Galvin Edition 9 Exercise 4 Question 6 (Page No. 192) https://gateoverflow.in/306770
Provide two programming examples in which multithreading does not provide better performance than a single-
threaded solution.
galvin operating-system threads descriptive
9.57.12 Threads: Galvin Edition 9 Exercise 4 Question 7 (Page No. 192) https://gateoverflow.in/306771
Under what circumstances does a multithreaded solution using multiple kernel threads provide better performance than
a single-threaded solution on a single-processor system ?
galvin operating-system threads descriptive
9.57.13 Threads: Galvin Edition 9 Exercise 4 Question 8 (Page No. 192) https://gateoverflow.in/306772
Which of the following components of program state are shared across threads in a multithreaded process ?
a. Register values
b. Heap memory
c. Global variables
d. Stack memory
galvin operating-system threads
9.57.14 Threads: Galvin Edition 9 Exercise 4 Question 9 (Page No. 192) https://gateoverflow.in/306774
Can a multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system
than on a single processor system ? Explain.
galvin operating-system threads descriptive
9.57.15 Threads: Galvin Edition 9 Exercise 9 Question 36 (Page No. 456) https://gateoverflow.in/307199
A system provides support for user-level and kernel-level threads. The mapping in this system is one to one (there is a
corresponding kernel thread for each user thread). Does a multithreaded process consist of (a) a working set for the
entire process or (b) a working set for each thread ? Explain
9.58.1 Timesharing System: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 18 (Page No. 82)
https://gateoverflow.in/324341
Why is the process table needed in a timesharing system? Is it also needed in personal computer
systems running UNIX or Windows with a single user?
tanenbaum operating-system introduction timesharing-system descriptive
int X[N];
int step = M; /* M is some predefined constant */
for (int i = 0; i < N; i += step) X[i] = X[i] + 1;
a. If this program is run on a machine with a 4 − KB page size and 64-entry TLB, what values of M and N will cause a
TLB miss for every execution of the inner loop?
b. Would your answer in part (a) be different if the loop were repeated many times? Explain.
9.59.2 Tlb: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 16 (Page No. 255) https://gateoverflow.in/324655
You are given the following data about a virtual memory system:
a. The TLB can hold 1024 entries and can be accessed in 1 clock cycle (1 nsec).
b. A page table entry can be found in 100 clock cycles or 100 nsec.
c. The average page replacement time is 6 msec.
If page references are handled by the TLB 99% of the time, and only 0.01% lead to a page fault, what is the effective
address-translation time?
9.59.3 Tlb: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 22 (Page No. 256) https://gateoverflow.in/324661
A computer whose processes have 1024 pages in their address spaces keeps its page tables in memory. The overhead
required for reading a word from the page table is 5 nsec. To reduce this overhead, the computer has a TLB, which
holds 32 (virtual page, physical page frame) pairs, and can do a lookup in 1 nsec. What hit rate is needed to reduce the mean
overhead to 2 nsec?
tanenbaum operating-system memory-management paging tlb descriptive
9.59.4 Tlb: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 23 (Page No. 256) https://gateoverflow.in/324662
How can the associative memory device needed for a TLB be implemented in hardware, and what are the implications
of such a design for expandability?
tanenbaum operating-system memory-management paging tlb descriptive
9.59.5 Tlb: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 53 (Page No. 261) https://gateoverflow.in/324710
Write a program that demonstrates the effect of TLB misses on the effective memory access time by measuring the
per-access time it takes to stride through a large array.
a. Explain the main concepts behind the program, and describe what you expect the output to show for some practical virtual
memory architecture.
b. Run the program on some computer and explain how well the data fit your expectations.
c. Repeat part (b) but for an older computer with a different architecture and explain any major differences in the output.
9.59.6 Tlb: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 55 (Page No. 261 - 262)
https://gateoverflow.in/324712
Write a program that can be used to compare the effectiveness of adding a tag field to TLB
entries when control is toggled between two programs. The tag field is used to effectively label each entry with the
process id. Note that a nontagged TLB can be simulated by requiring that all TLB entries have the same tag at any one time.
The inputs will be:
9.59.7 Tlb: Galvin Edition 9 Exercise 9 Question 14 (Page No. 452) https://gateoverflow.in/307089
Assume that a program has just referenced an address in virtual memory. Describe a scenario in which each of the
following can occur. (If no such scenario can occur, explain why.)
9.59.8 Tlb: Galvin Edition 9 Exercise 9 Question 15 (Page No. 452) https://gateoverflow.in/307091
A simplified view of thread states is Ready, Running, and Blocked,where a thread is either ready and waiting to be
scheduled, is running on the processor, or is blocked (for example, waiting for I/O). This is illustrated in Figure 9.31.
Assuming a thread is in the Running state, answer the following questions, and explain your answer:
a. Will the thread change state if it incurs a page fault? If so, to what state will it change?
b. Will the thread change state if it generates a TLB miss that is resolved in the page table ? If so, to what state will it change?
c. Will the thread change state if an address reference is resolved in the page table? If so, to what state will it change?
9.60.1 Trap Instruction: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 17 (Page No. 82)
https://gateoverflow.in/324340
What is a trap instruction? Explain its use in operating systems.
tanenbaum operating-system introduction trap-instruction descriptive
9.61.1 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 36 (Page No. 84) https://gateoverflow.in/324359
Examine and try to interpret the contents of a UNIX-like or Windows directory with a tool like the UNIX od program.
(Hint: How you do this will depend upon what the OS allows. One trick that may work is to create a directory on a
USB stick with one operating system and then read the raw device data using a different operating system that allows such
access.)
tanenbaum operating-system introduction unix descriptive
9.61.2 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 28 (Page No. 335) https://gateoverflow.in/324776
We discussed making incremental dumps in some detail in the text. In Windows it is easy to tell when to dump a file
because every file has an archive bit. This bit is missing in UNIX. How do UNIX backup programs know which
files to dump?
tanenbaum operating-system file-system unix descriptive
9.61.3 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 3 (Page No. 333) https://gateoverflow.in/324716
In early UNIX systems, executable files (a.out files) began with a very specific magic number, not one chosen at
random. These files began with a header, followed by the text and data segments. Why do you think a very specific
number was chosen for executable files, whereas other file types had a more-or-less random magic number as the first word?
tanenbaum operating-system file-system unix descriptive
9.61.4 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 30 (Page No. 335) https://gateoverflow.in/324778
It has been suggested that the first part of each UNIX file be kept in the same disk block as its i-node. What good would
this do?
tanenbaum operating-system file-system unix descriptive
9.61.5 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 4 (Page No. 333) https://gateoverflow.in/324717
Is the open system call in UNIX absolutely essential? What would the consequences be of not having it?
tanenbaum operating-system file-system unix descriptive
9.61.6 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 45 (Page No. 336) https://gateoverflow.in/324799
Write a program that scans all directories in a UNIX file system and finds and locates all i-nodes with a hard link
count of two or more. For each such file, it lists together all file names that point to the file.
tanenbaum operating-system file-system disks unix descriptive
9.61.7 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 46 (Page No. 336) https://gateoverflow.in/324801
Write a new version of the UNIX ls program. This version takes as an argument one or more directory names and for
each directory lists all the files in that directory, one line per file. Each field should be formatted in a reasonable way
given its type. List only the first disk address, if any.
tanenbaum operating-system file-system unix descriptive
9.61.8 Unix: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 47 (Page No. 336) https://gateoverflow.in/324803
Implement a program to measure the impact of application-level buffer sizes on read time. This involves writing to and
reading from a large file (say, 2 GB). Vary the application buffer size (say, from 64 bytes to 4 KB). Use timing
measurement routines (such as gettimeofday and getitimer on UNIX) to measure the time taken for different buffer sizes.
Analyze the results and report your findings: does buffer size make a difference to the overall write time and per-write time?
9.62.1 Virtual Address Space: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 12 (Page No. 255)
https://gateoverflow.in/324651
The amount of disk space that must be available for page storage is related to the maximum
number of processes, n, the number of bytes in the virtual address space, v, and the number of bytes of RAM, r. Give
an expression for the worst-case disk-space requirements. How realistic is this amount?
tanenbaum operating-system memory-management virtual-address-space descriptive
9.63.1 Virtual Machines: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 32 (Page No. 83)
https://gateoverflow.in/324356
Virtual machines have become very popular for a variety of reasons. Nevertheless, they have
some downsides. Name one.
tanenbaum operating-system introduction virtual-machines descriptive
9.64.1 Virtual Memory: Andrew S. Tanenbaum (OS) Edition 4 Exercise 1 Question 15 (Page No. 82)
https://gateoverflow.in/324338
Consider a computer system that has cache memory, main memory (RAM) and disk, and an
operating system that uses virtual memory. It takes 1 nsec to access a word from the cache, 10 nsec to access a word from the
RAM, and 10 ms to access a word from the disk. If the cache hit rate is 95% and main memory hit rate (after a cache miss) is
99%, what is the average time to access a word?
tanenbaum operating-system virtual-memory descriptive
9.64.2 Virtual Memory: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 6 (Page No. 254)
https://gateoverflow.in/324645
For each of the following decimal virtual addresses, compute the virtual page number and offset
for a 4 − KB page and for an 8KB page: 20000, 32768, 60000.
tanenbaum operating-system memory-management virtual-memory descriptive
9.64.3 Virtual Memory: Andrew S. Tanenbaum (OS) Edition 4 Exercise 3 Question 8 (Page No. 254)
https://gateoverflow.in/324647
The Intel 8086 processor did not have an MMU or support virtual memory. Nevertheless, some
companies sold systems that contained an unmodified 8086 CPU and did paging. Make an educated guess as to how
they did it. (Hint: Think about the logical location of the MMU.)
tanenbaum operating-system memory-management virtual-memory descriptive
9.64.4 Virtual Memory: Galvin Edition 9 Exercise 9 Question 1 (Page No. 449) https://gateoverflow.in/307067
Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault
occurs.
galvin operating-system virtual-memory descriptive
9.64.5 Virtual Memory: Galvin Edition 9 Exercise 9 Question 10 (Page No. 451) https://gateoverflow.in/307077
You have devised a new page-replacement algorithm that you think may be optimal. In some contorted test cases,
Belady’s anomaly occurs. Is the new algorithm optimal ? Explain your answer.
galvin operating-system virtual-memory descriptive
9.64.6 Virtual Memory: Galvin Edition 9 Exercise 9 Question 11 (Page No. 451) https://gateoverflow.in/307086
Segmentation is similar to paging but uses variable-sized “pages.” Define two segment-replacement algorithms, one
based on the FIFO page replacement scheme and the other on the LRU page-replacement scheme. Remember that since
segments are not the same size, the segment that is chosen for replacement may be too small to leave enough consecutive
locations for the needed segment. Consider strategies for systems where segments cannot be relocated and strategies for
systems where they can.
galvin operating-system virtual-memory descriptive
9.64.7 Virtual Memory: Galvin Edition 9 Exercise 9 Question 12 (Page No. 451) https://gateoverflow.in/307087
Consider a demand-paged computer system where the degree of multiprogramming is currently fixed at four. The
system was recently measured to determine utilization of the CPU and the paging disk. Three alternative results are
shown below. For each case, what is happening? Can the degree of multiprogramming be increased to increase the CPU
utilization? Is the paging helping?
a. CP U utilization 13 percent; disk utilization 97 percent
b. CP U utilization 87 percent; disk utilization 3 percent
c.CP U utilization 13 percent; disk utilization 3 percent
galvin operating-system virtual-memory descriptive
9.64.8 Virtual Memory: Galvin Edition 9 Exercise 9 Question 13 (Page No. 452) https://gateoverflow.in/307088
We have an operating system for a machine that uses base and limit registers, but we have modified the machine to
provide a page table. Can the page tables be set up to simulate base and limit registers ? How can they be, or why can
they not be?
galvin operating-system virtual-memory descriptive
9.64.9 Virtual Memory: Galvin Edition 9 Exercise 9 Question 16 (Page No. 452-453) https://gateoverflow.in/307092
b. Once the working set for a process is loaded into memory, how would you characterize the page-fault rate ?
c. Assume that a process changes its locality and the size of the new working set is too large to be stored in available free
memory. Identify some options system designers could choose from to handle this situation.
galvin operating-system virtual-memory descriptive
9.64.10 Virtual Memory: Galvin Edition 9 Exercise 9 Question 17 (Page No. 453) https://gateoverflow.in/307093
What is the copy-on-write feature, and under what circumstances is its use beneficial ? What hardware support is
required to implement this feature ?
galvin operating-system virtual-memory descriptive
9.64.11 Virtual Memory: Galvin Edition 9 Exercise 9 Question 18 (Page No. 453) https://gateoverflow.in/307094
A certain computer provides its users with a virtual memory space of 232 bytes. The computer has 222 bytes of physical
memory. The virtual memory is implemented by paging, and the page size is 4, 096 bytes. A user process generates the
virtual address 11123456. Explain how the system establishes the corresponding physical location. Distinguish between
software and hardware operations.
galvin operating-system virtual-memory descriptive
9.64.12 Virtual Memory: Galvin Edition 9 Exercise 9 Question 2 (Page No. 449) https://gateoverflow.in/307068
Assume that you have a page-reference string for a process with m frames (initially all empty). The page-reference
string has length p, and n distinct page numbers occur in it. Answer these questions for any page-replacement
algorithms:
9.64.13 Virtual Memory: Galvin Edition 9 Exercise 9 Question 23 (Page No. 454) https://gateoverflow.in/307098
Assume that you are monitoring the rate at which the pointer in the clock algorithm moves. (The pointer indicates the
candidate page for replacement.) What can you say about the system if you notice the following behavior:
9.64.14 Virtual Memory: Galvin Edition 9 Exercise 9 Question 24 (Page No. 454) https://gateoverflow.in/307099
Discuss situations in which the least frequently used (LFU ) page replacement algorithm generates fewer page faults
than the least recently used (LRU ) page-replacement algorithm. Also discuss under what circumstances the opposite
holds.
galvin operating-system virtual-memory descriptive
9.64.15 Virtual Memory: Galvin Edition 9 Exercise 9 Question 25 (Page No. 454) https://gateoverflow.in/307100
Discuss situations in which the most frequently used (MFU ) page replacement algorithm generates fewer page faults
than the least recently used (LRU ) page-replacement algorithm. Also discuss under what circumstances the opposite
holds.
galvin operating-system virtual-memory descriptive
9.64.16 Virtual Memory: Galvin Edition 9 Exercise 9 Question 26 (Page No. 455) https://gateoverflow.in/307102
The VAX/VMS system uses a FIFO replacement algorithm for resident pages and a free-frame pool of recently used
pages. Assume that the free-frame pool is managed using the LRU replacement policy. Answer the following questions:
a. If a page fault occurs and the page does not exist in the free-frame pool, how is free space generated for the newly requested
page ?
b. If a page fault occurs and the page exists in the free-frame pool, how is the resident page set and the free-frame pool
managed to make space for the requested page ?
c. What does the system degenerate to if the number of resident pages is set to one ?
d. What does the system degenerate to if the number of pages in the free-frame pool is zero?
galvin operating-system virtual-memory descriptive
9.64.17 Virtual Memory: Galvin Edition 9 Exercise 9 Question 27 (Page No. 455) https://gateoverflow.in/307103
9.64.18 Virtual Memory: Galvin Edition 9 Exercise 9 Question 28 (Page No. 455) https://gateoverflow.in/307104
Suppose that a machine provides instructions that can access memory locations using the one-level indirect addressing
scheme. What sequence of page faults is incurred when all of the pages of a program are currently nonresident and the
first instruction of the program is an indirect memory-load operation ? What happens when the operating system is using a per-
process frame allocation technique and only two pages are allocated to this process ?
galvin operating-system virtual-memory descriptive
9.64.19 Virtual Memory: Galvin Edition 9 Exercise 9 Question 29 (Page No. 455) https://gateoverflow.in/307105
Suppose that your replacement policy (in a paged system) is to examine each page regularly and to discard that page if
it has not been used since the last examination. What would you gain and what would you lose by using this policy
rather than LRU or second-chance replacement ?
galvin operating-system virtual-memory descriptive
9.64.20 Virtual Memory: Galvin Edition 9 Exercise 9 Question 30 (Page No. 455) https://gateoverflow.in/307188
A page-replacement algorithm should minimize the number of page faults. We can achieve this minimization by
distributing heavily used pages evenly over all of memory, rather than having them compete for a small number of page
frames. We can associate with each page frame a counter of the number of pages associated with that frame. Then,to replace a
page, we can search for the page frame with the smallest counter
a. Define a page-replacement algorithm using this basic idea. Specifically address these problems:
i. What is the initial value of the counters ?
ii. When are counters increased ?
iii. When are counters decreased ?
iv. How is the page to be replaced selected ?
b. How many page faults occur for your algorithm for the following reference string with four page frames ?
1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 8, 9, 7, 8, 9, 5, 4, 5, 4, 2.
c. What is the minimum number of page faults for an optimal page replacement strategy for the reference string in part b with
four page frames?
galvin operating-system virtual-memory descriptive
9.64.21 Virtual Memory: Galvin Edition 9 Exercise 9 Question 31 (Page No. 455) https://gateoverflow.in/307189
Consider a demand-paging system with a paging disk that has an average access and transfer time of 20 milliseconds.
Addresses are translated through a page table in main memory, with an access time of 1 microsecond per memory
access. Thus, each memory reference through the page table takes two accesses. To improve this time, we have added an
associative memory that reduces access time to one memory reference if the page-table entry is in the associative memory.
Assume that 80 percent of the accesses are in the associative memory and that, of those remaining, 10 percent (or 2 percent of
the total) cause page faults. What is the effective memory access time?
galvin operating-system virtual-memory descriptive
9.64.22 Virtual Memory: Galvin Edition 9 Exercise 9 Question 32 (Page No. 455) https://gateoverflow.in/307192
What is the cause of thrashing ? How does the system detect thrashing ? Once it detects thrashing, what can the system
do to eliminate this problem ?
galvin operating-system virtual-memory descriptive
9.64.23 Virtual Memory: Galvin Edition 9 Exercise 9 Question 33 (Page No. 455) https://gateoverflow.in/307193
Is it possible for a process to have two working sets, one representing data and another representing code ? Explain.
galvin operating-system virtual-memory descriptive
9.64.24 Virtual Memory: Galvin Edition 9 Exercise 9 Question 34 (Page No. 455) https://gateoverflow.in/307195
Consider the parameter△ used to define the working-set window in the working-set model. When △ is set to a small
value, what is the effect on the page-fault frequency and the number of active (non suspended) processes currently
executing in the system ? What is the effect when △ is set to a very high value ?
galvin operating-system virtual-memory descriptive
9.64.25 Virtual Memory: Galvin Edition 9 Exercise 9 Question 37 (Page No. 456) https://gateoverflow.in/307201
The slab-allocation algorithm uses a separate cache for each different object type. Assuming there is one cache per
object type, explain why this scheme doesn’t scale well with multiple CPUs. What could be done to address this
scalability issue?
galvin operating-system virtual-memory descriptive
9.64.26 Virtual Memory: Galvin Edition 9 Exercise 9 Question 4 (Page No. 450) https://gateoverflow.in/307069
Consider the following page-replacement algorithms. Rank these algorithms on a five-point scale from “bad” to
“perfect” according to their page-fault rate. Separate those algorithms that suffer from Belady’s anomaly from those
that do not.
a. LRU replacement
b. FIFO replacement
c. Optimal replacement
d. Second-chance replacement
galvin operating-system virtual-memory descriptive
9.64.27 Virtual Memory: Galvin Edition 9 Exercise 9 Question 5 (Page No. 450) https://gateoverflow.in/307070
9.64.28 Virtual Memory: Galvin Edition 9 Exercise 9 Question 6 (Page No. 450) https://gateoverflow.in/307071
An operating system supports a paged virtual memory. The central processor has a cycle time of 1 microsecond. It
costs an additional 1 microsecond to access a page other than the current one. Pages have 1, 000 words, and the paging
device is a drum that rotates at 3, 000 revolutions per minute and transfers 1 million words per second. The following
statistical measurements were obtained from the system:
• One percent of all instructions executed accessed a page other than the current page.
• Of the instructions that accessed another page, 80 percent accessed a page already in memory.
• When a new page was required, the replaced page was modified 50 percent of the time.
Calculate the effective instruction time on this system, assuming that the system is running one process only and that the
processor is idle during drum transfers.
galvin operating-system virtual-memory descriptive
9.64.29 Virtual Memory: Galvin Edition 9 Exercise 9 Question 7 (Page No. 450-451) https://gateoverflow.in/307074
where A[0][0] is at location 200 in a paged memory system with pages of size 200. A small process that manipulates the
matrix resides in page 0 (locations 0 to 199). Thus, every instruction fetch will be from page 0.For three page frames, how
many page faults are generated by the following array-initialization loops? Use LRU replacement, and assume that page frame
1 contains the process and the other two are initially empty.
9.64.30 Virtual Memory: Galvin Edition 9 Exercise 9 Question 8 (Page No. 451) https://gateoverflow.in/307075
•LRU replacement
• FIFO replacement
• Optimal replacement
galvin operating-system virtual-memory
9.64.31 Virtual Memory: Galvin Edition 9 Exercise 9 Question 9 (Page No. 451) https://gateoverflow.in/307076
Suppose that you want to use a paging algorithm that requires a reference bit (such as second-chance replacement or
working-set model), but the hardware does not provide one. Sketch how you could simulate a reference bit even if one
were not provided by the hardware, or explain why it is not possible to do so. If it is possible, calculate what the cost would be.
galvin operating-system virtual-memory
9.65.1 Working Directory: Andrew S. Tanenbaum (OS) Edition 4 Exercise 4 Question 10 (Page No. 333)
https://gateoverflow.in/324723
Consider the directory tree of Fig. 4 − 8. If /usr/jim is the working directory, what is the
absolute path name for the file whose relative path name is ../ast/x?
tanenbaum operating-system file-system working-directory descriptive
Answer Keys
9.1.1 N/A 9.2.1 N/A 9.3.1 N/A 9.4.1 N/A 9.4.2 N/A
9.5.1 N/A 9.5.2 N/A 9.5.3 N/A 9.5.4 N/A 9.5.5 N/A
9.5.6 N/A 9.5.7 N/A 9.5.8 N/A 9.5.9 N/A 9.5.10 N/A
9.5.11 N/A 9.5.12 N/A 9.5.13 Q-Q 9.5.14 Q-Q 9.5.15 Q-Q
9.5.16 Q-Q 9.5.17 Q-Q 9.5.18 N/A 9.5.19 Q-Q 9.5.20 N/A
9.5.21 N/A 9.5.22 N/A 9.5.23 Q-Q 9.5.24 Q-Q 9.6.1 N/A
9.7.1 N/A 9.7.2 N/A 9.7.3 N/A 9.7.4 N/A 9.7.5 N/A
9.7.6 N/A 9.7.7 N/A 9.7.8 N/A 9.7.9 N/A 9.7.10 N/A
9.7.11 N/A 9.7.12 N/A 9.7.13 N/A 9.7.14 N/A 9.7.15 N/A
9.7.16 N/A 9.7.17 N/A 9.7.18 N/A 9.7.19 N/A 9.7.20 N/A
9.7.21 N/A 9.7.22 N/A 9.7.23 N/A 9.7.24 N/A 9.7.25 N/A
9.7.26 N/A 9.7.27 Q-Q 9.7.28 Q-Q 9.7.29 Q-Q 9.7.30 Q-Q
9.7.31 Q-Q 9.7.32 Q-Q 9.7.33 Q-Q 9.7.34 Q-Q 9.7.35 Q-Q
9.7.36 Q-Q 9.7.37 Q-Q 9.8.1 N/A 9.9.1 N/A 9.10.1 N/A
9.11.1 N/A 9.11.2 N/A 9.11.3 N/A 9.11.4 N/A 9.11.5 N/A
9.11.6 N/A 9.11.7 N/A 9.12.1 N/A 9.13.1 N/A 9.13.2 N/A
9.13.3 N/A 9.13.4 N/A 9.13.5 N/A 9.13.6 N/A 9.13.7 N/A
9.13.8 N/A 9.13.9 N/A 9.13.10 N/A 9.13.11 Q-Q 9.13.12 N/A
9.14.1 N/A 9.14.2 N/A 9.15.1 N/A 9.16.1 N/A 9.16.2 N/A
9.16.3 N/A 9.16.4 N/A 9.16.5 N/A 9.16.6 N/A 9.16.7 N/A
9.16.8 N/A 9.16.9 N/A 9.16.10 N/A 9.16.11 N/A 9.16.12 N/A
9.16.13 N/A 9.16.14 N/A 9.16.15 N/A 9.16.16 N/A 9.16.17 N/A
9.16.18 N/A 9.16.19 N/A 9.16.20 N/A 9.16.21 N/A 9.16.22 N/A
9.16.23 N/A 9.16.24 N/A 9.16.25 N/A 9.16.26 N/A 9.16.27 N/A
9.16.28 N/A 9.16.29 N/A 9.16.30 N/A 9.16.31 N/A 9.16.32 N/A
9.16.33 N/A 9.16.34 N/A 9.16.35 Q-Q 9.16.36 N/A 9.16.37 N/A
9.16.38 N/A 9.16.39 N/A 9.16.40 N/A 9.16.41 Q-Q 9.16.42 Q-Q
9.16.43 N/A 9.16.44 N/A 9.16.45 N/A 9.16.46 Q-Q 9.16.47 Q-Q
9.16.48 Q-Q 9.16.49 Q-Q 9.16.50 N/A 9.16.51 N/A 9.16.52 N/A
9.16.53 N/A 9.17.1 N/A 9.18.1 N/A 9.18.2 N/A 9.18.3 N/A
9.18.4 N/A 9.18.5 N/A 9.18.6 N/A 9.18.7 N/A 9.18.8 N/A
9.18.9 N/A 9.18.10 N/A 9.18.11 N/A 9.18.12 N/A 9.18.13 N/A
9.18.14 N/A 9.18.15 N/A 9.18.16 N/A 9.18.17 N/A 9.18.18 N/A
9.18.19 N/A 9.18.20 N/A 9.18.21 N/A 9.18.22 N/A 9.18.23 N/A
9.18.24 N/A 9.18.25 N/A 9.18.26 N/A 9.18.27 N/A 9.18.28 N/A
9.18.29 N/A 9.18.30 N/A 9.18.31 N/A 9.18.32 N/A 9.18.33 N/A
9.18.34 N/A 9.18.35 N/A 9.18.36 N/A 9.18.37 N/A 9.18.38 N/A
9.18.39 Q-Q 9.18.40 N/A 9.18.41 N/A 9.18.42 N/A 9.18.43 N/A
9.18.44 N/A 9.18.45 N/A 9.18.46 N/A 9.18.47 N/A 9.18.48 N/A
9.18.49 N/A 9.18.50 N/A 9.18.51 N/A 9.18.52 N/A 9.18.53 N/A
9.18.54 N/A 9.18.55 N/A 9.18.56 N/A 9.18.57 N/A 9.18.58 N/A
9.18.59 N/A 9.18.60 N/A 9.18.61 N/A 9.18.62 Q-Q 9.18.63 Q-Q
9.18.64 Q-Q 9.18.65 N/A 9.18.66 N/A 9.18.67 N/A 9.18.68 N/A
9.18.69 N/A 9.18.70 N/A 9.18.71 N/A 9.18.72 Q-Q 9.18.73 Q-Q
9.18.74 Q-Q 9.18.75 Q-Q 9.18.76 Q-Q 9.18.77 N/A 9.18.78 N/A
9.18.79 Q-Q 9.18.80 Q-Q 9.18.81 N/A 9.18.82 Q-Q 9.18.83 N/A
9.18.84 Q-Q 9.18.85 Q-Q 9.18.86 N/A 9.18.87 N/A 9.18.88 N/A
9.18.89 N/A 9.18.90 N/A 9.19.1 N/A 9.20.1 N/A 9.21.1 N/A
9.21.2 N/A 9.21.3 N/A 9.21.4 N/A 9.21.5 N/A 9.21.6 N/A
9.21.7 N/A 9.21.8 N/A 9.21.9 N/A 9.21.10 N/A 9.21.11 N/A
9.21.12 N/A 9.21.13 N/A 9.21.14 N/A 9.21.15 N/A 9.21.16 N/A
9.21.17 N/A 9.21.18 N/A 9.21.19 N/A 9.21.20 N/A 9.21.21 N/A
9.21.22 N/A 9.21.23 N/A 9.21.24 N/A 9.21.25 N/A 9.21.26 N/A
9.21.27 N/A 9.21.28 N/A 9.21.29 N/A 9.21.30 N/A 9.21.31 N/A
9.21.32 N/A 9.21.33 N/A 9.21.34 N/A 9.21.35 N/A 9.21.36 N/A
9.21.37 N/A 9.21.38 N/A 9.21.39 N/A 9.21.40 N/A 9.21.41 N/A
9.21.42 N/A 9.21.43 N/A 9.21.44 N/A 9.21.45 N/A 9.21.46 N/A
9.21.47 N/A 9.21.48 N/A 9.21.49 N/A 9.21.50 N/A 9.22.1 N/A
9.23.1 N/A 9.24.1 N/A 9.24.2 N/A 9.24.3 N/A 9.24.4 N/A
9.24.5 N/A 9.24.6 N/A 9.24.7 N/A 9.24.8 N/A 9.24.9 N/A
9.24.10 N/A 9.24.11 N/A 9.24.12 N/A 9.24.13 N/A 9.24.14 N/A
9.24.15 N/A 9.24.16 N/A 9.24.17 N/A 9.24.18 N/A 9.24.19 N/A
9.24.20 N/A 9.24.21 N/A 9.24.22 N/A 9.24.23 N/A 9.24.24 N/A
9.24.25 N/A 9.24.26 N/A 9.24.27 N/A 9.24.28 N/A 9.24.29 N/A
9.24.30 N/A 9.24.31 N/A 9.24.32 N/A 9.24.33 N/A 9.24.34 N/A
9.24.35 N/A 9.24.36 N/A 9.24.37 N/A 9.24.38 N/A 9.24.39 N/A
9.24.40 N/A 9.24.41 N/A 9.24.42 N/A 9.24.43 N/A 9.24.44 N/A
9.24.45 Q-Q 9.24.46 N/A 9.24.47 N/A 9.24.48 N/A 9.24.49 N/A
9.24.50 N/A 9.24.51 N/A 9.24.52 N/A 9.24.53 N/A 9.24.54 N/A
9.24.55 N/A 9.24.56 N/A 9.24.57 N/A 9.24.58 N/A 9.24.59 N/A
9.24.60 N/A 9.24.61 N/A 9.24.62 N/A 9.24.63 N/A 9.24.64 N/A
9.24.65 N/A 9.24.66 N/A 9.24.67 N/A 9.24.68 N/A 9.24.69 N/A
9.24.70 N/A 9.24.71 N/A 9.24.72 N/A 9.24.73 N/A 9.25.1 N/A
9.26.1 N/A 9.26.2 N/A 9.26.3 N/A 9.26.4 N/A 9.26.5 N/A
9.26.6 N/A 9.26.7 N/A 9.26.8 N/A 9.26.9 N/A 9.26.10 N/A
9.26.11 N/A 9.26.12 N/A 9.26.13 N/A 9.26.14 N/A 9.26.15 N/A
9.26.16 N/A 9.26.17 N/A 9.27.1 Q-Q 9.28.1 N/A 9.29.1 N/A
9.30.1 N/A 9.31.1 N/A 9.31.2 N/A 9.31.3 N/A 9.31.4 N/A
9.31.5 N/A 9.32.1 N/A 9.32.2 N/A 9.33.1 N/A 9.34.1 N/A
9.35.1 N/A 9.36.1 N/A 9.37.1 N/A 9.37.2 N/A 9.38.1 N/A
9.38.2 N/A 9.39.1 N/A 9.40.1 N/A 9.40.2 N/A 9.40.3 N/A
9.40.4 N/A 9.40.5 N/A 9.40.6 N/A 9.40.7 N/A 9.40.8 Q-Q
9.40.9 N/A 9.40.10 Q-Q 9.41.1 N/A 9.41.2 N/A 9.41.3 N/A
9.41.4 N/A 9.41.5 N/A 9.41.6 N/A 9.41.7 N/A 9.41.8 N/A
9.41.9 N/A 9.41.10 N/A 9.41.11 N/A 9.41.12 N/A 9.41.13 N/A
9.41.14 N/A 9.42.1 N/A 9.42.2 N/A 9.42.3 N/A 9.42.4 N/A
9.42.5 N/A 9.42.6 N/A 9.43.1 N/A 9.43.2 N/A 9.43.3 N/A
9.43.4 N/A 9.43.5 N/A 9.43.6 N/A 9.43.7 N/A 9.43.8 Q-Q
9.44.1 N/A 9.44.2 N/A 9.45.1 N/A 9.46.1 Q-Q 9.46.2 N/A
9.46.3 N/A 9.46.4 Q-Q 9.46.5 Q-Q 9.46.6 Q-Q 9.46.7 N/A
9.46.8 N/A 9.46.9 Q-Q 9.46.10 N/A 9.46.11 Q-Q 9.46.12 N/A
9.46.13 N/A 9.46.14 N/A 9.46.15 N/A 9.46.16 N/A 9.46.17 N/A
9.46.18 N/A 9.47.1 N/A 9.47.2 N/A 9.47.3 N/A 9.47.4 N/A
9.47.5 N/A 9.47.6 N/A 9.47.7 N/A 9.47.8 N/A 9.47.9 N/A
9.47.10 N/A 9.47.11 N/A 9.47.12 N/A 9.47.13 N/A 9.47.14 N/A
9.47.15 N/A 9.47.16 N/A 9.47.17 N/A 9.47.18 N/A 9.47.19 N/A
9.47.20 N/A 9.47.21 N/A 9.47.22 N/A 9.47.23 N/A 9.47.24 N/A
9.47.25 N/A 9.47.26 N/A 9.47.27 N/A 9.47.28 N/A 9.47.29 N/A
9.47.30 N/A 9.47.31 N/A 9.47.32 N/A 9.47.33 N/A 9.47.34 N/A
9.47.35 N/A 9.47.36 N/A 9.47.37 N/A 9.47.38 N/A 9.47.39 N/A
9.47.40 N/A 9.47.41 N/A 9.47.42 N/A 9.47.43 N/A 9.47.44 N/A
9.47.45 N/A 9.47.46 N/A 9.47.47 N/A 9.47.48 N/A 9.47.49 N/A
9.47.50 N/A 9.47.51 N/A 9.47.52 N/A 9.47.53 N/A 9.48.1 Q-Q
9.48.2 Q-Q 9.49.1 N/A 9.50.1 N/A 9.50.2 N/A 9.51.1 N/A
9.51.2 N/A 9.52.1 N/A 9.52.2 N/A 9.53.1 N/A 9.54.1 N/A
9.55.1 N/A 9.56.1 N/A 9.56.2 N/A 9.56.3 N/A 9.56.4 N/A
9.56.5 N/A 9.56.6 N/A 9.56.7 N/A 9.57.1 N/A 9.57.2 N/A
9.57.3 N/A 9.57.4 N/A 9.57.5 N/A 9.57.6 Q-Q 9.57.7 N/A
9.57.8 N/A 9.57.9 N/A 9.57.10 N/A 9.57.11 N/A 9.57.12 N/A
9.57.13 Q-Q 9.57.14 N/A 9.57.15 N/A 9.58.1 N/A 9.59.1 N/A
9.59.2 N/A 9.59.3 N/A 9.59.4 N/A 9.59.5 N/A 9.59.6 N/A
9.59.7 N/A 9.59.8 N/A 9.60.1 N/A 9.61.1 N/A 9.61.2 N/A
9.61.3 N/A 9.61.4 N/A 9.61.5 N/A 9.61.6 N/A 9.61.7 N/A
9.61.8 N/A 9.62.1 N/A 9.63.1 N/A 9.64.1 N/A 9.64.2 N/A
9.64.3 N/A 9.64.4 N/A 9.64.5 N/A 9.64.6 N/A 9.64.7 N/A
9.64.8 N/A 9.64.9 N/A 9.64.10 N/A 9.64.11 N/A 9.64.12 N/A
9.64.13 N/A 9.64.14 N/A 9.64.15 N/A 9.64.16 N/A 9.64.17 N/A
9.64.18 N/A 9.64.19 N/A 9.64.20 N/A 9.64.21 N/A 9.64.22 N/A
9.64.23 N/A 9.64.24 N/A 9.64.25 N/A 9.64.26 N/A 9.64.27 N/A
9.64.28 N/A 9.64.29 N/A 9.64.30 Q-Q 9.64.31 Q-Q 9.65.1 N/A
10 Theory of Computation (776)
10.1.1 Ambiguous Grammar: Michael Sipser Edition 3 Exercise 2 Question 27 (Page No. 157)
https://gateoverflow.in/311287
10.2.1 Cfg: Michael Sipser Edition 3 Exercise 4 Question 14 (Page No. 211) https://gateoverflow.in/323782
Let Σ = {0, 1} . Show that the problem of determining whether a CFG generates some string in 1∗ is decidable. In
other words, show that {⟨G⟩ ∣ G is a CFG over {0,1} and 1∗ ∩ L(G) ≠ ϕ} is a decidable language.
10.2.2 Cfg: Michael Sipser Edition 3 Exercise 4 Question 15 (Page No. 212) https://gateoverflow.in/323783
Show that the problem of determining whether a CFG generates all strings in 1∗ is decidable. In other words, show that
{⟨G⟩ ∣ G is a CFG over {0,1} and 1∗ ⊆ L(G)} is a decidable language.
michael-sipser theory-of-computation cfg decidability proof
10.2.3 Cfg: Michael Sipser Edition 3 Exercise 4 Question 4 (Page No. 211) https://gateoverflow.in/323655
Let AεCFG = {⟨G⟩ ∣ G is a CFG that generates ϵ}. Show that AεCFG is decidable.
10.3.1 Closure Property: Michael Sipser Edition 3 Exercise 2 Question 49 (Page No. 159) https://gateoverflow.in/323441
We defined the rotational closure of language A to be RC(A) = {yx ∣ xy ∈ A} .Show that the class of CFLs is closed
under rotational closure.
michael-sipser theory-of-computation context-free-languages closure-property descriptive
10.3.2 Closure Property: Michael Sipser Edition 3 Exercise 2 Question 50 (Page No. 159) https://gateoverflow.in/323443
We defined the CUT of language A to be CUT(A) = {yxz|xyz ∈ A} . Show that the class of CFLs is not closed
under CUT .
michael-sipser theory-of-computation context-free-languages closure-property descriptive
10.3.3 Closure Property: Michael Sipser Edition 3 Exercise 2 Question 53 (Page No. 159) https://gateoverflow.in/323446
Show that the class of DCFLs is not closed under the following operations:
10.3.5 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 11 (Page No. 109) https://gateoverflow.in/308788
10.3.6 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 12 (Page No. 109) https://gateoverflow.in/308789
Suppose we know that L1 ∪ L2 is regular and that L1 is finite. Can we conclude from this that L2 is regular?
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.7 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 13 (Page No. 109) https://gateoverflow.in/308790
10.3.8 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 14 (Page No. 109) https://gateoverflow.in/308791
10.3.9 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 15 (Page No. 110) https://gateoverflow.in/308935
L2 /L1 = {y : x ∈ L2 , xy ∈ L1 }
Show that the family of regular languages is closed under the left quotient with a regular
language.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.10 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 16 (Page No. 110) https://gateoverflow.in/308936
Show that if the statement “If L1 is regular and L1 ∪ L2 is also regular, then L2 must be regular“
were true for all L1 and L2 , then all languages would be regular.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.11 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 17 (Page No. 110) https://gateoverflow.in/308937
The tail of a language is defined as the set of all suffixes of its strings, that is,
10.3.12 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 18 (Page No. 110) https://gateoverflow.in/308938
The head of a language is the set of all prefixes of its strings, that is,
Show that the family of regular languages is closed under this operation.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.13 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 19 (Page No. 110) https://gateoverflow.in/308939
third(a1 a2 a3 a4 a5 a6 . . . ) = a3 a6 . . .
with the appropriate extension of this definition to languages. Prove the closure of the family of
regular languages under this operation.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.14 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 2 (Page No. 108) https://gateoverflow.in/308773
10.3.15 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 20 (Page No. 110) https://gateoverflow.in/308941
shift(a1 a2 . . . an ) = a2 a3 . . . an a1
From this, we can define the operation on a language as
10.3.16 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 21 (Page No. 110) https://gateoverflow.in/308942
Define
and
10.3.17 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 22 (Page No. 110) https://gateoverflow.in/308943
Show that the family of regular languages is closed under the shuffle operation.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.18 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 23 (Page No. 111) https://gateoverflow.in/308944
Define an operation minus5 on a language L as the set of all strings of L with the fifth symbol from the left removed
(strings of length less than five are left unchanged). Show that the family of regular languages is closed under the
minus5 operation.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.19 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 24 (Page No. 111) https://gateoverflow.in/308946
10.3.20 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 25 (Page No. 111) https://gateoverflow.in/308947
Show that the family of regular languages is closed under the min operation.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.21 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 26 (Page No. 110) https://gateoverflow.in/308948
Let G1 and G2 be two regular grammars. Show how one can derive regular grammars for the languages
(a) L(G1 ) ∪ L(G2 ) .
(b) L(G1 )L(G2 ) .
(b) L(G1 )∗ .
10.3.22 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 3 (Page No. 108) https://gateoverflow.in/308774
10.3.23 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 5 (Page No. 109) https://gateoverflow.in/308780
Show that the family of regular languages is closed under finite union and intersection, that is, if L1 , L2 , … , Ln are
regular, then
LU = ⋃i=1,2,..,nLi
and
LI = ⋂i=1,2,3,...,nLi
are also regular.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.24 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 6 (Page No. 109) https://gateoverflow.in/308781
The symmetric difference of two sets S1 and S2 is defined as S1 θS2 = {x : x ∈ S1 or x ∈ S2 , but x is not in both S1
and S2 }.
Show that the family of regular languages is closed under symmetric difference.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.25 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 7 (Page No. 109) https://gateoverflow.in/308783
nor(L1 , L2 ) = {w : w ∉ L1 and w ∉ L2 }
Show that the family of regular languages is closed under the nor operation.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.26 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 8 (Page No. 109) https://gateoverflow.in/308785
cor(L1 , L2 ) = {w : w ∈ ¯L
¯¯¯¯¯ ¯¯¯¯¯¯
1 or w ∈ L2 }
Show that the family of regular languages is closed under the cor operation.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.27 Closure Property: Peter Linz Edition 4 Exercise 4.1 Question 9 (Page No. 109) https://gateoverflow.in/308786
Which of the following are true for all regular languages and all homomorphisms?
(a) h(L1 ∪ L2 ) = h(L1 ) ∩ h(L2 ) .
(b) h(L1 ∩ L2 ) = h(L1 ) ∩ h(L2 ) .
(c) h(L1 L2 ) = h(L1 )h(L2 ) .
10.3.28 Closure Property: Peter Linz Edition 4 Exercise 4.3 Question 21 (Page No. 124) https://gateoverflow.in/309827
Let P be an infinite but countable set, and associate with each p ∈ P a language Lp . The smallest set containing every
Lp is the union over the infinite set P ; it will be denoted by Up∈p Lp . Show by example that the family of regular
languages is not closed under infinite union.
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.3.29 Closure Property: Peter Linz Edition 4 Exercise 4.3 Question 22 (Page No. 124) https://gateoverflow.in/309828
Consider the argument that the language associated with any generalized transition graph is regular. The language
associated with such a graph is
L = ⋃p∈P L(rp ) ,
where P is the set of all walks through the graph and rp is the expression associated with a walk p. The set of walks is
generally infinite, so that in light of Exercise 21, it does not immediately follow that L is regular. Show that in this case,
because of the special nature of P , the infinite union is regular.
10.3.30 Closure Property: Peter Linz Edition 4 Exercise 4.3 Question 23 (Page No. 124) https://gateoverflow.in/309829
10.3.31 Closure Property: Peter Linz Edition 4 Exercise 4.3 Question 24 (Page No. 124) https://gateoverflow.in/309830
Suppose that we know that L1 ∪ L2 and L1 are regular. Can we conclude from this that L2 is regular?
peter-linz peter-linz-edition4 theory-of-computation regular-languages closure-property
10.4.1 Cnf: Michael Sipser Edition 3 Exercise 2 Question 14 (Page No. 156) https://gateoverflow.in/311272
Convert the following CFG into an equivalent CFG in Chomsky normal form,using the procedure given in
Theorem 2.9.
A → BAB ∣ B ∣ ϵ
B → 00 ∣ ϵ
10.4.2 Cnf: Michael Sipser Edition 3 Exercise 2 Question 26 (Page No. 157) https://gateoverflow.in/311286
Show that if G is a CFG in Chomsky normal form , then for any string w ∈ L(G) of length n ≥ 1, exactly 2n − 1
steps are required for any derivation of w.
michael-sipser theory-of-computation context-free-grammars cnf proof
10.4.3 Cnf: Michael Sipser Edition 3 Exercise 2 Question 35 (Page No. 157) https://gateoverflow.in/311301
Let G be a CFG in Chomsky normal form that contains b variables. Show that if G generates some string with a
derivation having at least 2b steps, L(G) is infinite.
10.5.1 Computability: Michael Sipser Edition 3 Exercise 5 Question 16 (Page No. 240) https://gateoverflow.in/323980
Let Γ = {0, 1, ⊔} be the tape alphabet for all TMs in this problem. Define the busy beaver function BB : N → N
as follows. For each value of k, consider all k−state TMs that halt when started with a blank tape. Let BB(k) be the
maximum number of 1s that remain on the tape among all of these machines. Show that BB is not a computable function.
10.6.1 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 13 (Page No. 156)
https://gateoverflow.in/311271
Let G = (V , Σ, R, S) be the following grammar. V = {S, T, U}; Σ = {0, #}; and R is the
set of rules:
S → TT ∣ U
T → 0T ∣ T0 ∣ #
U → 0U00 ∣ #
10.6.2 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 15 (Page No. 156)
https://gateoverflow.in/311273
Give a counterexample to show that the following construction fails to prove that the class of
context-free languages is closed under star. Let A be a CFL that is generated by the CFG G = (V , Σ, R, S). Add
the new rule S → SS and call the resulting grammar G′ .This grammar is supposed to generate A∗ .
michael-sipser theory-of-computation context-free-languages context-free-grammars
10.6.3 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 19 (Page No. 156)
https://gateoverflow.in/311277
Let CFG G be the following grammar .
S → aSb ∣ bY ∣ Y a
Y → bY ∣ aY ∣ ϵ
¯¯¯¯¯¯¯¯¯¯¯
Give a simple description of L(G) in English. Use that description to give a CFG for L(G), the complement of L(G).
10.6.4 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 21 (Page No. 156)
https://gateoverflow.in/311279
Let Σ = {a, b}. Give a CFG generating the language of strings with twice as many a′ s as b′ s.
Prove that your grammar is correct.
michael-sipser theory-of-computation context-free-grammars context-free-languages
10.6.5 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 22 (Page No. 156)
https://gateoverflow.in/311280
Let C = {x#y ∣ x, y ∈ {0, 1}∗ and x ≠ y}. Show that C is a context-free language .
10.6.7 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 3 (Page No. 155)
https://gateoverflow.in/311107
Answer each part for the following context-free grammar G.
R → XRX|S
S → aTb|bTa
T → XTX|X|ϵ
X → a|b
10.6.8 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 4 (Page No. 155)
https://gateoverflow.in/311108
Give context-free grammars that generate the following languages . In all parts, the alphabet ∑
is {0, 1}.
a. {w| w contains at least three 1’s} b. {w| w starts and ends with the same symbol}
c. {w| the length of w is odd} d. {w| the length of w is odd and its middle symbol is a 0}
e. {w|w = wR , that is, w is a palindrome} f. The empty set.
michael-sipser theory-of-computation context-free-languages context-free-grammars descriptive
10.6.9 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 46 (Page No. 158)
https://gateoverflow.in/323435
Consider the following CFG G :
S → SS ∣ T
T → aTb ∣ ab
Describe L(G) and show that G is ambiguous. Give an unambiguous grammar H where L(H) = L(G) and sketch a proof
that H is unambiguous.
10.6.10 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 51 (Page No. 159)
https://gateoverflow.in/323444
Show that every DCFG is an unambiguous CFG.
michael-sipser theory-of-computation context-free-grammars ambiguous proof
10.6.11 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 54 (Page No. 159)
https://gateoverflow.in/323447
Let G be the following grammar:
S→T ⊣
T → TaTb ∣ TbTa|ϵ
a. Show that L(G) = {w ⊣ ∣ w contains equal numbers of a’s and b’s}. Use a proof by induction on the length of w.
b. Use the DK-test to show that G is a DCFG.
c. Describe a DPDA that recognizes L(G).
10.6.12 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 55 (Page No. 159)
https://gateoverflow.in/323448
Let G1 be the following grammar that we introduced in Example 2.45. Use the DK-test to show
that G1 is not a DCFG.
R→S∣T
S → aSb ∣ ab
T → aTbb ∣ abb
10.6.13 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 59 (Page No. 160)
https://gateoverflow.in/323453
If we disallow ϵ-rules in CFGs, we can simplify the DK-test. In the simplified test,we only need
to check that each of DK’s accept states has a single rule. Prove that a CFG without ϵ-rules passes the simplified DK-
test iff it is a DCFG.
michael-sipser theory-of-computation context-free-grammars descriptive
10.6.14 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 6 (Page No. 155)
https://gateoverflow.in/311111
Give context-free grammars generating the following languages.
a. The set of strings over the alphabet {a, b} with more a′ s than b′ s
b. The complement of the language {an bn ∣ n ≥ 0}
c. {w#x ∣ wR is a substring of x for w, x ∈ {0, 1}∗ }
d. {x1 #x2 #. . . #xk ∣ k ≥ 1, each xi ∈ {a, b}∗ , and for some i and j, xi = xR
j }
10.6.15 Context Free Grammars: Michael Sipser Edition 3 Exercise 2 Question 8 (Page No. 155)
https://gateoverflow.in/311113
Show that the string the girl touches the boy with the flower has two different leftmost
derivations in grammar G2 on page 103. Describe in English the two different meanings of this sentence.
michael-sipser theory-of-computation context-free-languages context-free-grammars
10.6.16 Context Free Grammars: Michael Sipser Edition 3 Exercise 4 Question 28 (Page No. 212)
https://gateoverflow.in/323824
L e t C = {⟨G, x⟩ ∣ G is a CFG x is a substring of some y ∈ L(G)}. Show that C is
decidable. (Hint: An elegant solution to this problem uses the decider for ECFG .)
michael-sipser theory-of-computation context-free-grammars decidability proof
10.6.17 Context Free Grammars: Michael Sipser Edition 3 Exercise 4 Question 29 (Page No. 212)
https://gateoverflow.in/323825
L e t
CCFG = {⟨G, k⟩ ∣ G is a CFG and L(G) contains exactly k strings where k ≥ 0 or k = ∞}. Show that
CCFG is decidable.
michael-sipser theory-of-computation context-free-grammars decidability proof
10.6.18 Context Free Grammars: Michael Sipser Edition 3 Exercise 4 Question 31 (Page No. 212)
https://gateoverflow.in/323827
Say that a variable A in CFL G is usable if it appears in some derivation of some string
w ∈ G . Given a CFG G and a variable A, consider the problem of testing whether A is usable. Formulate this
problem as a language and show that it is decidable.
michael-sipser theory-of-computation context-free-languages context-free-grammars decidability proof
10.6.19 Context Free Grammars: Michael Sipser Edition 3 Exercise 5 Question 1 (Page No. 239)
https://gateoverflow.in/323833
Show that EQCFG is undecidable.
michael-sipser theory-of-computation context-free-grammars decidability proof
10.6.20 Context Free Grammars: Michael Sipser Edition 3 Exercise 5 Question 32 (Page No. 241)
https://gateoverflow.in/324083
Prove that the following two languages are undecidable.
10.6.21 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 1 (Page No. 133)
https://gateoverflow.in/309887
Find the language generated by following grammar:
S → abB
A → aaBb
B → bbAa
A→λ
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.22 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 10 (Page No. 134)
https://gateoverflow.in/309965
Find a context-free grammar for head(L), where L is the language L = {an bm : n ≤ m + 3 }.
For
the definition of head see Exercise 18, Section 4.1.
10.6.23 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 11 (Page No. 134)
https://gateoverflow.in/309966
Find a context-free
grammar for Σ = {a, b} for the language L = {
an wwR bn : w ∈ Σ∗ , n ≥ 1 }.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.24 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 12 (Page No. 134)
https://gateoverflow.in/309967
Given a context-free grammar G for a language L, show how one can create from G a grammar
Ĝ so that L(Ĝ) = head (L).
10.6.25 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 13 (Page No. 134)
https://gateoverflow.in/309968
Let L = {an bn : n ≥ 0 }.
(a) https://gateoverflow.in/305106/peter-linz-edition-4-exercise-5-1-question-13-a-page-no-134
(b) Show that Lk is context-free for any given k ≥ 1 .
¯¯
¯¯
(c) Show that ¯¯
¯¯
L and L∗ are context-free.
10.6.26 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 13.a (Page No. 134)
https://gateoverflow.in/305106
L={an bn |n ≥ 0 }
please show how L2 is CFL
theory-of-computation peter-linz peter-linz-edition4 context-free-languages context-free-grammars
10.6.27 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 14 (Page No. 134)
https://gateoverflow.in/309970
Let L1 be the language L1 = {an bm ck : n = m or m ≤ k} and L2 the language L2 = {
an bm ck : n + 2m = k }. Show that L1 ∪ L2 is a context-free language.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.28 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 15 (Page No. 134)
https://gateoverflow.in/309971
Show that the following language is context-free.
10.6.29 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 16 (Page No. 134)
https://gateoverflow.in/309972
Show that the complement of the language L = {wwR : w ∈ {a, b}∗ } is context-free.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.30 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 17 (Page No. 134)
https://gateoverflow.in/309973
Show that the complement of the language L = {an bm ck : k = n + m } is context-free.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.31 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 18 (Page No. 134)
https://gateoverflow.in/309975
Show that the language L = {w1 cw2 : w1 , w2 ∈ {a, b}+ , w1 ≠ wR
2 }, with Σ = {a, b, c},is
context-free.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.32 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 19 (Page No. 134)
https://gateoverflow.in/309976
Show a derivation tree for the string aabbbb with the grammar
S → AB|λ,
A → aB,
B → Sb.
10.6.33 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 2 (Page No. 133)
https://gateoverflow.in/309889
Draw the derivation tree corresponding to the derivation in Example 5.1.
Example 5.1
The grammar G =({S }, {a, b}, S, P ), with productions
S → aSa
S → bSb
S→λ
10.6.34 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 20 (Page No. 135)
https://gateoverflow.in/309977
Consider the grammar with productions
S → aaB,
A → bBb|λ,
B → Aa.
Show that the string aabbabba is not in the language generated by this grammar.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.35 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 21 (Page No. 135)
https://gateoverflow.in/309978
Consider the derivation tree below.
Find a grammar G for which this is the derivation tree of the string aab. Then find two more sentences of L(G). Find a
sentence in L(G) that has a derivation tree of height five or larger.
10.6.36 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 22 (Page No. 135)
https://gateoverflow.in/309979
Define what one might mean by properly nested parenthesis structures involving two kinds of
parentheses, say ( ) and [ ]. Intuitively, properly nested strings in this situation are ([ ]), ([[ ]])[( )], but not ([ )] or (( ]].
Using your definition, give a context-free grammar for generating all properly nested parentheses.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.37 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 23 (Page No. 135)
https://gateoverflow.in/309980
Find a context-free grammar for the set of all regular expressions on the alphabet {a, b}.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.38 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 24 (Page No. 135)
https://gateoverflow.in/309981
Find a context-free grammar that can generate all the production rules for context-free grammars
with T = {a, b} and V = {A, B, C }.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.39 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 25 (Page No. 135)
https://gateoverflow.in/309982
Prove that if G is a context-free grammar, then every w ∈ L(G) has a leftmost and rightmost
derivation. Give an algorithm for finding such derivations from a derivation tree.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.40 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 26 (Page No. 135)
https://gateoverflow.in/309983
Find a linear grammar for the language L = {an bm : n ≠ m }.
10.6.41 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 27 (Page No. 135)
https://gateoverflow.in/309984
Let G = (V , T, S, P ) be a context-free grammar such that every one of its productions is of the
form A → v, with |v| = k > 1. Show that the derivation tree for any w ∈ L(G) has a height h such that
(|w|−1)
logk |w| ≤ h ≤ k−1
.
10.6.42 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 3 (Page No. 133)
https://gateoverflow.in/309890
Give a derivation tree for w = abbbaabbaba for the grammar G, with productions
S → abB
A → aaBb
B → bbAa
A → λ.
10.6.43 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 4 (Page No. 133)
https://gateoverflow.in/309893
Show that the grammar with productions S → aSb|SS|λ does in fact generate the language
L = {w ∈ {a, b}∗ : na (w) = nb (w) and na (v) ≥ nb (v), where v is any prefix of w}.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.44 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 6 (Page No. 133)
https://gateoverflow.in/309895
Give the Complete proof of Theorem 5.1 by showing that the yield of every partial derivation
tree with root S is a sentential form of G.
Theorem 5.1
Let G = (V , T, S, P ) be a context-free grammar. Then for every w ∈ L(G), there exists a derivation tree of G whose yield
is w. Conversely, the yield of any derivation tree is in L(G). Also, if tG is any partial derivation tree for G whose root is
labeled S , then the yield of tG is a sentential form of G.
10.6.45 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 7 (Page No. 133)
https://gateoverflow.in/309896
Find context-free grammars for the following languages (with n ≥ 0, m ≥ 0 ).
(a) L = {an bm : n ≤ m + 3 }.
(b) L = {an bm : n ≠ m − 1 }.
(c) https://gateoverflow.in/208410/peter-linz-edition-4-exercise-5-1-question-7-c-page-no-133
(d) L = {an bm : 2n ≤ m ≤ 3n }.
(e) L = {w ∈ {a, b}∗ : na (w) ≠ nb (w) }.
(f) L = {w ∈ {a, b}∗ : na (v) ≥ nb (v), where v is any prefix of w}.
(g) L = {w ∈ {a, b}∗ : na (w) = 2nb (w) + 1 }.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages context-free-grammars
10.6.46 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 8 (Page No. 134)
https://gateoverflow.in/309897
Find context-free grammars for the following languages (with n ≥ 0, m ≥ 0, k ≥ 0 ).
(a) L = {an bm ck : n = m or m ≤ k}.
(b) L = {an bm ck : n = m or m ≠ k}.
(c) L = {an bm ck : k = n + m }.
(d) L = {an bm ck : n + 2m = k }.
(e) L = {an bm ck : k = |n − m| }.
(f) L = {w ∈ {a, b, c}∗ : na (w) + nb (w) ≠ nc (w) }.
(g) L = {an bm ck , k ≠ n + m }.
(h) L = {an bm ck : k ≥ 3 }.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.47 Context Free Grammars: Peter Linz Edition 4 Exercise 5.1 Question 9 (Page No. 134)
https://gateoverflow.in/309898
Show that L = {w ∈ {a, b, c}∗ : |w| = 3na (w) } is a context-free language.
10.6.48 Context Free Grammars: Peter Linz Edition 4 Exercise 5.2 Question 17 (Page No. 145)
https://gateoverflow.in/310006
Use the exhaustive search parsing method to parse the string abbbbbb with the grammar with
productions
S → aAB,
A → bBb,
B → A|λ.
In general, how many rounds will be needed to parse any string w in this language?
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars parsing
10.6.49 Context Free Grammars: Peter Linz Edition 4 Exercise 5.2 Question 18 (Page No. 145)
https://gateoverflow.in/310007
Is the string aabbababb in the language generated by the grammar S → aSS|b ?
S → aAb|λ,
A → aAb|λ is unambiguous.
10.6.50 Context Free Grammars: Peter Linz Edition 4 Exercise 5.2 Question 19 (Page No. 145)
https://gateoverflow.in/310008
Prove the following result. Let G = (V , T, S, P ) be a context-free grammar in which every
A ∈ V occurs on the left side of at most one production. Then G is unambiguous.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars ambiguous
10.6.51 Context Free Grammars: Peter Linz Edition 4 Exercise 5.2 Question 20 (Page No. 145)
https://gateoverflow.in/310009
Find a grammar equivalent to S → aAB, A → bBb, B → A|λ that satisfies the conditions of
Theorem 5.2.
Theorem 5.2
Suppose that G = (V , T, S, P ) is a context-free grammar that does not have any rules of the form A → λ, or A → B, where
A, B ∈ V . Then the exhaustive search parsing method can be made into an algorithm which, for any w ∈ Σ∗ , either produces
a parsing of w or tells us that no parsing is possible.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.52 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 1 (Page No. 161)
https://gateoverflow.in/310056
Complete the proof of Theorem 6.1 by showing that
∗
S ⇒Ĝ w
implies
∗
S ⇒G w .
Theorem 6.1
Let G = (V , T, S, P ) be a context-free grammar. Suppose that P contains a production of the form A → x1 Bx2 .
Assume that A and B are different variables and that B → y1 |y2 | … |yn is the set of all productions in P that have B as the
left side. Let Ĝ = (V , T, S, Pˆ) be the grammar in which Pˆ is constructed by deleting A → x1 Bx2 from P , and adding to it
A → x1 y1 x2 |x1 y2 x2 |. . . |x1 yn x2 .
Then, L(Ĝ) = L(G) .
10.6.53 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 10 (Page No. 162)
https://gateoverflow.in/310066
Complete the proof of Theorem 6.3.
Theorem 6.3
Let G be any context-free grammar with λ not in L(G). Then there exists an equivalent grammar Ĝ
having no λ-productions.
10.6.54 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 11 (Page No. 162)
https://gateoverflow.in/310067
Complete the proof of Theorem 6.4.
Theorem 6.4
L e t G = (V , T, S, P ) be any context-free grammar without λ-productions. Then there exists a context-free grammar
Ĝ = (Vˆ, Tˆ, S, Pˆ) that does not have any unit-productions and that is equivalent to G.
10.6.55 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 12 (Page No. 162)
https://gateoverflow.in/310068
Remove λ-productions from the grammar with productions S → aSb|SS|λ.
What language does the resulting grammar generate?
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.56 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 14 (Page No. 162)
https://gateoverflow.in/310069
Suppose that G is a context-free grammar for which λ ∈ L(G) . Show that if we apply the
construction in Theorem 6.3, we obtain a new grammar Ĝ such that L(Ĝ) = L(G)– {λ}.
10.6.57 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 16 (Page No. 162)
https://gateoverflow.in/310157
Let G be a grammar without λ-productions, but possibly with some unit-productions. Show that
the construction of Theorem 6.4 does not then introduce any λ-productions.
Theorem 6.4
L e t G = (V , T, S, P ) be any context-free grammar without λ-productions. Then there exists a context-free grammar
Ĝ = (Vˆ, Tˆ, Ŝ , Pˆ) that does not have any unit-productions and that is equivalent to G.
10.6.59 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 18 (Page No. 162)
https://gateoverflow.in/310160
Justify the claim made in the proof of Theorem 6.1 that the variable B can be replaced as soon
as
it appears.
10.6.60 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 19 (Page No. 163)
https://gateoverflow.in/310162
Suppose that a context-free grammar G = (V , T, S, P ) has a production of the form A → xy,
where x, y ∈ (V ∪ T)+ . Prove that if this rule is replaced by A → By, B → x, where B ∉ V , then the resulting
grammar is equivalent to the original one.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.61 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 2 (Page No. 161)
https://gateoverflow.in/310058
Show a derivation tree for the string ababbac, using grammar with productions
A → a|aaA|abBC,
B → abbA|b.
A → a|aaA|ababbAc|abbc,
B → abbA|b.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.62 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 20 (Page No. 163)
https://gateoverflow.in/310163
Consider the procedure suggested in Theorem 6.2 for the removal of useless productions.
Reverse the order of the two parts, first eliminating variables that cannot be reached from S, then removing those that
do not yield a terminal string. Does the new procedure still work correctly? If so, prove it. If not, give a counterexample.
10.6.63 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 21 (Page No. 163)
https://gateoverflow.in/310164
It is possible to define the term simplification precisely by introducing the concept
of complexity of a grammar. This can be done in many ways; one of them is through the length of all the strings giving
the production rules.
For example, we might use
complexity(G) =∑A→V ∈P {1 + |v|}
Show that the removal of useless productions always reduces the complexity in this sense. What can you say about the removal
of λ-productions and unit-productions?
10.6.65 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 23 (Page No. 163)
https://gateoverflow.in/310166
Prove the following result. Let G = (V , T, S, P ) be a context-free grammar. Divide the set of
productions whose left sides are some given variable (say, A), into two disjoint subsets
A → y1 |y2 |. . . |ym ,
where xi , yi are in (V ∪ T)∗ , but A is not a prefix of any yi . Consider the grammar Ĝ = (V ∪ {Z }, T, S, Pˆ) , where Z ∉ V
and Pˆ is obtained by replacing all productions that have A on the left by
A → yi |yi Z, i = 1, 2, 3, … , m
Z → xi |xi Z, i = 1, 2, 3, … , n.
Then L(G) = L(Ĝ).
10.6.66 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 24 (Page No. 164)
https://gateoverflow.in/310168
Use the result of the preceding exercise to rewrite the grammar
A → Aa|aBc|λ,
B → Bb|bc
so that it no longer has productions of the form A → Ax or B → Bx.
10.6.67 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 25 (Page No. 164)
https://gateoverflow.in/310169
Prove the following counterpart of Exercise 23. Let the set of productions involving the variable
A on the left be divided into two disjoint subsets
A → x1 A|x2 A|. . . |xn A,
and, A → y1 |y2 |. . . |ym ,
where A is not a suffix of any yi . Show that the grammar obtained by replacing these productions with
A → yi |Z yi , i = 1, 2, 3, … , m
Z → xi |Z xi , i = 1, 2, 3, … , n.
is equivalent to the original grammar.
10.6.68 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 3 (Page No. 161)
https://gateoverflow.in/310059
Show that the two grammars
S → abAB|ba,
A → aaa,
B → aA|bb
and
S → abAaA|abAbb|ba,
10.6.69 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 4 (Page No. 161)
https://gateoverflow.in/310060
In Theorem 6.1, why is it necessary to assume that A and B are different variables?
10.6.70 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 5 (Page No. 161)
https://gateoverflow.in/310062
Eliminate all useless productions from the grammar
S → aS|AB,
A → bA,
B → AA.
What language does this grammar generate?
peter-linz peter-linz-edition4 context-free-grammars context-free-languages
10.6.71 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 6 (Page No. 161)
https://gateoverflow.in/310063
Eliminate useless productions from
S → a|aA|B|C,
A → aB|λ,
B → Aa,
C → cCD,
D → ddd.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.72 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 7 (Page No. 162)
https://gateoverflow.in/310064
Eliminate all λ-productions from
S → AaB|aaB,
A → λ,
B → bbA|λ.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.73 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 8 (Page No. 162)
https://gateoverflow.in/310065
Remove all unit-productions, all useless productions, and all λ-productions from the grammar
S → aA|aBB,
A → aaA|λ,
B → bB|bbC,
C → B.
What language does this grammar generate?
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.74 Context Free Grammars: Peter Linz Edition 4 Exercise 6.1 Question 9 (Page No. 162)
https://gateoverflow.in/208844
Eliminate all unit-productions from the grammar
S → a|aA|B|C,
A → aB|λ,
B → aA,
C → aCD,
D → ddd
theory-of-computation peter-linz peter-linz-edition4 context-free-grammars
10.6.75 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 1 (Page No. 169)
https://gateoverflow.in/310282
Provide the details of the proof of Theorem 6.6.
Theorem 6.6
Any context-free grammar G = (V , T, S, P ) with λ ∉ L(G) has an equivalent grammar Ĝ = (Vˆ, Tˆ, S, Pˆ) in Chomsky
normal form.
10.6.76 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 15 (Page No. 170)
https://gateoverflow.in/310297
A context-free grammar is said to be in two-standard form if all production rules satisfy the
following pattern
A → aBC,
A → aB,
A → a,
where A, B, C ∈ V and a ∈ T .
S → aSA,
A → bABC,
B → b,
C → aBC
into two-standard form.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.77 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 16 (Page No. 170)
https://gateoverflow.in/310298
“Two-standard form is general; for any context-free grammar G with λ ∉ L(G), there exists an
equivalent grammar in two-standard form.” Prove this.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.78 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 2 (Page No. 169)
https://gateoverflow.in/310283
Convert the grammar S → aSb|ab into Chomsky normal form.
10.6.79 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 3 (Page No. 169)
https://gateoverflow.in/310284
Transform the grammar S → aSaA|A, A → abA|b into Chomsky normal form.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.80 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 4 (Page No. 169)
https://gateoverflow.in/310285
Transform the grammar with productions
S → abAB,
A → bAB|λ,
10.6.81 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 5 (Page No. 169)
https://gateoverflow.in/310286
Convert the grammar with productions
S → AB|aB,
A → aab|λ,
10.6.82 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 6 (Page No. 169)
https://gateoverflow.in/310287
L e t G = (V , T, S, P ) be any context-free grammar without any λ-productions or unit-
productions.
Let k be the maximum number of symbols on the right of any production in P . Show that there is an
equivalent grammar in Chomsky normal form with no more than (k − 1)|P | + |T | production rules.
10.6.83 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 7 (Page No. 169)
https://gateoverflow.in/310289
Draw the dependency graph for the grammar in Exercise 4.
10.6.84 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 8 (Page No. 169)
https://gateoverflow.in/310290
A linear language is one for which there exists a linear grammar
[A linear grammar is a grammar in which at most one variable can occur on the right side of any production, without
restriction on the position of this variable. Clearly, a regular grammar is always linear, but not all linear grammars are
regular].
Let L be any linear language not containing λ. Show that there exists a grammar G = (V , T, S, P ) all of whose productions
have one of the forms
A → aB,
A → Ba,
A → a,
where a ∈ T , A, B ∈ V , such that L = L(G) .
10.6.85 Context Free Grammars: Peter Linz Edition 4 Exercise 6.2 Question 9 (Page No. 170)
https://gateoverflow.in/310291
Show that for every context-free grammar G = (V , T, S, P ) there is an equivalent one in
which all productions have the form
A → aBC,
or
A → λ,
where a ∈ Σ ∪ {λ} , A, B, C ∈ V .
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.86 Context Free Grammars: Peter Linz Edition 4 Exercise 6.3 Question 1 (Page No. 172)
https://gateoverflow.in/310299
Use the CYK algorithm to determine whether the strings aabb, aabba, and abbbb are in the
language generated by the grammar with productions
S → AB,
A → BB|a,
B → AB|b.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.87 Context Free Grammars: Peter Linz Edition 4 Exercise 6.3 Question 2 (Page No. 173)
https://gateoverflow.in/310300
Use the CYK algorithm to find a parsing of the string aab, using the grammar with productions
S → AB,
A → BB|a,
B → AB|b.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.88 Context Free Grammars: Peter Linz Edition 4 Exercise 6.3 Question 3 (Page No. 173)
https://gateoverflow.in/310301
Use the approach employed in Exercise 2 to show how the CYK membership algorithm can be
made into a parsing method.
10.6.89 Context Free Grammars: Peter Linz Edition 4 Exercise 6.3 Question 4 (Page No. 173)
https://gateoverflow.in/310302
Use the CYK method to determine if the string w = aaabbbbab is in the language generated by
the grammar S → aSb|b .
10.6.90 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 1 (Page No. 204)
https://gateoverflow.in/315575
Show that the grammar S0 → aSbS, S → aSbS|λ is an LL grammar and that it is equivalent
to the grammar S → SS|aSb|ab .
10.6.91 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 2 (Page No. 204)
https://gateoverflow.in/315576
Show that the grammar
L = { w : na (w) = nb (w) }
for which is,
S → SS, S → λ, S → aSb, S → bSa is not an LL grammar.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages context-free-grammars
10.6.92 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 3 (Page No. 204)
https://gateoverflow.in/315577
Find an LL grammar for the language L = {w : na (w) = nb (w) }.
10.6.93 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 4 (Page No. 204)
https://gateoverflow.in/315578
Construct an LL grammar for the language L (a*ba) ∪ L (abbb*).
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.94 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 5 (Page No. 204)
https://gateoverflow.in/315579
Show that any LL grammar is unambiguous.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.95 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 6 (Page No. 204)
https://gateoverflow.in/315580
Show that if G is an LL (k) grammar, then L (G) is a deterministic context-free language.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars context-free-languages
10.6.96 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 8 (Page No. 204)
https://gateoverflow.in/315582
Let G be a context-free grammar in Greibach normal form. Describe an algorithm which, for any
given k, determines whether or not G is an LL (k) grammar.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars
10.6.97 Context Free Grammars: Peter Linz Edition 4 Exercise 7.4 Question 9 (Page No. 204)
https://gateoverflow.in/315583
Give LL grammars for the following languages, assuming Σ = {a, b, c}.
10.7.1 Countable Uncountable Set: Michael Sipser Edition 3 Exercise 4 Question 8 (Page No. 211)
https://gateoverflow.in/323769
Let T = {(i, j, k) ∣ i, j, k ∈ N} . Show that T is countable.
10.7.2 Countable Uncountable Set: Michael Sipser Edition 3 Exercise 4 Question 9 (Page No. 211)
https://gateoverflow.in/323770
Review the way that we define sets to be the same size in Definition 4.12 (page 203). Show that
“is the same size” is an equivalence relation.
michael-sipser theory-of-computation turing-machine countable-uncountable-set proof
10.8.1 Dfa Nfa: Michael Sipser Edition 3 Exercise 1 Question 39 (Page No. 89) https://gateoverflow.in/310924
The construction in Theorem 1.54 shows that every GNFA is equivalent to a GNFA with only two states . We can
show that an opposite phenomenon occurs for DFAs. Prove that for every k > 1, a language Ak ⊆ {0, 1}∗ exists that
is recognized by a DFA with k states but not by one with only k − 1 states .
michael-sipser theory-of-computation finite-automata dfa-nfa proof
10.9.1 Dpda: Michael Sipser Edition 3 Exercise 4 Question 32 (Page No. 213) https://gateoverflow.in/323830
The proof of Lemma 2.41 says that (q, x) is a looping situation for a DP DA P if when P is started in state q with
x ∈ Γ on the top of the stack, it never pops anything below x and it never reads an input symbol. Show that F is
decidable, where F = {⟨P , q, x⟩ ∣ (q, x) is a looping situation for P} .
10.10.1 Enumerated Language: Michael Sipser Edition 3 Exercise 3 Question 4 (Page No. 187)
https://gateoverflow.in/323457
Give a formal definition of an enumerator. Consider it to be a type of two-tape Turing machine
that uses its second tape as the printer. Include a definition of the enumerated language.
michael-sipser theory-of-computation turing-machine enumerated-language descriptive
10.11.1 Finite State Transducer: Michael Sipser Edition 3 Exercise 1 Question 25 (Page No. 87)
https://gateoverflow.in/310472
Read the informal definition of the finite state transducer given in question 24. Give a formal
definition of this model, following the pattern in Definition 1.5 (page 35). Assume that an FST has an input alphabet
Σ and an output alphabet Γ but not a set of accept states. Include a formal definition of the computation of an FST. (Hint :
An FST is a 5-tuple. Its transition function is of the form δ : Q × Σ → Q × Γ. )
10.11.2 Finite State Transducer: Michael Sipser Edition 3 Exercise 1 Question 50 (Page No. 90)
https://gateoverflow.in/311029
Read the informal definition of the finite state transducer given in Question 24. Prove that
no FST can output wR for every input w if the input and output alphabets are {0, 1}.
michael-sipser theory-of-computation finite-automata finite-state-transducer proof descriptive
10.12.1 Fst: Michael Sipser Edition 3 Exercise 1 Question 26 (Page No. 87) https://gateoverflow.in/310474
Using the solution you gave to question 25, give a formal description of the machines T1 and T2 depicted in question
24.
michael-sipser theory-of-computation finite-automata fst descriptive
10.12.2 Fst: Michael Sipser Edition 3 Exercise 1 Question 27 (Page No. 88) https://gateoverflow.in/310475
Read the informal definition of the finite state transducer given in question 24. Give the state diagram of an FST with
the following behavior. Its input and output alphabets are {0, 1}. Its output string is identical to the input string on the
even positions but inverted on the odd positions. For example, on input 0000111 it should output 1010010.
michael-sipser theory-of-computation fst descriptive
10.13.1 Gnf: Peter Linz Edition 4 Exercise 6.2 Question 10 (Page No. 170) https://gateoverflow.in/310292
10.13.2 Gnf: Peter Linz Edition 4 Exercise 6.2 Question 11 (Page No. 170) https://gateoverflow.in/310293
S → aSb|ab
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars gnf
10.13.3 Gnf: Peter Linz Edition 4 Exercise 6.2 Question 12 (Page No. 170) https://gateoverflow.in/310294
10.13.4 Gnf: Peter Linz Edition 4 Exercise 6.2 Question 13 (Page No. 170) https://gateoverflow.in/310295
A → aaA|B,
B → bAb
into Greibach normal form.
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars gnf
10.13.5 Gnf: Peter Linz Edition 4 Exercise 6.2 Question 14 (Page No. 170) https://gateoverflow.in/310296
Can every linear grammar be converted to a form in which all productions look like A → ax, where a ∈ T and x ∈ V
∪ {λ} ?
peter-linz peter-linz-edition4 theory-of-computation context-free-grammars gnf
10.14.1 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 11 (Page No. 28) https://gateoverflow.in/306610
In each case, give convincing arguments that the grammar you give does indeed generate the
indicated language.
peter-linz peter-linz-edition4 theory-of-computation grammar
10.14.2 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 12 (Page No. 28) https://gateoverflow.in/306611
Give a simple description of the language generated by the grammar with productions
S → aA,
A → bS,
S → λ.
peter-linz peter-linz-edition4 theory-of-computation grammar
10.14.3 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 13 (Page No. 28) https://gateoverflow.in/306612
S → Aa ,
A→B,
B → Aa .
peter-linz peter-linz-edition4 theory-of-computation grammar
10.14.4 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 14 (Page No. 28) https://gateoverflow.in/306613
Let Σ = { a, b}. For each of the following languages, find a grammar that generates it.
(a) L1 = { an bm : n ≥ 0, m > n }.
(b) L2 = { an b2n : n ≥ 0 }.
(c) L3 = { an+2 bn : n ≥ 1 }.
(d) L4 = { an bn−3 : n ≥ 3 }.
(e) L1 L2 .
(f) L1 ∪ L2 .
(g) L31 .
(h) L∗1 .
(i) L1 − L̄4 .
peter-linz peter-linz-edition4 theory-of-computation grammar
10.14.5 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 14.g (Page No. 29) https://gateoverflow.in/205663
L = {an bm : n ≥ 0, m > n}
10.14.6 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 15 (Page No. 29) https://gateoverflow.in/306614
10.14.7 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 15.d (Page No. 29) https://gateoverflow.in/205665
10.14.8 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 16 (Page No. 29) https://gateoverflow.in/148852
10.14.9 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 17 (Page No. 29) https://gateoverflow.in/148914
S → aSb
S → bSa
S → aa
theory-of-computation peter-linz peter-linz-edition4 grammar
10.14.10 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 18 (Page No. 29) https://gateoverflow.in/205691
Assume ∑ = {a, b}
1. L = {w : na (w) = nb (w) + 1}
2. L = {w : na (w) > nb (w)}
3. L = {w : na (w) = 2nb (w)}
4. L = {w ∈ {a, b}∗ : |na (w) − nb (w)| = 1}
10.14.11 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 21 (Page No. 29) https://gateoverflow.in/306750
S → aSb|ab|λ ,
and
S → aAb|ab ,
A → aAb|λ ,
equivalent? Assume that S is the start symbol in both cases.
peter-linz peter-linz-edition4 theory-of-computation grammar
10.14.12 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 22 (Page No. 30) https://gateoverflow.in/306751
10.14.13 Grammar: Peter Linz Edition 4 Exercise 1.2 Question 23 (Page No. 30) https://gateoverflow.in/306752
S → aSb|bSa|SS|a
and
S → aSb|bSa|a
are not equivalent.
peter-linz peter-linz-edition4 theory-of-computation grammar
10.14.14 Grammar: Peter Linz Edition 4 Exercise 2.1 Question 21 (Page No. 48) https://gateoverflow.in/222986
10.14.15 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 1 (Page No. 144) https://gateoverflow.in/309988
10.14.16 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 10 (Page No. 145) https://gateoverflow.in/309998
Give an unambiguous grammar that generates the set of all regular expressions on Σ = {a, b}.
peter-linz peter-linz-edition4 theory-of-computation grammar regular-expressions
10.14.17 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 13 (Page No. 145) https://gateoverflow.in/310001
S → aSbS|bSaS|λ
peter-linz peter-linz-edition4 theory-of-computation grammar ambiguous
10.14.18 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 14 (Page No. 145) https://gateoverflow.in/310002
Show that the grammar S → aSb|SS|λ is ambiguous, but that the language denoted by it is not.
S → SS,
S → λ,
S → aSb,
S → bSa.
is ambiguous.
peter-linz peter-linz-edition4 theory-of-computation grammar ambiguous
10.14.20 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 16 (Page No. 145) https://gateoverflow.in/310004
S → aAB,
A → bBb,
B → A|λ.
is unambiguous.
peter-linz peter-linz-edition4 theory-of-computation grammar ambiguous
10.14.21 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 2 (Page No. 144) https://gateoverflow.in/309989
10.14.22 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 3 (Page No. 144) https://gateoverflow.in/309990
10.14.23 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 4 (Page No. 145) https://gateoverflow.in/309992
10.14.24 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 5 (Page No. 145) https://gateoverflow.in/309993
Let G = (V , T, S, P ) be an s-grammar. Give an expression for the maximum size of P in terms of |V | and |T | .
10.14.25 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 6 (Page No. 145) https://gateoverflow.in/309994
S → AB|aaB,
A → a|Aa,
B → b.
peter-linz peter-linz-edition4 theory-of-computation grammar ambiguous
10.14.26 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 7 (Page No. 145) https://gateoverflow.in/309995
10.14.27 Grammar: Peter Linz Edition 4 Exercise 5.2 Question 8 (Page No. 145) https://gateoverflow.in/309996
Give the derivation tree for (((a + b) * c)) + a + b, using the grammar with productions
E → I,
E → E + E,
E → E ∗ E,
E → (E),
I → a|b|c.
peter-linz peter-linz-edition4 theory-of-computation grammar
10.15.1 Graph: Michael Sipser Edition 3 Exercise 0 Question 13 (Page No. 27) https://gateoverflow.in/309923
Show that every graph with two or more nodes contains two nodes that have equal degrees.
michael-sipser theory-of-computation graph proof
10.15.2 Graph: Michael Sipser Edition 3 Exercise 0 Question 14 (Page No. 28) https://gateoverflow.in/309924
Ramsey’s theorem : Let G be a graph. A clique in G is a sub-graph in which every two nodes are connected by an
edge. An anti-clique also called an independent set, is a sub-graph in which every two nodes are not connected by an
edge. Show that every graph with n nodes contains either a clique or an anti-clique with at least 12 log2 n nodes.
10.15.3 Graph: Michael Sipser Edition 3 Exercise 0 Question 8 (Page No. 26) https://gateoverflow.in/309908
Consider the undirected graph G= (V, E) where V , the set of nodes, is {1, 2, 3, 4} and E, the set of edges, is {{1, 2},
{2, 3}, {1, 3}, {2, 4}, {1, 4}}. Draw the graph G. What are the degrees of each node? Indicate a path from node 3 to
node 4 on your drawing of G.
michael-sipser theory-of-computation graph easy
10.15.4 Graph: Michael Sipser Edition 3 Exercise 0 Question 9 (Page No. 27) https://gateoverflow.in/309909
10.16.1 Homomorphism: Michael Sipser Edition 3 Exercise 1 Question 66 (Page No. 93) https://gateoverflow.in/311047
A homomorphism is a function f : Σ → Γ∗ from one alphabet to strings overanother alphabet. We can extend f to
operate on strings by defining f(w) = f(w1 )f(w2 ). . . f(wn ), where w = w1 w2 . . . wn and each wi ∈ ∑. We
further extend f to operate on languages by defining f(A) = {f(w)|w ∈ A}, for any language A.
a. Show,by giving a formal construction, that the class of regular languages is closed under homomorphism. In other words,
given a DFA M that recognizes B and a homomorphism f, construct a finite automaton M ′ that recognizes
f(B). Consider the machine M ′ that you constructed. Is it a DFA in every case ?
b. Show, by giving an example, that the class of non-regular languages is not closed under homomorphism.
10.17.1 Inherently Ambiguous: Michael Sipser Edition 3 Exercise 2 Question 29 (Page No. 157)
https://gateoverflow.in/311295
Show that the language A = {ai bj ck ∣ i = j or j = k where i, j, k ≥ 0} is inherently
ambiguous.
michael-sipser theory-of-computation context-free-languages inherently-ambiguous
10.17.2 Inherently Ambiguous: Peter Linz Edition 4 Exercise 5.2 Question 12 (Page No. 145)
https://gateoverflow.in/310000
Show that the language L = {wwR : w ∈ {a, b}∗ } is not inherently ambiguous.
peter-linz peter-linz-edition4 theory-of-computation inherently-ambiguous grammar
10.17.3 Inherently Ambiguous: Peter Linz Edition 4 Exercise 5.2 Question 9 (Page No. 145)
https://gateoverflow.in/309997
Show that a regular language cannot be inherently ambiguous.
peter-linz peter-linz-edition4 theory-of-computation inherently-ambiguous grammar
10.17.4 Inherently Ambiguous: Peter Linz Edition 4 Exercise 7.4 Question 7 (Page No. 204)
https://gateoverflow.in/315581
Show that a deterministic context-free language is never inherently ambiguous.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages inherently-ambiguous
10.18.1 Legitimate Turing Machine: Michael Sipser Edition 3 Exercise 3 Question 7 (Page No. 188)
https://gateoverflow.in/323630
Explain why the following is not a description of a legitimate Turing machine.
Mbad =“ On input ⟨p⟩, a polynomial over variables x1 , … , xk :
10.19.1 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 1 (Page No. 25) https://gateoverflow.in/309900
Examine the following formal descriptions of sets so that you understand which members they contain. Write a short
informal English description of each set.
a. {1, 3, 5, 7, . . . }
b. { . . . , −4, −2, 0, 2, 4, . . . }
c. {n| n = 2m for some m in N }
d. {n| n = 2m for some m in N , and n = 3k for some k in N }
e. {w| w is a string of 0s and 1s and w equals the reverse of w}
f. {n| n is an integer and n = n + 1}
michael-sipser theory-of-computation easy
10.19.2 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 10 (Page No. 27) https://gateoverflow.in/309920
Find the error in the following proof that 2 = 1.Consider the equation a = b. Multiply both sides by a to obtain
a2 = ab. Subtract b2 from both sides to get a2 − b2 = ab − b2 . Now factor each side , (a + b)(a − b) = b(a − b),
and divide each side by (a − b) to get a + b = b. Finally, let a and b equal 1, which shows that 2 = 1.
michael-sipser theory-of-computation proof
10.19.3 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 11 (Page No. 27) https://gateoverflow.in/309921
Let S(n) = 1 + 2 + ⋅ ⋅ ⋅ + n be the sum of the first n natural numbers and let C(n) = 13 + 23 + ⋅ ⋅ ⋅ + n3 be the
sum of the first n cubes. Prove the following equalities by induction on n, to arrive at the curious conclusion that
C(n) = S 2 (n) for every n.
10.19.4 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 12 (Page No. 27) https://gateoverflow.in/309922
Find the error in the following proof that all horses are the same color.
CLAIM: In any set of h horses, all horses are the same color.
PROOF: By induction on h.
Basis: For h = 1. In any set containing just one horse, all horses clearly are the
same color.
Induction step: For k ≥ 1, assume that the claim is true for h = k and prove that it is true for h = k + 1. Take any set H of
k + 1 horses. We show that all the horses in this set are the same color. Remove one horse from this set to obtain the set H1
with just k horses. By the induction hypothesis, all the horses in H1 are the same color. Now replace the removed horse and
remove a different one to obtain the set H2 . By the same argument, all the horses in H2 are the same color. Therefore, all the
horses in H must be the same color, and the proof is complete.
10.19.5 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 15 (Page No. 28) https://gateoverflow.in/309925
Use Theorem 0.25 to derive a formula for calculating the size of the monthly payment for a mortgage in terms of the
principal P , the interest rate I, and the number of payments, t. Assume that after t payments have been made, the loan
amount is reduced to 0. Use the formula to calculate the dollar amount of each monthly payment for a 30−year mortgage with
360 monthly payments on an initial loan amount of $100, 000 with a 5% annual interest rate.
Hint: Theorem 0.25 are explained in page number 24– 25.
10.19.6 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 2 (Page No. 25) https://gateoverflow.in/309902
10.19.7 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 6 (Page No. 26) https://gateoverflow.in/309906
Let X be the set {1, 2, 3, 4, 5} and Y be the set {6, 7, 8, 9, 10}. The unary function f : X → Y and the binary function
g : X × Y → Y are described in the following tables.
10.19.8 Michael Sipser: Michael Sipser Edition 3 Exercise 0 Question 7 (Page No. 26) https://gateoverflow.in/309907
10.19.9 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 1 (Page No. 83) https://gateoverflow.in/310434
The following are the state diagrams of two DFAs, M1, and M2. Answer the following questions about each of these
machines.
10.19.10 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 12 (Page No. 85) https://gateoverflow.in/310457
Let D = {w ∣ w contains an even number of a’s and an odd number of b’s and does not contain the substring ab}.
Give a DFA with five states that recognizes D and a regular expression that generates D. (Suggestion: Describe D
more simply. )
10.19.11 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 15 (Page No. 85) https://gateoverflow.in/310461
Give a counterexample to show that the following construction fails to prove Theorem 1.49, the closure of the class of
regular languages under the star operation. Let N1 = (Q1 , Σ, δ1 , q1 , F1 ) recognize A1 . Construct
N = (Q1 , Σ, δ, q1 , F) as
follows. N is supposed to recognize A∗1 .
In other words, you must present a finite automaton, N1, for which the constructed automaton N does not recognize the star
′
of N1s language.
Give regular expressions generating the languages of the alphabet is {0, 1}.
10.19.13 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 2 (Page No. 83) https://gateoverflow.in/310435
10.19.14 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 20 (Page No. 86) https://gateoverflow.in/310466
For each of the following languages, give two strings that are members and two strings that are not members—a total of
four strings for each part. Assume the alphabet Σ = {a, b} in all parts.
a. a∗ b∗ b. a(ba)∗ b
c. a∗ ∪ b∗ d. (aaa)∗
∗ ∗ ∗ ∗
e. ∑ a ∑ b ∑ a ∑ f. aba ∪ bab
g. (ϵ ∪ a)b
∗
h. (a ∪ ba ∪ bb) ∑
michael-sipser theory-of-computation regular-languages regular-expressions
10.19.15 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 21 (Page No. 86) https://gateoverflow.in/310467
Use the procedure described in Lemma 1.60 to convert the following finite automata to regular expressions.
In certain programming languages, comments appear between delimiters such as /# and #/. Let C be the language of
all valid delimited comment strings. A member of C must begin with /# and end with #/ but have no intervening
#/. For simplicity, assume that the alphabet for C is Σ = {a, b, /, # }.
a. Give a DFA that recognizes C.
b. Give a regular expression that generates C.
michael-sipser theory-of-computation regular-expressions finite-automata
10.19.17 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 23 (Page No. 87) https://gateoverflow.in/310469
10.19.18 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 31 (Page No. 88) https://gateoverflow.in/310916
For any string w = w1 w2 ⋅ ⋅ ⋅ wn , the reverse of w, written wR , is the string w in reverse order , wn ⋅ ⋅ ⋅ w2 w1 . For
any language A, let AR = {wR |w ∈ A}. Show that if A is regular , so is AR .
10.19.19 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 32 (Page No. 88) https://gateoverflow.in/310917
∑3 contains all size 3 columns of 0′ s and 1′ s. A string of symbols in ∑3 gives three rows of 0′ s and 1′ s. Consider each row
to be a binary number and let
B = {w ∈ ∑∗3 |the bottom row of w is the sum of the top two rows}.
Show that B is regular. (Hint:Working with BR is easier. You may assume the result claimed in question 31)
10.19.20 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 33 (Page No. 89) https://gateoverflow.in/310918
0 0 1 1
Let ∑2 = { [ ] , [ ] , [ ] , [ ] } .
0 1 0 1
Here ∑2 contains all columns of 0′ s and 1′ s of height two . A string of symbols in ∑2 gives two rows of 0′ s and 1′ s.
Consider each row to be a binary number and let
C = {w ∈ ∑∗2 |the bottom row of w is three times the top two rows}.
0 0 1 0 0 0 1
For example, [ ] [ ] [ ] [ ] ∈ C, but [ ] [ ] [ ] ∉ C
0 1 1 0 1 1 0
Show that C is regular. (You may assume the result claimed in question 31)
10.19.21 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 34 (Page No. 89) https://gateoverflow.in/310919
0 0 1 1
Let ∑2 = { [ ] , [ ] , [ ] , [ ] } .
0 1 0 1
Here ∑2 contains all columns of 0′ s and 1′ s of height two . A string of symbols in ∑2 gives two rows of 0′ s and 1′ s.
2 2
Consider each row to be a binary number and let
D = {w ∈ ∑∗2 |the top row of w is larger number than is the bottom row}.
0 1 1 0 0 0 1 0
For example, [ ] [ ] [ ] [ ] ∈ D, but [ ] [ ] [ ] [ ] ∉ D
0 0 1 0 0 1 1 0
10.19.22 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 35 (Page No. 89) https://gateoverflow.in/310920
0 0 1 1
Let ∑2 = { [ ] , [ ] , [ ] , [ ] } .
0 1 0 1
Here ∑2 contains all columns of 0′ s and 1′ s of height two . A string of symbols in ∑2 gives two rows of 0′ s and 1′ s.
Consider each row to be a binary number and let
E = {w ∈ ∑∗2 |the bottom row of w is the reverse of the top row of w}.
10.19.23 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 36 (Page No. 89) https://gateoverflow.in/310921
Let Bn = {ak |k is a multiple of n}. Show that for each n ≥ 1, the language Bn is regular .
10.19.24 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 37 (Page No. 89) https://gateoverflow.in/310922
L e t Cn = {x|x is a binary number that is a multiple of n}. Show that for each n ≥ 1, the language Cn is
regular.
michael-sipser theory-of-computation finite-automata regular-languages
10.19.25 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 42 (Page No. 89) https://gateoverflow.in/310934
For languages A and B, let the shuffle of A and B be the language {w|w = a1 b1 … ak bk , where a1 ⋅ ⋅ ⋅ ak ∈ A
and b1 ⋅ ⋅ ⋅ bk ∈ B, each ai , bi ∈ Σ∗ }.
10.19.26 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 43 (Page No. 90) https://gateoverflow.in/311020
Let A be any language. Define DROP-OUT(A) to be the language containing all strings that can be obtained by
removing one symbol from a string in A. Thus, DROP-OUT(A) = {xz|xyz ∈ A where x, z ∈ ∑∗ , y ∈ ∑ }.
Show that the class of regular languages is closed under the DROP-OUT operation. Give both a proof by picture and a more
formal proof by construction as in Theorem 1.47.
michael-sipser theory-of-computation finite-automata regular-languages proof descriptive
10.19.27 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 44 (Page No. 90) https://gateoverflow.in/311021
1
Let B and C be languages over ∑ = {0, 1}. Define B ← C = {w ∈ B| for some y ∈ C , strings w and y
1
contain equal numbers of 1′ s}. Show that the class of regular languages is closed under the ←operation.
michael-sipser theory-of-computation finite-automata regular-languages descriptive
10.19.28 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 45 (Page No. 90) https://gateoverflow.in/311022
Let A/B = {w| wx ∈ A for some x ∈ B}.Show that if A is regular and B is any language, then A/B is regular.
michael-sipser theory-of-computation finite-automata regular-languages descriptive
10.19.29 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 46 (Page No. 90) https://gateoverflow.in/311023
Prove that the following languages are not regular. You may use the pumping lemma and the closure of the class of
regular languages under union, intersection,and complement.
a. {0n 1m 0n |m, n ≥ 0} b. {0m 1n |m ≠ n}
c. {w|w ∈ {0, 1}∗ is not a palindrome} d. {wtw|w, t ∈ {0, 1}+ }
michael-sipser theory-of-computation finite-automata regular-languages proof
10.19.30 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 47 (Page No. 90) https://gateoverflow.in/311024
Let ∑ = {1, #} and let Y = {w|w = x1 #x2 #. . . #xk for k ≥ 0, each xi ∈ 1∗ , and xi ≠ xj for i ≠ j}.
Prove that Y is not regular.
michael-sipser theory-of-computation finite-automata regular-languages proof
10.19.31 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 48 (Page No. 90) https://gateoverflow.in/311025
Let ∑ = {0, 1} and let D = {w|w contains an equal number of occurrences of the sub strings 01 and 10}.
Thus 101 ∈ D because 101 contains a single 01 and a single 10, but 1010 ∉ D because 1010 contains two 10′ s and
one 01. Show that D is a regular language.
michael-sipser theory-of-computation finite-automata regular-languages proof descriptive
10.19.32 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 49 (Page No. 90) https://gateoverflow.in/311027
a. Let B = {1k y|y ∈ {0, 1}∗ and y contains at least k 1′ s, for every k ≥ 1}. Show that B is a regular language.
b. Let C = {1k y|y ∈ {0, 1}∗ and y contains at most k 1′ s, for every k ≥ 1}. Show that C isn’t a regular language.
10.19.33 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 5 (Page No. 84) https://gateoverflow.in/310439
Each of the following languages is the complement of a simpler language. In each part, construct a DFA for the
simpler language, then use it to give the state diagram of a DFA for the language given. In all parts, Σ = a, b.
10.19.34 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 51 (Page No. 90) https://gateoverflow.in/311031
Let x and y be strings and let L be any language. We say that x and y are distinguishable by L if some string z
exists whereby exactly one of the strings xz and yz is a member of L; otherwise, for every string z, we have xz ∈ L
whenever yz ∈ L and we say that x and y are indistinguishable by L. If x and y are indistinguishable by L, we write
x ≡ Ly . Show that ≡ L is an equivalence relation.
A palindrome is a string that reads the same forward and backward.
michael-sipser theory-of-computation finite-automata proof descriptive
10.19.35 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 52 (Page No. 91) https://gateoverflow.in/311032
Myhill–Nerode theorem. Refer to Question 51.Let L be a language and let X be a set of strings. Say that X is
pairwise distinguishable by L if every two distinct strings in X are distinguishable by L. Define the index of L to
be the maximum number of elements in any set that is pairwise distinguishable by L. The index of L may be finite or infinite.
a. Show that if L is recognized by a DFA with k states, L has index at most k.
b. Show that if the index of L is a finite number k, it is recognized by a DFA with k states .
c. Conclude that L is regular iff it has finite index. Moreover, its index is the size of the smallest DFA recognizing it .
10.19.36 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 53 (Page No. 91) https://gateoverflow.in/311033
Let ∑ = {0, 1, +, =} and ADD = {x = y + z|x, y, z are binary integers,and x is the sum of y and z}. Show
that ADD is not a regular.
michael-sipser theory-of-computation finite-automata regular-languages proof descriptive
10.19.37 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 56 (Page No. 91) https://gateoverflow.in/311037
10.19.38 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 57 (Page No. 92) https://gateoverflow.in/311038
10.19.39 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 58 (Page No. 92) https://gateoverflow.in/311039
If A is any language,let A 1 − 1 be the set of all strings in A with their ,middle thirds removed so that
2 3
A 1 − 1 = {xz|for some y,|x|=|y|=|z| and xyz ∈ A}. Show that if A is regular,then A 1 − 1 is not necessarily
2 3 2 3
regular.
michael-sipser theory-of-computation regular-languages proof descriptive
10.19.40 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 61 (Page No. 92) https://gateoverflow.in/311042
Let Σ = {a, b}. For each k ≥ 1, let Ck be the language consisting of all strings that contain an a exactly k places from
the right-hand end. Thus Ck = ∑∗ a ∑k−1 . Prove that for each k, no DFA can recognize Ck with fewer than 2k
states.
michael-sipser theory-of-computation finite-automata proof descriptive
10.19.41 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 62 (Page No. 92) https://gateoverflow.in/311043
Let ∑ = {a, b}. For each k ≥ 1, let Dk be the language consisting of all strings that have at least one a among the
last k symbols .Thus Dk = ∑∗ a(∑ ∪ϵ)k−1 .Describe a DFA with at most k + 1 states that recognizes Dk in terms
of both a state diagram and a formal description.
michael-sipser theory-of-computation finite-automata descriptive
10.19.42 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 63 (Page No. 92) https://gateoverflow.in/311044
a. Let A be an infinite regular language. Prove that A can be split into two infinite disjoint regular subsets.
b. Let B and D be two languages. Write B ⫅ D if B ⊆ D and D contains infinitely many strings that are not in B. Show
that if B and D are two regular languages where B ⫅ D, then we can find a regular language C where B ⫅ C ⫅ D.
10.19.44 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 71 (Page No. 93) https://gateoverflow.in/311055
Let ∑ = {0, 1}
10.19.45 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 72 (Page No. 93) https://gateoverflow.in/311056
Let M1 and M2 be DFA's that have k1 and k2 states, respectively, and then let U = L(M1 ) ∪ L(M2 ).
a. Show that if U ≠ ϕ then U contains some string s, where |s| < max(k1, k2).
b. Show that if U ≠ ∑∗ , then U excludes some string s, where |s| < k1k2.
10.19.46 Michael Sipser: Michael Sipser Edition 3 Exercise 1 Question 73 (Page No. 93) https://gateoverflow.in/311057
¯¯¯¯
Let ∑ = {0, 1, #}. Let C = {x#xR #x|x ∈ {0, 1}∗ }. Show that C is a CFL.
10.19.47 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 16 (Page No. 156) https://gateoverflow.in/311274
Show that the class of context-free languages is closed under the regular operations, union, concatenation, and star .
michael-sipser theory-of-computation context-free-languages
10.19.48 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 17 (Page No. 156) https://gateoverflow.in/311275
Use the results of Question 16 to give another proof that every regular language is context free , by showing how to
convert a regular expression directly to an equivalent context-free grammar.
michael-sipser theory-of-computation regular-languages context-free-languages
10.19.49 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 18 (Page No. 156) https://gateoverflow.in/311276
a. Let C be a context-free language and R be a regular language . Prove that the language C ∩ R is context-free.
b. Let A = {w ∣ w ∈ {a, b, c}∗ and w contains equal numbers of a′ s, b′ s, and c′ s}. Use part (a) to show that A is
not a CFL.
10.19.50 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 2 (Page No. 154) https://gateoverflow.in/311059
a. Use the languages A = {am bn cn |m, n ≥ 0} and B = {an bn cm |m, n ≥ 0} together with Example 2.36 to show that
the class of context-free languages is not closed under intersection.
b. Use part (a) and DeMorgan’s law (Theorem 0.20) to show that the class of context-free languages is not closed under
complementation.
Let A/B = {w ∣ wx ∈ A for some x ∈ B}. Show that if A is context free and B is regular , then A/B is context
free.
michael-sipser theory-of-computation context-free-languages regular-languages
10.19.52 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 23 (Page No. 157) https://gateoverflow.in/311282
Let D = {xy ∣ x, y ∈ {0, 1}∗ and ∣x ∣=∣ y∣ but x ≠ y}. Show that D is a context-free language .
10.19.53 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 24 (Page No. 157) https://gateoverflow.in/311284
10.19.54 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 31 (Page No. 157) https://gateoverflow.in/311297
Let B be the language of all palindromes over {0, 1} containing equal numbers of 0′ s and 1′ s. Show that B is not
context free.
michael-sipser theory-of-computation context-free-languages
10.19.55 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 32 (Page No. 157) https://gateoverflow.in/311298
L e t Σ = {1, 2, 3, 4} and C = {w ∈ Σ∗ ∣
in w, the number of 1′ s equals the number of 2′ s, and the number of 3′ s equals the number of 4′ s}. Show
that C is not context free .
michael-sipser theory-of-computation context-free-languages proof
10.19.56 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 33 (Page No. 157) https://gateoverflow.in/311299
Show that F = {ai bj ∣ i = kj for some positive integer k} is not context free .
10.19.57 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 41 (Page No. 158) https://gateoverflow.in/323430
10.19.58 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 42 (Page No. 158) https://gateoverflow.in/323431
10.19.59 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 43 (Page No. 158) https://gateoverflow.in/323432
For strings w4andt,4 write w ≗ t if the symbols of w are a permutation of the symbols of t. In other words, w ≗ t if
t and $w4 have the same symbols in the same quantities, but possibly in a different order.
For any string w, define SCRAMBLE(w) = {t ∣ t ≗ w}. For any language A, let
SCRAMBLE(A) = {t ∣ tinSCRAMBLE(w)for somew ∈ A} .
a. Show that if Σ = {0, 1} , then the SCRAMBLE of a regular language is context free.
b. What happens in part (a) if Σ contains three or more symbols? Prove your answer.
I f A and B are languages, define A ⋄ B = {xy ∣ x ∈ A and y ∈ B and ∣ x ∣=∣ y ∣} . Show that if A and B are
regular languages, then A ⋄ B is a CFL.
michael-sipser theory-of-computation regular-languages proof
10.19.61 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 45 (Page No. 158) https://gateoverflow.in/323434
Let A = {wtwR ∣ w, t ∈ {0, 1}∗ and ∣ w ∣=∣ t ∣} . Prove that A is not a CFL.
10.19.62 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 48 (Page No. 159) https://gateoverflow.in/323438
Let Σ = {0, 1} . Let C1 be the language of all strings that contain a 1 in their middle third. Let C2 be the language of
all strings that contain two 1s in their middle third.So
C1 = {xyz ∣ x, z ∈ Σ∗ and y ∈ Σ∗ 1Σ∗ , where ∣ x ∣=∣ z ∣ ≥ ∣ y ∣} and
C2 = {xyz ∣ x, z ∈ Σ∗ and y ∈ Σ∗ 1Σ∗ 1Σ∗ , where ∣ x ∣=∣ z ∣ ≥ ∣ y ∣} .
10.19.63 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 56 (Page No. 160) https://gateoverflow.in/323450
Let A = L(G1 ) where G1 is defined in Question 2.55. Show that A is not a DCFL.(Hint: Assume that A is a DCFL
and consider its DPDA P . Modify P so that its input alphabet is {a, b, c}. When it first enters an accept state, it
pretends that c′ s are b′ s in the input from that point on. What language would the modified P accept?)
michael-sipser theory-of-computation context-free-languages descriptive
10.19.64 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 57 (Page No. 160) https://gateoverflow.in/323451
10.19.65 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 58 (Page No. 160) https://gateoverflow.in/323452
Let C = {wwR ∣ win{0, 1}∗ } . Prove that C is not a DCFL. (Hint: Suppose that when some DPDA P is started in
state q with symbol x on the top of its stack, P never pops its stack below x, no matter what input string P reads from
that point on. In that case, the contents of P ′ s stack at that point cannot affect its subsequent behavior, so P ′ s subsequent
behavior can depend only on q and x.)
michael-sipser theory-of-computation context-free-languages descriptive
10.19.66 Michael Sipser: Michael Sipser Edition 3 Exercise 2 Question 9 (Page No. 155) https://gateoverflow.in/311116
Give a context-free grammar that generates the language A = {ai bj ck ∣ i = j or j = k where i, j, k ≥ 0}. Is your
grammar ambiguous? Why or why not ?
michael-sipser theory-of-computation context-free-languages ambiguous grammar
10.19.67 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 1 (Page No. 187) https://gateoverflow.in/323454
This exercise concerns TM M2 , whose description and state diagram appear in Example 3.7. In each of the parts, give
the sequence of configurations that M2 enters when started on the indicated input string.
a. 0 b. 00 c. 000 d. 000000
michael-sipser theory-of-computation turing-machine descriptive
10.19.68 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 10 (Page No. 188) https://gateoverflow.in/323633
Say that a write-once Turing machine is a single-tape TM that can alter each tape square at most once (including the
input portion of the tape). Show that this variant Turing machine model is equivalent to the ordinary Turing machine
model. (Hint: As a first step, consider the case whereby the Turing machine may alter each tape square at most twice. Use lots
of tape.)
michael-sipser theory-of-computation turing-machine descriptive
10.19.69 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 15 (Page No. 189) https://gateoverflow.in/323640
Show that the collection of decidable languages is closed under the operation of
10.19.70 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 18 (Page No. 190) https://gateoverflow.in/323644
Show that a language is decidable iff some enumerator enumerates the language in the standard string order.
michael-sipser theory-of-computation decidability proof
10.19.71 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 2 (Page No. 187) https://gateoverflow.in/323455
This exercise concerns TM M1 , whose description and state diagram appear in Example 3.9. In each of the parts,
give the sequence of configurations that M1 enters when started on the indicated input string.
10.19.72 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 22 (Page No. 190) https://gateoverflow.in/323650
Is A decidable? Why or why not? For the purposes of this problem, assume that the question of whether life will be found on
Mars has an unambiguous Y ES or NO answer.
michael-sipser theory-of-computation turing-machine decidability descriptive
10.19.73 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 5 (Page No. 188) https://gateoverflow.in/323458
Examine the formal definition of a Turing machine to answer the following questions, and explain your reasoning.
a. Can a Turing machine ever write the blank symbol ⊔ on its tape?
b. Can the tape alphabet Γ be the same as the input alphabet Σ?
c. Can a Turing machine’s head ever be in the same location in two successive steps?
d. Can a Turing machine contain just a single state?
10.19.74 Michael Sipser: Michael Sipser Edition 3 Exercise 3 Question 8 (Page No. 188) https://gateoverflow.in/323631
Give implementation-level descriptions of Turing machines that decide the following languages over the alphabet
{0, 1}.
10.19.76 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 10 (Page No. 211) https://gateoverflow.in/323771
L et INFINIT EDFA = {⟨A⟩ ∣ A is a DFA and L(A) is an infinite language} . Show that INFINITEDFA
is decidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.77 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 11 (Page No. 211) https://gateoverflow.in/323772
Let INFINIT EPDA = {⟨M⟩ ∣ M is a PDA and L(M) is an infinite language} . Show that INFINITEPDA
is decidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.78 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 12 (Page No. 211) https://gateoverflow.in/323773
L e t A = {⟨M⟩ ∣ M is a DFA that doesn’t accept any string containing an odd number of 1s}.Show that A
is decidable.
michael-sipser theory-of-computation decidability proof
10.19.79 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 13 (Page No. 211) https://gateoverflow.in/323781
Let A = {⟨R, S⟩ ∣ R and S are regular expressions and L(R) ⊆ L(S)}. Show that A is decidable.
10.19.80 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 16 (Page No. 212) https://gateoverflow.in/323794
A = {⟨R⟩∣R is a regular expression describing a language containing at least one string w that has 111 as a substring
Show that A is decidable.
michael-sipser theory-of-computation decidability proof
10.19.81 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 17 (Page No. 212) https://gateoverflow.in/323796
Prove that EQDFA is decidable by testing the two DFAs on all strings up to a certain size. Calculate a size that works.
michael-sipser theory-of-computation finite-automata decidability proof
10.19.82 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 19 (Page No. 212) https://gateoverflow.in/323799
Prove that the class of decidable languages is not closed under homomorphism.
michael-sipser theory-of-computation decidability proof
10.19.83 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 2 (Page No. 211) https://gateoverflow.in/323652
Consider the problem of determining whether a DFA and a regular expression are equivalent. Express this problem as a
language and show that it is decidable.
michael-sipser theory-of-computation finite-automata regular-expressions decidability proof
10.19.84 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 21 (Page No. 212) https://gateoverflow.in/323802
Let S = {⟨M⟩ ∣ M is a DFA that accepts wR whenever it accepts w} . Show that S is decidable.
10.19.85 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 22 (Page No. 212) https://gateoverflow.in/323803
L e t P REFIX − FREEREX = {⟨R⟩ ∣ R is a regular expression and L(R) is prefix-free} . Show that
P REFIXFREEREX is decidable. Why does a similar approach fail to show that P REFIX − FREECFG is
decidable?
michael-sipser theory-of-computation regular-expressions decidability proof
10.19.86 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 25 (Page No. 212) https://gateoverflow.in/323821
Let BALDFA = {⟨M⟩ ∣ M is a DFA that accepts some string containing an equal number of 0s and 1s}.
Show that BALDFA is decidable. (Hint: Theorems about CFLs are helpful here.)
michael-sipser theory-of-computation finite-automata decidability proof
10.19.87 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 26 (Page No. 212) https://gateoverflow.in/323822
Let P ALDFA = {⟨M⟩ ∣ M is a DFA that accepts some palindrome}. Show that P ALDFA is decidable. (Hint:
Theorems about CFLs are helpful here.)
michael-sipser theory-of-computation finite-automata decidability proof
10.19.88 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 27 (Page No. 212) https://gateoverflow.in/323823
L e t E = {⟨M⟩ ∣ M is a DFA that accepts some string with more 1s than 0s}. Show that E is decidable.
(Hint: Theorems about CFLs are helpful here.)
michael-sipser theory-of-computation finite-automata decidability proof
10.19.89 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 3 (Page No. 211) https://gateoverflow.in/323654
Let ALLDFA = {⟨A⟩ ∣ A is a DFA and L(A) = Σ∗ }. Show that ALLDFA is decidable.
10.19.90 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 6 (Page No. 211) https://gateoverflow.in/323767
L et X be the set {1, 2, 3, 4, 5} and Y be the set {6, 7, 8, 9, 10} . We describe the functions f : X → Y and
g : X → Y in the following tables. Answer each part and give a reason for each negative answer.
f
n
(n)
1 6
2 7
3 6
4 7
5 6
n g(n)
1 10
2 9
3 8
4 7
5 6
a. Is f one-to-one? b. Is f onto?
c. Is f a correspondence? d. Is g one-to-one?
e. Is g onto? f. Is g a correspondence?
michael-sipser theory-of-computation turing-machine proof
10.19.91 Michael Sipser: Michael Sipser Edition 3 Exercise 4 Question 7 (Page No. 211) https://gateoverflow.in/323768
Let B be the set of all infinite sequences over {0, 1}. Show that B is uncountable using a proof by diagonalization.
10.19.92 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 10 (Page No. 239) https://gateoverflow.in/323973
Consider the problem of determining whether a two-tape Turing machine ever writes a nonblank symbol on its second
tape when it is run on input w. Formulate this problem as a language and show that it is undecidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.93 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 11 (Page No. 239) https://gateoverflow.in/323974
Consider the problem of determining whether a two-tape Turing machine ever writes a nonblank symbol on its second
tape during the course of its computation on any input string. Formulate this problem as a language and show that it is
undecidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.94 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 12 (Page No. 239) https://gateoverflow.in/323975
Consider the problem of determining whether a single-tape Turing machine ever writes a blank symbol over a nonblank
symbol during the course of its computation on any input string. Formulate this problem as a language and show that it
is undecidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.95 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 13 (Page No. 239) https://gateoverflow.in/323976
A useless state in a Turing machine is one that is never entered on any input string. Consider the problem of
determining whether a Turing machine has any useless states. Formulate this problem as a language and show that it is
undecidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.96 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 14 (Page No. 240) https://gateoverflow.in/323977
Consider the problem of determining whether a Turing machine M on an input w ever attempts to move its head left
when its head is on the left-most tape cell. Formulate this problem as a language and show that it is undecidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.97 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 15 (Page No. 240) https://gateoverflow.in/323978
Consider the problem of determining whether a Turing machine M on an input w ever attempts to move its head left at
any point during its computation on w. Formulate this problem as a language and show that it is decidable.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.98 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 20 (Page No. 240) https://gateoverflow.in/323984
10.19.99 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 26 (Page No. 240) https://gateoverflow.in/324073
Define a two-headed finite automaton (2DFA) to be a deterministic finite automaton that has two read-only,
bidirectional heads that start at the left-hand end of the input tape and can be independently controlled to move in either
direction. The tape of a 2DFA is finite and is just large enough to contain the input plus two additional blank tape cells, one
on the left-hand end and one on the right-hand end, that serve as delimiters. A 2DFA accepts its input by entering a special
accept state. For example, a 2DFA can recognize the language {an bn cn ∣ n ≥ 0} .
a. Let A2DFA = {⟨M, x⟩ ∣ M is a 2DFA and M accepts x}. Show that A2DFA is decidable.
b. Let E2DFA = {⟨M⟩ ∣ M is a 2DFA and L(M) = ∅} . Show that E2DFA is not decidable.
10.19.100 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 27 (Page No. 241) https://gateoverflow.in/324074
A two-dimensional finite automaton (2DIM − DFA) is defined as follows. The input is an m × n rectangle, for
any m, n ≥ 2 . The squares along the boundary of the rectangle contain the symbol # and the internal squares contain
symbols over the input alphabet Σ. The transition function δ : Q × (Σ ∪ #) → Q × {L, R, U, D} indicates the next state
and the new head position (Left, Right, Up, Down). The machine accepts when it enters one of the designated accept states. It
rejects if it tries to move off the input rectangle or if it never halts. Two such machines are equivalent if they accept the same
rectangles. Consider the problem of determining whether two of these machines are equivalent. Formulate this problem as a
language and show that it is undecidable.
10.19.101 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 31 (Page No. 241) https://gateoverflow.in/324080
Let
3x + 1 for odd x
f(x) = { x
for even x
2
for any natural number x. If you start with an integer x and iterate f , you obtain a sequence, x, f(x), f(f(x)), … Stop if you
ever hit 1. For example, if x = 17 , you get the sequence 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 . Extensive computer tests
have shown that every starting point between 1 and a large positive integer gives a sequence that ends in 1. But the question of
whether all positive starting points end up at 1 is unsolved; it is called the 3x + 1 problem. Suppose that ATM were
decidable by a TM H . Use H to describe a TM that is guaranteed to state the answer to the 3x + 1 problem.
michael-sipser theory-of-computation turing-machine decidability proof
10.19.102 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 34 (Page No. 241) https://gateoverflow.in/324085
X = {⟨M, w⟩ ∣ M is a single-tape TM that never modifies the portion of the tape that contains the input w }
10.19.103 Michael Sipser: Michael Sipser Edition 3 Exercise 5 Question 9 (Page No. 239) https://gateoverflow.in/323972
Let T = {⟨M⟩ ∣ M is a TM that accepts wR whenever it accepts w}. Show that T is undecidable.
10.20.1 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 11 (Page No. 85) https://gateoverflow.in/310453
Prove that every NFA can be converted to an equivalent one that has a single accept state.
michael-sipser theory-of-computation nfa-dfa proof
10.20.2 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 13 (Page No. 85) https://gateoverflow.in/310458
Let F be the language of all strings over {0, 1} that do not contain a pair of 1′ s that are separated by an odd number
of symbols. Give the state diagram of a DFA with five states that recognizes F. (You may find it helpful first to find
a 4-state NFA for the complement of F. )
a. Show that if M is a DFA that recognizes language B, swapping the accept and not accept states in M yields a new DFA
recognizing the complement of B. Conclude that the class of regular languages is closed under complement.
b. Show by giving an example that if M is an NFA that recognizes language C, swapping the accept and not accept states in
M doesn’t necessarily yield a new NFA that recognizes the complement of C. Is the class of languages recognized by
NF A′ s closed under complement? Explain your answer .
10.20.4 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 16 (Page No. 86) https://gateoverflow.in/310462
Use the construction given in Theorem 1.39 to convert the following two non-deterministic finite automata to
equivalent deterministic finite automata.
10.20.5 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 17 (Page No. 86) https://gateoverflow.in/310463
10.20.6 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 19 (Page No. 86) https://gateoverflow.in/310465
Use the procedure described in Lemma 1.55 to convert the following regular expressions to non-deterministic finite
automata.
10.20.7 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 28 (Page No. 88) https://gateoverflow.in/310476
a. a(abb)∗ ∪ b
b. a+ ∪ (ab)+
c. (a ∪ b+ )a+ b+
10.20.8 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 38 (Page No. 89) https://gateoverflow.in/310923
An all-NFA M is a 5-tuple (Q, Σ, δ, q0 , F) that accepts x ∈ ∑∗ if every possible state that M could be in after
reading input x is a state from F. Note , in contrast, that an ordinary NFA accepts a string if some state among these possible
states is an accept state. Prove that all-NFAs recognize the class of regular languages .
michael-sipser theory-of-computation finite-automata nfa-dfa regular-languages
10.20.9 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 60 (Page No. 92) https://gateoverflow.in/311041
Let Σ = {a, b}. For each k ≥ 1, let Ck be the language consisting of all strings that contain an a exactly k places from
the right-hand end. Thus Ck = ∑∗ a ∑k−1 . Describe an NFA with k + 1 states that recognizes Ck in terms of both a
state diagram and a formal description.
michael-sipser theory-of-computation finite-automata nfa-dfa descriptive
10.20.10 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 64 (Page No. 92) https://gateoverflow.in/311045
10.20.11 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 65 (Page No. 93) https://gateoverflow.in/311046
10.20.12 Nfa Dfa: Michael Sipser Edition 3 Exercise 1 Question 69 (Page No. 93) https://gateoverflow.in/311053
a. Show that for each k, no DFA can recognize WWk with fewer than 2k states.
b. Describe a much smaller NFA for ¯WW
¯¯¯¯¯¯¯¯¯¯¯
k , the complement of W Wk .
10.20.13 Nfa Dfa: Michael Sipser Edition 3 Exercise 3 Question 9 (Page No. 188) https://gateoverflow.in/323632
10.20.14 Nfa Dfa: Michael Sipser Edition 3 Exercise 4 Question 23 (Page No. 212) https://gateoverflow.in/323819
Say that an NFA is ambiguous if it accepts some string along two different computation branches. Let
AMBIGNFA = {⟨N⟩ ∣ N is an ambiguous NFA} . Show that AMBIGNFA is decidable. (Suggestion: One
elegant way to solve this problem is to construct a suitable DFA and then run EDFA on it.)
michael-sipser theory-of-computation nfa-dfa decidability proof
10.20.15 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 10 (Page No. 55) https://gateoverflow.in/211253
10.20.16 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 11 (Page No. 55) https://gateoverflow.in/307213
10.20.17 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 13 (Page No. 55) https://gateoverflow.in/307215
What is the complement of the language accepted by the nfa in the following figure:
10.20.18 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 14 (Page No. 55) https://gateoverflow.in/307216
10.20.19 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 16 (Page No. 55) https://gateoverflow.in/307217
Find an nfa that accepts {a}* and is such that if in its transition graph a single edge is removed
(without any other changes), the resulting automaton accepts {a}.
Can this be solved using a dfa? If so, give the solution; if not, give convincing arguments
for your conclusion. (Question 17)
peter-linz peter-linz-edition4 theory-of-computation finite-automata nfa-dfa
10.20.20 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 18 (Page No. 55) https://gateoverflow.in/307254
An nfa with multiple initial states is defined by the quintuple M = (Q, Σ, δ, q0, F) ,
where Q0 ⊆ Q is a set of possible initial states. The language accepted by such an automaton is
defined as
Show that for every nfa with multiple initial states there exists an nfa with a single initial state
that accepts the same language.
Also, Suppose that we made the restriction Q0 ∩ F = Ø. Would this affect the
conclusion? (Question 19)
peter-linz peter-linz-edition4 theory-of-computation finite-automata nfa-dfa
10.20.21 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 20 (Page No. 56) https://gateoverflow.in/307256
10.20.22 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 7 (Page No. 55) https://gateoverflow.in/307206
Design an nfa with no more than five states for the set {ababn : n ≥ 0 } ∪ {aban : n ≥ 0 }.
Do you think this can be solved with fewer than three states? (Question 9)
peter-linz peter-linz-edition4 theory-of-computation finite-automata nfa-dfa
10.20.23 Nfa Dfa: Peter Linz Edition 4 Exercise 2.2 Question 8 (Page No. 55) https://gateoverflow.in/307207
Construct an nfa with three states that accepts the language {ab, abc}*.
peter-linz peter-linz-edition4 theory-of-computation finite-automata nfa-dfa
10.20.24 Nfa Dfa: Peter Linz Edition 4 Exercise 3.1 Question 26 (Page No. 77) https://gateoverflow.in/308393
10.20.25 Nfa Dfa: Peter Linz Edition 4 Exercise 3.2 Question 18 (Page No. 89) https://gateoverflow.in/308581
∗
Find nfa's for L(aØ) and L(Ø ). Is the result consistent with the definition of these languages?
10.20.26 Nfa Dfa: Peter Linz Edition 5 Exercise 2.2 Question 7 (Page No. 79) https://gateoverflow.in/372889
Design an nfa with no more than five states for the set {abab′′ : n > 0} ∪ {aba′′ : n ≥ 0}
10.21.1 Non Determinism: Michael Sipser Edition 3 Exercise 3 Question 3 (Page No. 187) https://gateoverflow.in/323456
Modify the proof of Theorem 3.16 to obtain Corollary 3.19, showing that a language is decidable iff some
nondeterministic Turing machine decides it. (You may assume the following theorem about trees. If every node in a
tree has finitely many children and every branch of the tree has finitely many nodes, the tree itself has finitely many nodes.)
michael-sipser theory-of-computation non-determinism turing-machine descriptive
10.22.1 Npda: Peter Linz Edition 4 Exercise 7.1 Question 10 (Page No. 184) https://gateoverflow.in/315419
δ(q2 , a, 1) = {(q3 , λ) },
δ(q3 , a, 1) = {(q4 , λ) }
10.22.2 Npda: Peter Linz Edition 4 Exercise 7.1 Question 11 (Page No. 184) https://gateoverflow.in/315420
What language is accepted by the npda M = ({q0 , q1 , q2 }, {a, b}, {a, b, z}, δ, q0 , z, {q2 }) with
transitions
δ(q1 , a, b) = {(q2 , λ) } ?
theory-of-computation peter-linz peter-linz-edition4 pushdown-automata npda
10.22.3 Npda: Peter Linz Edition 4 Exercise 7.1 Question 13 (Page No. 184) https://gateoverflow.in/315421
10.22.4 Npda: Peter Linz Edition 4 Exercise 7.1 Question 14 (Page No. 184) https://gateoverflow.in/315422
Find an npda with no more than two internal states that accepts the language L(aa∗ ba∗ ) .
10.22.5 Npda: Peter Linz Edition 4 Exercise 7.1 Question 16 (Page No. 184) https://gateoverflow.in/315423
We can define a restricted npda as one that can increase the length of the stack by at most one
symbol in each move, changing Definition 7.1 so that
δ : Q x (∑ ∪ {λ}) × Γ → 2Q×(ΓΓ∪Γ∪λ)
The interpretation of this is that the range of δ consists of sets of pairs of the form (qi , ab), (qi , a), or (qi , λ) . Show that for
every npda M there exists such a restricted npda M̂ such that L(M) = L(M̂ ) .
----------------------------------------------------------------------------------------------------------
Definition 7.1: A nondeterministic pushdown accepter (npda) is defined by the septuple
M = (Q, ∑, Γ, δ, q0 , z, F)
where,
Q is a finite set of internal states of the control unit,
Σ is the input alphabet,
Γ is a finite set of symbols called the stack alphabet,
δ : Q × (Σ∪ {λ})×Γ → set of finite subsets of Q × Γ∗ is the transition function,
q0 ∈ Q is the initial state of the control unit,
z ∈ Γ is the stack start symbol,
F ⊆ Q is the set of final states.
10.22.6 Npda: Peter Linz Edition 4 Exercise 7.1 Question 2 (Page No. 183) https://gateoverflow.in/310348
Prove that an npda for accepting the language L = { wwR : w ∈ {a, b}+ } does not accept any string not in { wwR }.
peter-linz peter-linz-edition4 theory-of-computation pushdown-automata npda
10.22.7 Npda: Peter Linz Edition 4 Exercise 7.1 Question 3 (Page No. 183) https://gateoverflow.in/310350
10.22.8 Npda: Peter Linz Edition 4 Exercise 7.1 Question 3.c,3.d,4.f,4.j (Page No. 183) https://gateoverflow.in/136728
Q3) Given,
L1 = (aaa∗ b)
L2 = (aab∗ aba∗ )
f) L = {an bm : n ≤ m ≤ 3n}
10.22.9 Npda: Peter Linz Edition 4 Exercise 7.1 Question 4 (Page No. 183) https://gateoverflow.in/310351
10.22.10 Npda: Peter Linz Edition 4 Exercise 7.1 Question 4.h(Page No. 183) https://gateoverflow.in/127493
L = { w : na (w) = 2 ∗ nb (w) }
peter-linz peter-linz-edition4 theory-of-computation pushdown-automata npda
10.22.11 Npda: Peter Linz Edition 4 Exercise 7.1 Question 5 (Page No. 183) https://gateoverflow.in/310352
10.22.12 Npda: Peter Linz Edition 4 Exercise 7.1 Question 6 (Page No. 183) https://gateoverflow.in/310353
Find an npda for the concatenation of L(a∗ ) and the language in Exercise 6.
10.22.14 Npda: Peter Linz Edition 4 Exercise 7.1 Question 8 (Page No. 183) https://gateoverflow.in/310355
10.22.15 Npda: Peter Linz Edition 4 Exercise 7.1 Question 9 (Page No. 183) https://gateoverflow.in/310356
Is it possible to find a dfa that accepts the same language as the pda
10.22.16 Npda: Peter Linz Edition 4 Exercise 7.2 Question 10 (Page No. 195) https://gateoverflow.in/315432
10.22.17 Npda: Peter Linz Edition 4 Exercise 7.2 Question 11,12,13 (Page No. 195) https://gateoverflow.in/315479
10.22.18 Npda: Peter Linz Edition 4 Exercise 7.2 Question 14 (Page No. 195) https://gateoverflow.in/315481
10.22.19 Npda: Peter Linz Edition 4 Exercise 7.2 Question 15 (Page No. 195) https://gateoverflow.in/315482
Find a context-free grammar that generates the language accepted by the npda M = ({q0 , q1 }, {a, b}, {A, z}, δ, q0 , z,
{q1 }), with transitions
δ(q0 , a, z) = {(q0 , Az)},
δ(q0 , b, A) = {(q0 , AA)},
δ(q0 , a, A) = {(q1 , λ) }.
peter-linz peter-linz-edition4 theory-of-computation pushdown-automata npda
10.22.20 Npda: Peter Linz Edition 4 Exercise 7.2 Question 17 (Page No. 196) https://gateoverflow.in/315483
10.22.21 Npda: Peter Linz Edition 4 Exercise 7.2 Question 18 (Page No. 196) https://gateoverflow.in/315484
Give a construction by which an arbitrary context-free grammar can be used in the proof of Theorem 7.1.
Theorem 7.1: For any context-free language L, there exists an npda M such that L = L (M).
10.22.22 Npda: Peter Linz Edition 4 Exercise 7.2 Question 3 (Page No. 195) https://gateoverflow.in/315426
S → aSbb|aab .
peter-linz peter-linz-edition4 theory-of-computation pushdown-automata npda
10.22.23 Npda: Peter Linz Edition 4 Exercise 7.2 Question 4 (Page No. 195) https://gateoverflow.in/315427
Construct an npda that accepts the language generated by the grammar S → aSSS|ab .
10.22.24 Npda: Peter Linz Edition 4 Exercise 7.2 Question 5 (Page No. 195) https://gateoverflow.in/315428
S → aABB|aAA,
A → aBB|a,
B → bBB|A.
peter-linz peter-linz-edition4 theory-of-computation pushdown-automata npda
10.22.25 Npda: Peter Linz Edition 4 Exercise 7.2 Question 6 (Page No. 195) https://gateoverflow.in/209264
S → AA|a
A → SA|b
10.22.26 Npda: Peter Linz Edition 4 Exercise 7.2 Question 7,8 (Page No. 195) https://gateoverflow.in/315430
7. Show that “For every npda M , there exists an npda M̂ with at most three states, such that L(M) = L(M̂ ) .
8. Show how the number of states of M̂ in the above exercise can be reduced to two.
10.22.27 Npda: Peter Linz Edition 4 Exercise 7.2 Question 9 (Page No. 195) https://gateoverflow.in/315431
Find an npda with two states for the language L = {an bn+1 : n ≥ 0 }.
peter-linz peter-linz-edition4 theory-of-computation pushdown-automata npda
10.23 Parse Trees (1)
10.23.1 Parse Trees: Michael Sipser Edition 3 Exercise 2 Question 1 (Page No. 154) https://gateoverflow.in/311058
Recall the CFG G4 that we gave in Example 2.4. For convenience,let’s rename it’s variable with single letters as
follows,
E → E + T |T
T → T × F |F
F → (E)|a
Give parse trees and derivations for each string.
a. a b. a + a c. a + a + a d. ((a))
michael-sipser theory-of-computation context-free-grammars parse-trees
10.24.1 Perfect Shuffle: Michael Sipser Edition 3 Exercise 1 Question 41 (Page No. 89) https://gateoverflow.in/310932
For languages A and B, let the perfect shuffle of A and B be the language
Show that the class of regular languages is closed under perfect shuffle.
michael-sipser theory-of-computation finite-automata regular-languages perfect-shuffle
10.24.2 Perfect Shuffle: Michael Sipser Edition 3 Exercise 2 Question 38 (Page No. 158) https://gateoverflow.in/323323
For the definition of the perfect shuffle operation. For languages A and B, let the perfect shuffle of A and B be the
language
Show that the class of context-free languages is not closed under perfect shuffle.
michael-sipser theory-of-computation context-free-languages perfect-shuffle
10.25.1 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 1 (Page No. 27) https://gateoverflow.in/306439
Use induction on n to show that |un | = n|u| for all strings u and all n.
10.25.2 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 10 (Page No. 28) https://gateoverflow.in/306609
10.25.3 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 2 (Page No. 27) https://gateoverflow.in/306440
The reverse of a string can be defined more precisely by the recursive rules
aR = a ,
10.25.5 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 4 (Page No. 28) https://gateoverflow.in/306442
10.25.6 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 5 (Page No. 28) https://gateoverflow.in/306443
10.25.7 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 6 (Page No. 28) https://gateoverflow.in/306444
Let L be any language on a non-empty alphabet. Show that L and Lc cannot both be finite.
peter-linz peter-linz-edition4 theory-of-computation
10.25.8 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 7 (Page No. 28) https://gateoverflow.in/306445
10.25.9 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 8 (Page No. 28) https://gateoverflow.in/306446
10.25.10 Peter Linz Edition4: Peter Linz Edition 4 Exercise 1.2 Question 9 (Page No. 28) https://gateoverflow.in/306607
10.25.11 Peter Linz Edition4: Peter Linz Edition 4 Exercise 12.1 Question 14 (Page No. 306)
https://gateoverflow.in/244847
Consider the set of all n-state Turing machines with tape alphabet Γ = {0,1, B}. Give an
expression for m(n), the number of distinct Turing machines with this Γ.
turing-machine theory-of-computation peter-linz peter-linz-edition4
10.25.12 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 1 (Page No. 47) https://gateoverflow.in/306780
Which of the strings 0001, 01001, 0000110 are accepted by the dfa
Construct a dfa that accepts strings on {0, 1} if and only if the value of the string, interpreted as
a binary representation of an integer, is zero modulo five. For example, 0101 and 1111,
representing the integers 5 and 15, respectively, are to be accepted.
theory-of-computation peter-linz peter-linz-edition4 finite-automata
10.25.14 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 11 (Page No. 48) https://gateoverflow.in/306890
10.25.15 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 12 (Page No. 48) https://gateoverflow.in/306891
10.25.16 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 13 (Page No. 48) https://gateoverflow.in/306894
10.25.17 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 14 (Page No. 48) https://gateoverflow.in/306897
10.25.18 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 15 (Page No. 48) https://gateoverflow.in/306898
Show that the language L = {an : n is a multiple of 3, but not a multiple of 5} is regular.
peter-linz peter-linz-edition4 theory-of-computation finite-automata regular-languages
10.25.19 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 16 (Page No. 48) https://gateoverflow.in/306901
10.25.20 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 17 (Page No. 48) https://gateoverflow.in/306903
10.25.21 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 18 (Page No. 48) https://gateoverflow.in/306907
10.25.22 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 19 (Page No. 48) https://gateoverflow.in/306912
Show that
for all w, v ∈ Σ∗ .
For Σ= {a, b}, construct dfa's that accept the sets consisting of
(a) all strings with exactly one a,
(b) all strings with at least one a,
(c) all strings with no more than three a's
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.24 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 2.d, 2.e (Page No. 47)
https://gateoverflow.in/78226
(d) all strings with at least one a and exactly two b’s
(e) all the strings with exactly two a’s and more than two b’s.
theory-of-computation finite-automata peter-linz peter-linz-edition4
10.25.25 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 20 (Page No. 48) https://gateoverflow.in/306917
Let L be the language accepted by the automaton in the following figure. Find a DFA that accepts L2 .
10.25.26 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 22 (Page No. 49) https://gateoverflow.in/307186
10.25.27 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 23 (Page No. 49) https://gateoverflow.in/307187
Let GM be the transition graph for some dfa M . Prove the following:
(a) If L(M) is infinite, then GM must have at least one cycle for which there is a path from the
initial vertex to some vertex in the cycle and a path from some vertex in the cycle to some final
vertex.
(b) If L(M) is finite, then no such cycle exists.
10.25.28 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 24 (Page No. 49) https://gateoverflow.in/150582
Let us define an operation truncate, which removes the rightmost symbol from any string. For example,
truncate(aaaba) is aaab. The operation can be extended to languages by
truncate(L) = {truncate(w) : w ∈ L }
Show how, given a dfa for any regular language L, one can construct a dfa for truncate(L).
From this, prove that if L is a regular language not containing λ, then truncate(L) is also regular.
10.25.29 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 25 (Page No. 49) https://gateoverflow.in/307190
While the language accepted by a given dfa is unique, there are normally many dfa's that accept
a language. Find a dfa with exactly six states that accepts the same language as the dfa in figure:
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.30 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 3 (Page No. 47) https://gateoverflow.in/306782
10.25.31 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 5 (Page No. 47) https://gateoverflow.in/306783
10.25.32 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 6 (Page No. 47) https://gateoverflow.in/306784
With Σ = {a, b}, give a DFA for L = {w1 aw2 : |w1 | ≥ 3, |w2 | ≤ 5}.
10.25.33 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 6 (Page No. 47) https://gateoverflow.in/221167
10.25.34 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 7 (Page No. 47) https://gateoverflow.in/224683
Can you please help me. I don't understand the question statement, please explain this question's statements.
What they are trying to say in each statement
what does L={w:|w| mod 2=0} means?
Explain any one of them, please.
Chapter 2 Exercise
Question 7(a,b,c,d.e,f
Peter Linz
10.25.35 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 7 (Page No. 47) https://gateoverflow.in/70269
Plez Tell someone briefly ..............though i have already the anwers but i couldn't get it properlyyy
10.25.36 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 7.e (Page No. 47) https://gateoverflow.in/204864
Please help in creating the DFA for (na (w)-nb (w))mod 3>0
theory-of-computation peter-linz peter-linz-edition4 finite-automata
10.25.37 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 8 (Page No. 47) https://gateoverflow.in/306788
A run in a string is a substring of length at least two, as long as possible and consisting entirely
of the same symbol. For instance, the string abbbaab contains a run of b's of length three and a run
of a's of length two. Find dfa's for the following languages on { a, b}.
10.25.38 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 8.c (Page No. 47) https://gateoverflow.in/215467
10.25.39 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.1 Question 9 (Page No. 48) https://gateoverflow.in/220142
Consider the set of strings on {0, 1} defined by the requirements below. For each, construct an
accepting dfa.
(a) Every 00 is followed immediately by a 1. For example, the strings 101, 0010, 0010011001
are in the language, but 0001 and 00100 are not.
(b) All strings containing 00 but not 000.
(c) The leftmost symbol differs from the rightmost one.
(d) Every substring of four symbols has at most two 0’s. For example, 001110 and 011001 are
in the language, but 10010 is not since one of its substrings, 0010, contains three zeros.
(e) All strings of length five or more in which the fourth symbol from the right end is different
from the leftmost symbol.
(f) All strings in which the leftmost two symbols and the rightmost two symbols are identical.
(g) All strings of length four or greater in which the leftmost three symbols are the same, but
different from the rightmost symbol.
theory-of-computation peter-linz peter-linz-edition4 finite-automata
10.25.40 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.2 Question 2 (Page No. 55) https://gateoverflow.in/307196
Find a dfa that accepts the language defined by the nfa in figure:
10.25.41 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.2 Question 21 (Page No. 56) https://gateoverflow.in/307257
An nfa in which (a) there are no λ-transitions, and (b) for all q ∈ Q and all a ∈ Σ , δ(q, a)contains
at most one element, is sometimes called an incomplete dfa. This is reasonable since the
conditions make it such that there is never any choice of moves.
For Σ = {a, b}, convert the incomplete dfa below into a standard dfa
10.25.42 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.2 Question 3 (Page No. 55) https://gateoverflow.in/307198
Find a dfa that accepts the complement of the language defined by the nfa in figure:
10.25.43 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.2 Question 4 (Page No. 55) https://gateoverflow.in/307200
10.25.44 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.2 Question 5 (Page No. 55) https://gateoverflow.in/307203
∗ ∗
In following figure, find δ (q0 , a) and δ (q1 , λ)
10.25.45 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.2 Question 6 (Page No. 55) https://gateoverflow.in/307205
For the nfa in following figure, find δ∗ (q0 , 1010) and δ∗ (q1 , 00)
10.25.46 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 1 (Page No. 62) https://gateoverflow.in/307259
Theorem: Let L be the language accepted by a nondeterministic finite accepter MN = (QN , Σ, δN, q0, FN ) . Then
there exists a deterministic finite accepter MD = (QD , Σ, δD , {q0 }, FD ) such that
L = L(MD ) .
convert the nfa in following figure to a dfa:
10.25.47 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 10 (Page No. 62) https://gateoverflow.in/307913
Define a dfa with multiple initial states in an analogous way to the corresponding nfa in Exercise
18, Section 2.2. Does there always exist an equivalent dfa with a single initial state?
10.25.48 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 11 (Page No. 62) https://gateoverflow.in/308000
10.25.50 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 13 (Page No. 62) https://gateoverflow.in/308003
Give a simple verbal description of the language accepted by the dfa in following figure.
Use this to find another dfa, equivalent to the given one, but with fewer states.
10.25.51 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 14 (Page No. 62) https://gateoverflow.in/308004
Let L be any language. Define even(w) as the string obtained by extracting from w the letters in
even-numbered positions; that is, if
w = a1 a2 a3 a4 … ,
then
even(w) = a2 a4 . …
Corresponding to this, we can define a language
even(L) = {even(w) : w ∈ L }.
Prove that if L is regular, so is even(L).
10.25.52 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 15 (Page No. 63) https://gateoverflow.in/242979
From a language L we create a new language chop2(L) by removing the two leftmost symbols of
every string in L. Specifically,
10.25.53 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 2 (Page No. 62) https://gateoverflow.in/307894
10.25.54 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 3 (Page No. 62) https://gateoverflow.in/307895
10.25.55 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 4 (Page No. 62) https://gateoverflow.in/307899
Theorem: Let L be the language accepted by a nondeterministic finite accepter MN = (QN , Σ, δN , q0 , FN ) . Then
there exists a deterministic finite accepter MD = (QD , Σ, δD , {q0 }, FD ) such that
L = L(MD ) .
Prove this Theorem.
∗ (q , w) contains q , then δ ∗ (q , w) also contains q .
Show in detail that if the label of δD 0 f N 0 f
10.25.56 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 5 (Page No. 62) https://gateoverflow.in/307903
Is it true that for any nfa M = (Q, Σ, δ, q0 , F) the complement of L(M) is equal to the set
10.25.57 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 6 (Page No. 62) https://gateoverflow.in/307905
Is it true that for every nfa M = (Q, Σ, δ, q0 , F) the complement of L(M) is equal to the set
10.25.58 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 7 (Page No. 62) https://gateoverflow.in/307907
Prove that for every nfa with an arbitrary number of final states there is an equivalent nfa with only
one final state. Can we make a similar claim for dfa’s?
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.59 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 8 (Page No. 62) https://gateoverflow.in/307908
Find an nfa without λ-transitions and with a single final state that accepts the set { a} ∪ {bn : n ≥ 1 }.
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.60 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.3 Question 9 (Page No. 62) https://gateoverflow.in/307911
Let L be a regular language that does not contain λ. Show that there exists an nfa without λ-
transitions and with a single final state that accepts L.
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.61 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 1 (Page No. 68) https://gateoverflow.in/308006
10.25.62 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 10 (Page No. 69) https://gateoverflow.in/308014
Prove the following: If the states qa and qb are indistinguishable, and if qa and qc are
distinguishable, then qb and qc must be distinguishable.
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.63 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 2 (Page No. 68) https://gateoverflow.in/308008
Find minimal dfa's for the following languages. In each case prove that the result is minimal.
(a) L = {an bm : n ≥ 2, m ≥ 1 }.
(b) L = {an b : n ≥ 0 } ∪ {bn a : n ≥ 1 }
(c) L = {an : n ≥ 0, n ≠ 3 }.
(d) L = {an : n ≠ 2 and n ≠ 4 }.
(e) L = {an : n mod 3 = 0 } ∪ {an : n mod 5 = 1 }.
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.64 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 4 (Page No. 69) https://gateoverflow.in/308010
10.25.65 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 5 (Page No. 69) https://gateoverflow.in/308011
Show that if L is a nonempty language such that any w in L has length at least n, then any dfa
accepting L must have at least n + 1 states.
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.66 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 6 (Page No. 69) https://gateoverflow.in/308012
10.25.67 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 7 (Page No. 69) https://gateoverflow.in/308013
10.25.68 Peter Linz Edition4: Peter Linz Edition 4 Exercise 2.4 Question 9 (Page No. 69) https://gateoverflow.in/308015
Write a Computer program that produces a minimal dfa for any given dfa.
peter-linz peter-linz-edition4 theory-of-computation finite-automata
10.25.69 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 1 (Page No. 75) https://gateoverflow.in/308122
Find all strings in L((a + b)b(a + ab)∗ ) of length less than four.
10.25.70 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 10 (Page No. 76) https://gateoverflow.in/207494
L = {an bm ; n ≥ 1, m ≥ 1, nm ≥ 3}
10.25.71 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 11 (Page No. 76) https://gateoverflow.in/308128
10.25.72 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 12 (Page No. 76) https://gateoverflow.in/308129
Find a regular expression for the complement of the language in L(r) = {a2n b2m+1 : n ≥ 0, m ≥ 0 }.
10.25.73 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 13 (Page No. 76) https://gateoverflow.in/308130
10.25.74 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 14 (Page No. 76) https://gateoverflow.in/308131
10.25.75 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 15 (Page No. 76) https://gateoverflow.in/308132
10.25.76 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 16 (Page No. 76) https://gateoverflow.in/308133
10.25.77 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 16.c (Page No. 76)
https://gateoverflow.in/207524
Give regular expression for the following language on ∑ = {a, b, c}
10.25.78 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 16.d (Page No. 76) https://gateoverflow.in/45436
Find a regular expression over Σ ={a,b,c} for all strings that contain no run of a's of length greater than 2.
Here a run in a string is a sub string of length at least two as long as possible and consisting entirely of the same
symbol. For eg, the string abbbaab contains a run of b's of length three and a tun of a's of length two.
10.25.79 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 17 (Page No. 76) https://gateoverflow.in/308134
10.25.80 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 17.d (Page No. 76)
https://gateoverflow.in/207562
∑ = {0, 1}
Give a regular expression for all strings having at least two occurrences of the substring 00. (Note that with the usual
interpretation of a substring, 000 counts two such occurences)
theory-of-computation peter-linz peter-linz-edition4 regular-expressions
10.25.81 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 18 (Page No. 76) https://gateoverflow.in/308135
10.25.82 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 18 (Page No. 76) https://gateoverflow.in/247423
10.25.83 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 19 (Page No. 77) https://gateoverflow.in/308378
Repeat parts (a), (b), and (c) of Peter Linz Edition 4 Exercise 3.1 Question 18 (Page No. 76) with Σ = {a, b, c}.
Does the expression ((0 + 1)(0 + 1)∗ )∗ 00(0 + 1)∗ denote the language in L(r) = {w ∈ Σ∗ : w has at least one pair
of consecutive zeros}.?
peter-linz peter-linz-edition4 theory-of-computation regular-expressions
10.25.85 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 20 (Page No. 77) https://gateoverflow.in/308381
Determine whether or not the following claims are true for all regular expressions r1 and r2 . The symbol ≡ stands for
equivalence of regular expressions in the sense that both expressions denote the same language.
10.25.86 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 21 (Page No. 77) https://gateoverflow.in/308383
Give a general method by which any regular expression r can be changed into r̂ such that (L(r))R = L(r̂ ) .
10.25.87 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 22 (Page No. 77) https://gateoverflow.in/308387
Prove rigorously that the expressions in r = (1∗ 011∗ )∗ (0 + λ) + 1∗ (0 + λ) do indeed denote the specified language.
10.25.88 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 23 (Page No. 77) https://gateoverflow.in/308388
For the case of a regular expression r that does not involve λ or Ø, give a set of necessary and sufficient conditions that
r must satisfy if L(r) is to be infinite.
peter-linz peter-linz-edition4 theory-of-computation regular-expressions
10.25.89 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 24,25 (Page No. 77)
https://gateoverflow.in/308391
24. Formal languages can be used to describe a variety of two-dimensional figures. Chain-code
languages are defined on the alphabet Σ = {u, d, r, l }, where these symbols stand for unit-length
straight lines in the directions up, down, right, and left, respectively. An example of this notation
is urdl, which stands for the square with sides of unit length. Draw pictures of the figures
denoted by the expressions (rd)∗ , (urddru)∗ , and (ruldr)∗ .
25. In above, what are sufficient conditions on the expression so that the picture is a closed
contour in the sense that the beginning and ending points are the same? Are these conditions also
necessary?
10.25.90 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 28 (Page No. 77) https://gateoverflow.in/207634
Find a regular expression for all bit strings, with leading bit 1, interpreted as a binary integer, with values not between
10 and 30.
theory-of-computation peter-linz peter-linz-edition4 regular-expressions
10.25.91 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 3 (Page No. 75) https://gateoverflow.in/308124
Show that r = (1 + 01)∗ (0 + 1∗ ) also denotes the language in L = {w ∈{0, 1}∗ : w has no pair of consecutive
zeros}. Find two other equivalent expressions.
peter-linz peter-linz-edition4 theory-of-computation regular-expressions
10.25.92 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 4 (Page No. 75) https://gateoverflow.in/308125
10.25.93 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 6 (Page No. 75) https://gateoverflow.in/308126
10.25.94 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 8 (Page No. 76) https://gateoverflow.in/308127
Give a simple verbal description of the language L((aa)∗ b(aa)∗ + a(aa)∗ ba(aa)∗ ).
10.25.95 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.1 Question 9 (Page No. 76) https://gateoverflow.in/207492
L = (a + bc)∗ (c + ϕ)
10.25.96 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 1 (Page No. 87) https://gateoverflow.in/308419
10.25.97 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 10 (Page No. 88) https://gateoverflow.in/308432
Find regular expressions for the languages accepted by the following automata:-
a.
b. https://gateoverflow.in/304714/peter-linz-edition-4-exercise-3-2-question-10-b-page-no-88
c.
10.25.98 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 10.b (Page No. 88)
https://gateoverflow.in/304714
What is the regular expression for this
10.25.99 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 13 (Page No. 88) https://gateoverflow.in/308577
10.25.100 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 15 (Page No. 89)
https://gateoverflow.in/308578
Write a regular expression for the set of all C real numbers.
theory-of-computation peter-linz peter-linz-edition4 regular-expressions
10.25.101 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 16 (Page No. 89)
https://gateoverflow.in/308579
In some applications, such as programs that check spelling, we may not need an exact match of
the pattern, only an approximate one. Once the notion of an approximate match has been made
precise, automata theory can be applied to construct approximate pattern matchers. As an
illustration of this, consider patterns derived from the original ones by insertion of one symbol.
Let L be a regular language on Σ and define
insert(L) = {uav : a ∈ Σ, uv ∈ L }.
In effect, insert(L) contains all the words created from L by inserting a spurious symbol
anywhere in a word.
(a) Given an nfa for L, show how one can construct an nfa for insert(L).
(b) Discuss how you might use this to write a pattern-recognition program for insert(L), using as
input a regular expression for L.
theory-of-computation peter-linz peter-linz-edition4 regular-expressions
10.25.102 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 17 (Page No. 89)
https://gateoverflow.in/308580
Analogous to the previous exercise, consider all words that can be formed from L by dropping
a single symbol of the string. Formally define this operation drop for languages. Construct an nfa
for drop(L), given an nfa for L.
10.25.103 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 2 (Page No. 87) https://gateoverflow.in/308420
Find an nfa that accepts the complement of the language in L(ab∗ aa + bba∗ ab).
10.25.104 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 3 (Page No. 87) https://gateoverflow.in/308421
Give an nfa that accepts the language L((a + b)∗ b(a + bb)∗ ).
10.25.105 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 4 (Page No. 87) https://gateoverflow.in/308422
10.25.106 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 5 (Page No. 87) https://gateoverflow.in/308423
10.25.107 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 6 (Page No. 87) https://gateoverflow.in/308425
Find an nfa for all strings not containing the substring 101 . Use this to derive a regular expression for that language.
10.25.108 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 7 (Page No. 87) https://gateoverflow.in/308427
Find the minimal dfa that accepts L(a∗ bb) ∪ L(ab∗ ba).
10.25.109 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 8 (Page No. 87) https://gateoverflow.in/308428
(a) Find an equivalent generalized transition graph with only two states.
(b) What is the language accepted by this graph?
10.25.110 Peter Linz Edition4: Peter Linz Edition 4 Exercise 3.2 Question 9 (Page No. 88) https://gateoverflow.in/308431
10.25.111 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.1 Question 4 (Page No. 109)
https://gateoverflow.in/308776
Theorem 4.3
“Let h be a homomorphism. If L is a regular language, then its homomorphic image h (L) is also regular. The family of
regular languages is therefore closed under arbitrary homomorphisms.”
Proof: Let L be a regular language denoted by some regular expression r. We find h(r) by substituting h(a) for each symbol
a ∈ Σ of r. It can be shown directly by an appeal to the definition of a regular expression that the result is a regular expression.
It is equally easy to see that the resulting expression denotes h(L). All we need to do is to show that for every w ∈ L(r), the
corresponding h(w) is in L(h(r)) and conversely that every υ in L(h(r)) there is a w in L, such that υ = h(w) . we claim
that h(L) is regular.
In the proof of Theorem 4.3, show that h(r) is a regular expression. Then show that h(r) denotes h(L).
peter-linz peter-linz-edition4 theory-of-computation regular-languages regular-expressions
10.25.112 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 1 (Page No. 113)
https://gateoverflow.in/309594
Show that there exists an algorithm to determine whether or not w ∈ L1 − L2 , for any given w
and
any regular languages L1 and L2 .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.113 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 10 (Page No. 113)
https://gateoverflow.in/309607
Show that there is an algorithm to determine if L = shuffle(L, L) for any regular L.
10.25.114 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 11 (Page No. 113)
https://gateoverflow.in/309608
The operation tail(L) is defined as tail(L) = {v : uv ∈ L, u, v ∈ Σ∗ }.
Show that there is an algorithm for determining whether or not L = tail(L) for any regular L.
10.25.115 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 12 (Page No. 113)
https://gateoverflow.in/309609
Let L be any regular language on Σ = {a, b}. Show that an algorithm exists for determining if
L contains any strings of even length.
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.116 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 13 (Page No. 114)
https://gateoverflow.in/309611
Show that there exists an algorithm that can determine for every regular language L, whether or
not |L| ≥ 5 .
10.25.117 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 14 (Page No. 114)
https://gateoverflow.in/309613
Find an algorithm for determining whether a regular language L contains an infinite number of
even-length strings.
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.118 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 15 (Page No. 114)
https://gateoverflow.in/309614
Describe an algorithm which, when given a regular grammar G, can tell us whether or not
L(G) = Σ∗ .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.119 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 2 (Page No. 113)
https://gateoverflow.in/309596
Show that there exists an algorithm for determining if L1 ⊆ L2 , for any regular languages L1
and L2 .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.120 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 3 (Page No. 113)
https://gateoverflow.in/309598
Show that there exists an algorithm for determining if λ ∈ L , for any regular language L.
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.121 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 4 (Page No. 113)
https://gateoverflow.in/309599
Show that for any regular L1 and L2 there is an algorithm to determine whether or not
L1 = L1 /L2 .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.122 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 5 (Page No. 113)
https://gateoverflow.in/309600
A language is said to be a palindrome language if L = LR . Find an algorithm for determining if
a
given regular language is a palindrome language.
10.25.123 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 6 (Page No. 113)
https://gateoverflow.in/309603
Exhibit an algorithm for determining whether or not a regular language L contains any string w
such that wR ∈ L .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.124 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 7 (Page No. 113)
https://gateoverflow.in/309604
Exhibit an algorithm that, given any three regular languages, L, L1 , L2 , determines whether or
not L = L1 L2 .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.125 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 8 (Page No. 113)
https://gateoverflow.in/309605
Exhibit an algorithm that, given any regular language L, determines whether or not L = L∗ .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.126 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.2 Question 9 (Page No. 113)
https://gateoverflow.in/309606
Let L be a regular language on Σ and ŵ be any string in Σ∗ . Find an algorithm to determine if
L contains any w such that ŵ is a substring of it, that is, such that w = uŵυ with u, υ ∈ Σ∗ .
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.127 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.3 Question 17 (Page No. 124)
https://gateoverflow.in/309822
Let L1 and L2 be regular languages. Is the language L = {w : w ∈ L1 , wR ∈ L2 necessarily
regular?
peter-linz peter-linz-edition4 theory-of-computation regular-languages
10.25.128 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.3 Question 19 (Page No. 124)
https://gateoverflow.in/309824
Are the following languages regular?
10.25.129 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.3 Question 20 (Page No. 124)
https://gateoverflow.in/309825
Is the following language regular?
10.25.130 Peter Linz Edition4: Peter Linz Edition 4 Exercise 4.3 Question 25 (Page No. 124)
https://gateoverflow.in/309831
In the chain code language in Exercise 24, Section 3.1, let L be the set of all w ∈ {u, r, l, d}∗
that describe rectangles. Show that L is not a regular language.
10.25.132 Peter Linz Edition4: Peter Linz Edition 4 Exercise 5.1 Question 7.c (Page No. 133)
https://gateoverflow.in/208410
Find CFG for the following language
L = {an bm : n ≠ 2m}
10.25.133 Peter Linz Edition4: Peter Linz Edition 4 Exercise 6.1 Question 15 (Page No. 162)
https://gateoverflow.in/310156
Give an example of a situation in which the removal of λ-productions introduces previously
nonexistent unit-productions.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.134 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 1 (Page No. 200)
https://gateoverflow.in/315485
Show that L = {an b2n : n ≥ 0 } is a deterministic context-free language.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.135 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 10 (Page No. 200)
https://gateoverflow.in/315494
While the language in Exercise 9 is deterministic, the closely related language L = {
wwR : w ∈ {a, b}∗ } is known to be nondeterministic. Give arguments that make this statement plausible.
10.25.136 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 11 (Page No. 200)
https://gateoverflow.in/315495
Show that L = {w ∈ {a, b}∗ : na (w) ≠ nb (w) } is a deterministic context-free language.
10.25.137 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 15 (Page No. 200)
https://gateoverflow.in/315497
Show that every regular language is a deterministic context-free language.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.138 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 16 (Page No. 200)
https://gateoverflow.in/315498
Show that if L1 is deterministic context-free and L2 is regular, then the language L1 ∪ L2 is
deterministic context-free.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.139 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 17 (Page No. 200)
https://gateoverflow.in/315499
Show that under the conditions of Exercise 16, L1 ∩ L2 is a deterministic context-free
language.
10.25.140 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 18 (Page No. 200)
https://gateoverflow.in/315500
Give an example of a deterministic context-free language whose reverse is not deterministic.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.141 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 2 (Page No. 200)
https://gateoverflow.in/315487
Show that L = {an bm : m ≥ n + 2 } is deterministic.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.142 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 3 (Page No. 200)
https://gateoverflow.in/315488
Is the language L = {an bn : n ≥ 1 } ∪ {b} deterministic?
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.143 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 4 (Page No. 200)
https://gateoverflow.in/315489
Is the language L = {an bn : n ≥ 1 } ∪ {a} deterministic?
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.144 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 6 (Page No. 200)
https://gateoverflow.in/315490
For the language L = {an b2n : n ≥ 0 }, show that L∗ is a deterministic context-free language.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.145 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 7 (Page No. 200)
https://gateoverflow.in/315491
Give reasons why one might conjecture that the following language is not deterministic.
L = { an bm ck : n = m or m = k}.
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.146 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 8 (Page No. 200)
https://gateoverflow.in/315492
Is the language L = {an bm : n = m or n = m + 2} deterministic?
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.25.147 Peter Linz Edition4: Peter Linz Edition 4 Exercise 7.3 Question 9 (Page No. 200)
https://gateoverflow.in/315493
Is the language {wcwR : w ∈ {a, b}∗ } deterministic?
peter-linz peter-linz-edition4 theory-of-computation context-free-languages
10.26.1 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 1 (Page No. 258) https://gateoverflow.in/307704
Give a formal definition of a Turing machine with a semi-infinite tape. Then prove that the class of Turing machines
with semi-infinite tape. Then prove the class of Turing machines with semi-infinite tape is equivalent to the class of
standard Turing machines.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine
10.26.2 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 10 (Page No. 259) https://gateoverflow.in/307720
Consider a version of the standard Turing machine in which transitions can depend not only on the cell directly under
the read-write head but also on the cells to the immediate right and left. Make a formal definition of such a machine,
then sketch its simulation by a standard Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.3 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 11 (Page No. 259) https://gateoverflow.in/307722
Consider a Turing machine with a different decision process in which transitions are made if the current tape symbol is
not one of the specified set. For example,
will allow the indicated move if the current tape symbol is neither a nor b. Formalize this concept and show that this
modification is equivalent to a standard Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.4 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 2 (Page No. 258) https://gateoverflow.in/307705
10.26.5 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 3 (Page No. 259) https://gateoverflow.in/307707
Give convincing arguments that any language accepted by an off-line Turing machine is also accepted by some
standard machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.6 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 4 (Page No. 259) https://gateoverflow.in/307708
Consider a Turing machine that, on any particular move, can either change the top symbol or move the read-write head,
but not both.
(b) Show that the class of such machines is equivalent to the class of standard Turing machines.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.7 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 5 (Page No. 259) https://gateoverflow.in/307709
Consider a model of a Turing machine in which each move permits the read-write head to travel more than one cell to
the left or right, the distance and direction of travel being one of the arguments of δ. Give a precise definition of such
an automaton and sketch a simulation of it by a standard Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.8 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 6 (Page No. 259) https://gateoverflow.in/307710
A nonerasing Turing machine is one that cannot change a nonblank symbol to a blank. This can be achieved by the
restriction that if
10.26.9 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 7 (Page No. 259) https://gateoverflow.in/307715
Consider a Turing machine that cannot write blanks; that is, for all δ(qi , a) = (qj , b, L ) , b must be in Γ − {□}. Show
how such a machine can simulate a standard Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.10 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 8 (Page No. 259) https://gateoverflow.in/307717
Suppose we make the requirement that a Turing machine can halt only in a final state, that is, we ask that δ(q, a) be
defined for all pairs (q, a) with a ∈ Γ and q ∉ F . Does this restrict the power of the Turing machine?
10.26.11 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.1 Question 9 (Page No. 259) https://gateoverflow.in/307719
Suppose we make the restriction that a Turing must always write a symbol different from the one it reads, that is, if
δ(qi , a) = (qj , b, L or R) ,
then a and b must be different. Does this limitation reduce the power of the automaton ?
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.12 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 1 (Page No. 264) https://gateoverflow.in/307925
Define what one might call a multitape off-line Turing machine and describe how it can be simulated by a standard
Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine descriptive
10.26.13 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 10 (Page No. 264)
https://gateoverflow.in/307932
Write out a detailed program for the computation in considering the language {an bn } . We
described a laborious method by which this language can be accepted by a Turing machine with one tape. Using a two-
tape machine makes the job much easier. Assume that an initial string an bm is written on tape 1 at the beginning of the
computation. We then read all the a′ s, we match the b′ s on tape 1 against the copied a′ s on tape 2. This way, we can
determine whether there are an equal number of a′ s and b′ s without repeated back-and-forth movement of the read-write head.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.14 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 2 (Page No. 264) https://gateoverflow.in/307926
A multihead Turing machine can be visualized as a Turing machine with a single tape and single control unit but with
multiple, independent read-write heads. Give a formal definition of a multihead Turing machine, and then show how
much a machine can be simulated with a standard Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.15 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 3 (Page No. 264) https://gateoverflow.in/307724
Give a formal definition of a multihead-multitape Turing machine. Then show how such a machine can be simulated by
a standard Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.16 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 4 (Page No. 264) https://gateoverflow.in/307725
Give a formal definition of a Turing machine with a single tape but multiple control units, each with a single read-write
head. Show how such a machine can be simulated with a multitape machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.17 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 5 (Page No. 264) https://gateoverflow.in/307927
A queue automaton is an automaton in which the temporary storage is a queue. Assume that such a machine is an
online machine, that is, it has no input file, with the string to be processed placed in the queue prior to the start of the
computation. Give a formal definition of such an automaton, then investigate its power in relation to Turing machines.
peter-linz peter-linz-edition5 theory-of-computation turing-machine difficult
10.26.18 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 6,7 (Page No. 264)
https://gateoverflow.in/307929
Exercise 6: Show that for every Turing machine there exists an equivalent standard Turing
machine with no more than six states.
Exercise 7: Reduce the number of required states in Exercise 6 above as far as you can (Hint: The smallest possible number is
three)
peter-linz peter-linz-edition5 theory-of-computation turing-machine difficult
10.26.19 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 8 (Page No. 264) https://gateoverflow.in/307731
A counter is a stack with an alphabet of exactly two symbols a stack start symbol and a counter symbol. Only the
counter symbol can be put on the stack or removed from it. A counter automaton is a deterministic automaton with
one or more counters as storage. Show that any Turing machines can be simulated using a counter automaton with four
counters.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof difficult
10.26.20 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.2 Question 9 (Page No. 264) https://gateoverflow.in/307732
Show that every computation that can be done by a standard Turing machine can be done a multitape machine with a
stay option and at most two states.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.21 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.3 Question 1 (Page No. 267) https://gateoverflow.in/308384
Discuss in detail the simulation of a nondeterministic Turing machine by a deterministic one. Turing machine by a
deterministic one. Indicate explicitly how new machines are created, how active machines are identified, and how
machines that halt are removed from further consideration.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.22 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.3 Question 2 (Page No. 267) https://gateoverflow.in/308386
Show how a two-dimensional nondeterministic Turing machine can be simulated by a deterministic machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.23 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.3 Question 3 (Page No. 268) https://gateoverflow.in/308389
Write a program for a nondeterministic Turing machine that accepts the language.
10.26.24 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.3 Question 4 (Page No. 268) https://gateoverflow.in/308392
Outline how one would write a program for a nondeterministic Turing machine to accept the language
10.26.25 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.3 Question 5 (Page No. 268) https://gateoverflow.in/308394
Write a simple program for a nondeterministic Turing machine that accepts the language
10.26.26 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.3 Question 6 (Page No. 268) https://gateoverflow.in/308395
10.26.27 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.3 Question 7 (Page No. 268) https://gateoverflow.in/308397
M = (Q, Σ, Γ, δ, q0 , z, F)
where
A two-stack automaton is a nondeterministic pushdown automaton with two independent stacks. To define such an automaton,
we modify Definition so that
A move depends on the tops of the two stacks and results in new values being pushed on these two stacks. Show that the class
of two-stack automata is equivalent to the class of Turing machines.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.28 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 1 (Page No. 272) https://gateoverflow.in/308398
Sketch an algorithm that examines a string in {0, 1}+ to determine whether or not it represents an encoded Turing
machine.
theory-of-computation peter-linz peter-linz-edition5 turing-machine
10.26.29 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 2 (Page No. 272) https://gateoverflow.in/308399
Give a complete encoding, using the suggested method, for the Turing machine with
δ(q1 , a1 ) = (q1 , a1 , R) ,
δ(q1 , a2 ) = (q3 , a1 , L) ,
δ(q3 , a1 ) = (q2 , a2 , L) ,
theory-of-computation peter-linz peter-linz-edition5 turing-machine
10.26.30 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 3 (Page No. 272) https://gateoverflow.in/308400
Sketch a Turing machine program that enumerates the set {0, 1}+ in proper order.
10.26.31 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 4 (Page No. 272) https://gateoverflow.in/308401
Exercise 3: Sketch a Turing machine program that enumerates the set {0,1}+{0,1}+ in proper order.
10.26.32 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 5 (Page No. 272) https://gateoverflow.in/308402
Design a Turing machine that enumerates the following set in proper order
L = {an bn : n ≥ 1} .
theory-of-computation peter-linz peter-linz-edition5 turing-machine
10.26.33 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 7 (Page No. 273) https://gateoverflow.in/308403
Show that the set of all triplets, (i, j, k) with i, j, k positive integers, is countable,
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.34 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 8 (Page No. 273) https://gateoverflow.in/308404
Suppose that S1 and S2 are countable sets. Show that then S1 ∪ S2 and S1 × S2 are also countable.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.35 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.4 Question 9 (Page No. 273) https://gateoverflow.in/308405
Show that the Cartesian product of a finite number of countable sets is countable.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.36 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 1 (Page No. 275) https://gateoverflow.in/308406
L = {an! : n ≥ 0}
10.26.37 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 2 (Page No. 275) https://gateoverflow.in/308407
L = {an! : n ≥ 0}
Find a solution for Example that does not require track as scratch space.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.38 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 3 (Page No. 275) https://gateoverflow.in/308529
Consider an offline Turing machine in which the input can be read only once, moving left to right, not rewritten. On its
work tape, it can use at most n extra cells for work space, where n is fixed for all inputs. Show that such a machine is
equivalent to a finite automaton.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.39 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 4(a) (Page No. 275)
https://gateoverflow.in/308530
Find linear bounded automata for the following language.
L = {an : n = m2 , m ≥ 1}
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.40 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 4(b) (Page No. 275)
https://gateoverflow.in/308532
Find linear bounded automata for the following language.
10.26.41 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 4(c) (Page No. 275)
https://gateoverflow.in/308533
Find linear bounded automata for the following language.
10.26.43 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 4(e) (Page No. 276)
https://gateoverflow.in/308540
Find linear bounded automata for the following languages.
10.26.44 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 4(f) (Page No. 276)
https://gateoverflow.in/308541
Find linear bounded automata for the following languages.
L = {wwwR : w ∈ {a, b}+ } .
10.26.45 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 5 (Page No. 276) https://gateoverflow.in/308545
L = {an! : n ≥ 0} .
Find a lba for the complement of the language in Example, assuming that Σ = {a, b} .
10.26.46 Peter Linz Edition5: Peter Linz Edition 5 Exercise 10.5 Question 6,7 (Page No. 276)
https://gateoverflow.in/308546
Exercise : 6 Show that for every context-free language there exists an accepting pda, such that
the number of symbols in the stack never exceeds the length of the input string by more than one.
Exercise : 7 Use the observation in the above exercise to show that any context-free language not containing λ is accepted by
some linear bounded automaton.
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.47 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 13 (Page No. 284)
https://gateoverflow.in/306332
Suppose that L is such that there exists a Turing machine that enumerates the elements of L in
proper order. Show that this means that L is recursive.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.48 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 14 (Page No. 284)
https://gateoverflow.in/306333
If L is recursive, is it necessarily true that L+ is also recursive ?
theory-of-computation proof recursive-and-recursively-enumerable-languages turing-machine peter-linz peter-linz-edition5
10.26.49 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 15 (Page No. 284)
https://gateoverflow.in/306335
Theorem : There exists a recursively enumerable language whose complement is not
recursively enumerable.
Choose a particular encoding for Turing machines, and with it, find one element of the languages L̄ in Theorem
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.50 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 16 (Page No. 284)
https://gateoverflow.in/306336
Let S1 be a countable set, S2 a set that is not countable, and S1 ⊂ S2 . Show that S2 must then
contain an infinite number of elements that are not in S1 .
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.51 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 17 (Page No. 284)
https://gateoverflow.in/306337
Let S1 be a countable set, S2 a set that is not countable, and S1 ⊂ S2 . Show that S2 must then
contain an infinite number of elements that are not in S1 .
10.26.52 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 18 (Page No. 284)
https://gateoverflow.in/306338
Theorem : Let S be an infinite countable set. Then its powerset 2S is not countable.
10.26.53 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.1 Question 19 (Page No. 284)
https://gateoverflow.in/306341
Show that the set of all irrational numbers is not countable.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.54 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 1 (Page No. 290) https://gateoverflow.in/306418
S → S1 B,
S1 → aS1 b,
bB → bbbB,
aS1 b → aa,
B→λ
derive?
peter-linz peter-linz-edition5 theory-of-computation turing-machine recursive-and-recursively-enumerable-languages proof
10.26.55 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 2 (Page No. 290) https://gateoverflow.in/306419
What difficulties would arise if we allowed the empty string as the left side of a production in an unrestricted grammar?
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.56 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 3 (Page No. 290) https://gateoverflow.in/306420
Consider a variation on grammars in which the starting point of any derivation can be a finite set of strings, rather than
a single variable. Formalize this concept, then investigate how such grammars relate to the unrestricted grammars we
have used here.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.57 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 4 (Page No. 290) https://gateoverflow.in/306421
Prove that constructed grammar cannot generate any sentence with a b in it.
S → S1 B,
S1 → aS1 b,
bB → bbbB,
aS1 b → aa,
B→λ
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.58 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 5 (Page No. 290) https://gateoverflow.in/306424
Theorem : For every recursively enumerable language L, there exists an unrestricted grammar G, such that
L = L(G) .
10.26.59 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 6 (Page No. 290) https://gateoverflow.in/306425
Theorem : For every recursively enumerable language L, there exists an unrestricted grammar G, such that
L = L(G) .
Construct a Turing machine for L(01(01)∗ ), then find an unrestricted grammar for it using the construction in Theorem. Give
a derivation for 0101 using the resulting grammar.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.60 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 7 (Page No. 290) https://gateoverflow.in/306426
Show that for every unrestricted grammar there exists an equivalent unrestricted grammar, all of whose productions
have the form
u → v,
A→λ
with A ∈ V
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.61 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 8 (Page No. 290) https://gateoverflow.in/306427
Every unrestricted grammar there exists an equivalent unrestricted grammar, all of whose productions have the form
u → v,
A→λ
with A ∈ V
Show that the conclusion still holds if we add the further conditions |u| ≤ 2 and |v| ≤ 2
10.26.62 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.2 Question 9 (Page No. 290,291)
https://gateoverflow.in/306428
A grammar G = (V , T, S, P ) is called unrestricted if all the production are of the form
u → v,
x → y,
where
x ∈ (V ∪ T )∗ V (V ∪ T )∗ ,
and
y ∈ (V ∪ T)∗
The difference is that here the left side must have at least one variable.
Show that this alternate definition is basically the same as the one we use, in the sense that for every grammar of one type,
there is an equivalent grammar of the other type.
peter-linz peter-linz-edition5 theory-of-computation proof turing-machine recursive-and-recursively-enumerable-languages
10.26.63 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.3 Question 1 (Page No. 296) https://gateoverflow.in/306429
(c) L = {an bm cn dm : n ≥ 1, m ≥ 1} .
(e) L = {an bn cn dm : n ≥ 1} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine recursive-and-recursively-enumerable-languages difficult
10.26.64 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.3 Question 2 (Page No. 296) https://gateoverflow.in/306430
10.26.65 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.3 Question 3 (Page No. 296) https://gateoverflow.in/306432
10.26.66 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.3 Question 4 (Page No. 296) https://gateoverflow.in/306433
10.26.67 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.3 Question 5 (Page No. 296) https://gateoverflow.in/306434
Without explicitly constructing it, show that there exists a context-sensitive grammar for the language
L = {wwwR : w, u ∈ {a, b}+ , |w| ≥ |u|} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine recursive-and-recursively-enumerable-languages
10.26.69 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.4 Question 1 (Page No. 298) https://gateoverflow.in/307922
Given examples that demonstrate that all the subset relations depicted in the figure are indeed proper ones.
10.26.70 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.4 Question 2 (Page No. 298) https://gateoverflow.in/307923
Find two examples of languages that are linear but not deterministic context-free.
peter-linz peter-linz-edition5 theory-of-computation turing-machine recursive-and-recursively-enumerable-languages
10.26.71 Peter Linz Edition5: Peter Linz Edition 5 Exercise 11.4 Question 3 (Page No. 298) https://gateoverflow.in/307924
Find two examples of languages that are deterministic context-free but not linear.
peter-linz peter-linz-edition5 theory-of-computation turing-machine recursive-and-recursively-enumerable-languages
10.26.72 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 1 (Page No. 307) https://gateoverflow.in/306007
If the halting problem were decidable, then every recursively enumerable language would be recursive. Consequently,
the halting problem is undecidable.
10.26.73 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 10 (Page No. 308)
https://gateoverflow.in/306020
Let M be any Turing machine and x and y two possible instantaneous descriptions of it. Show
that the problem of determining whether or not x ⊢∗M y is undecidable.
10.26.74 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 11 (Page No. 308)
https://gateoverflow.in/306021
Let Γ = {0, 1, □} . Consider the function f(n) whose value is the maximum number of moves
that can be made by any n − state Turing machine that halts when started with a blank tape. This function, as it turns
out, is not computable.
10.26.76 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 13 (Page No. 308)
https://gateoverflow.in/306023
Let B be the set of all Turing machines that halt when started with a blank tape. Show that this
set is recursively enumerable, but not recursive.
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.77 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 14 (Page No. 308)
https://gateoverflow.in/306024
Consider the set of all n−state Turing machines with tape alphabet Γ = {0, 1, □} . Give an
expression for m(n), the number of distinct Turing machines with this Γ.
10.26.78 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 15 (Page No. 308)
https://gateoverflow.in/306025
Let Γ = {0, 1, □} and let b(n) be the maximum number of tape cells examined by any n−state
Turing machine that halts when started with a blank tape. Show that b(n) is not computable.
10.26.79 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 16 (Page No. 308)
https://gateoverflow.in/306026
Determine whether or not the following statements is true: Any problem whose domain is finite
is decidable.
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.80 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 2 (Page No. 307) https://gateoverflow.in/306010
Definition: Let wM be a string that describes a Turing machine M = (Q, Σ, Γ, δ, q0 , □, F) , and let w be a string in
M ′ s alphabet. We will assume that wm and wM and w are encoded as a string of 0′ s and 1′ s. A solution of the halting
problem is a Turing machine H, which for any wM and w performs the computation
q0 wM w ⊢ ∗ x1 qy x2
q0 wM w ⊢ ∗ y1 qn y2
If M applied to w does not halt. Here qy and qn are both final states of H
Theorem: There does not exist any Turing machine H that behave as required by Definition. The halting problem is therefore
undecidable.
10.26.81 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 3 (Page No. 307) https://gateoverflow.in/306011
Show that the following problem is undecidable. Given any Turing machine M, a ∈ Γ and w ∈ Σ+ , determine
whether or not the symbol a is ever written when M is applied to w.
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.82 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 4 (Page No. 307) https://gateoverflow.in/306012
In the general halting problem, we ask for an algorithm that gives the correct answer for any M and w. We can relax
this generality, for example by looking for an algorithm that works for all M but only a single w. We say that such a
problem is decidable if for every w there exists a (possibly different) algorithm that determines whether or not (M, w) halts.
Show that even in this restricted setting the problem is undecidable.
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.83 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 5 (Page No. 307) https://gateoverflow.in/306013
Show that there is no problem to decide whether or not an arbitrary Turing machine on all input.
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.84 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 6 (Page No. 308) https://gateoverflow.in/306014
Consider the question: “Does a Turing machine in the course of a computation revisit the starting cell (i.e the cell under
the read-write head at the beginning of the computation)?” Is this a decidable question ?
10.26.85 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 7,8 (Page No. 308)
https://gateoverflow.in/306016
i) Show that there is no algorithm for deciding if any two Turing machines M1 and M2 accept
the same language.
10.26.86 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.1 Question 9 (Page No. 308) https://gateoverflow.in/306019
Is the halting problem solvable for deterministic pushdown automata; that is, given a pda as in Definition, can we always
predict whether or not the automaton will halt on input w?
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.87 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 1 (Page No. 311) https://gateoverflow.in/306221
Theorem : Let M be any Turing machine. Then the question of whether or not L(M) is finite is undecidable.
10.26.88 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 2 (Page No. 311) https://gateoverflow.in/306223
Show that the two problems mentioned at the end of the preceding section, namely
are undecidable.
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.89 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 3 (Page No. 311) https://gateoverflow.in/306227
Let M1 and M2 be arbitrary Turing machines. Show that the problem “L(M1 ) ⊆ L(M2 )” is undecidable.
10.26.90 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 4 (Page No. 311) https://gateoverflow.in/306230
Let G be an unrestricted grammar. Does there exist an algorithm for determining whether or not L(G)R is recursive
enumerable?
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.91 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 5 (Page No. 311) https://gateoverflow.in/306233
Let G be an unrestricted grammar. Does there exist an algorithm for determining whether or not L(G) = L(G)R ?
10.26.92 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 6 (Page No. 311) https://gateoverflow.in/306235
Let G1 be an unrestricted grammar, and G2 any regular grammar. Show that the problem
L(G1 ) ∩ L(G2 ) = ϕ
is undecidable.
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.93 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 7 (Page No. 311) https://gateoverflow.in/306238
Let G1 be an unrestricted grammar, and G2 any regular grammar. Show that the problem
L(G1 ) ∩ L(G2 ) = ϕ
10.26.94 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.2 Question 8 (Page No. 311) https://gateoverflow.in/306240
For an unrestricted grammar G, show that the question “Is L(G) = L(G)∗ ?” is undecidable. Argue (a) from Rice’s
theorem and (b) from first principles.
10.26.95 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.3 Question 1 (Page No. 317) https://gateoverflow.in/306287
Let A = {001, 0011, 11, 101} and B = {01, 111, 111, 010} . Does the pair (A, B) have a PC solution ? Does it have
an MPC solution?
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.96 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.3 Question 2 (Page No. 317) https://gateoverflow.in/306292
Theorem : Let G = (V , T, S, P ) be an unrestricted grammar, with w any string in T + . Let (A, B) be the
correspondence pair constructed from G and w be the process exhibited in Figure. Then the pair (A, B) permits an
MPC solution if and only if w ∈ L(G).
A B
FS F F is a symbol in V ∪ T
⇒
a a for every a ∈ T
Vi Vi for every Vi ∈ V
E ⇒ wE E is a symbol not in V ∪ T
yi xi for every xi → yi in P
⇒ ⇒
FS ⇒ is to be taken as w1 and the string F as v1 . The order of the rest of the strings is immaterial.
Provide the details of the proof of the Theorem.
10.26.97 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.3 Question 3 (Page No. 317) https://gateoverflow.in/306293
Show that for |Σ| = 1 , the Post correspondence problem is decidable, that is, there is an algorithm that can decide
whether or not (A, B) has a PC solution for any given (A, B) on a single-letter alphabet.
10.26.98 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.3 Question 4 (Page No. 317) https://gateoverflow.in/306294
Suppose we restrict the domain of the Post correspondence problem to include only alphabets with exactly two
symbols. Is the resulting correspondence problem decidable?
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.99 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.3 Question 5 (Page No. 317,318)
https://gateoverflow.in/306295
Show that the following modifications of the Post correspondence problem are undecidable.
10.26.100 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.3 Question 6 (Page No. 318)
https://gateoverflow.in/306296
The correspondence pair (A, B) is said to have an even PC solution if and only if there exists a
nonempty sequence of even integers i, j, . . k such that wi wj . . . wk = vi vj . . . vk . Show that the problem of deciding
whether or not an arbitrary pair (A, B) has an even PC solution is undecidable.
10.26.101 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 1 (Page No. 320)
https://gateoverflow.in/306298
Theorem : There exists no algorithm for deciding whether any given context-free grammar is
ambiguous.
Prove the claim made in Theorem that GA and GB by themselves are unambiguous
peter-linz peter-linz-edition5 theory-of-computation decidability proof
10.26.102 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 2 (Page No. 321)
https://gateoverflow.in/306299
Show that the problem of determining whether or not L(G1 ) ⊆ L(G2 ) is undecidable for
context-free grammars G1 , G2 .
peter-linz peter-linz-edition5 theory-of-computation decidability proof difficult
10.26.103 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 5 (Page No. 321)
https://gateoverflow.in/306303
L e t L1 be a regular language and G a context-free grammar. Show that the problem
“L1 ⊆ L(G)” is undecidable.
peter-linz peter-linz-edition5 theory-of-computation decidability proof difficult
10.26.104 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 6 (Page No. 321)
https://gateoverflow.in/306304
Let M be any Turing machine. We can assume without loss of generality that every computation
involves an even number of moves. For any such computation
q0 w ⊢ x1 ⊢ x2 ⊢. . . ⊢ xn ,
q0 w ⊢ xR
1 ⊢ x2 ⊢ x3 ⊢. . . ⊢ xn .
R
Show that for every M we can construct three context-free grammars G1 , G2 , G3 such that
(b) the set of all invalid computations (that is, the complement of the set of valid computations) is L(G3 ).
Use the results to show that “L(G) = Σ∗ ” is undecidable over the domain of all context-free grammars G.
10.26.105 Peter Linz Edition5: Peter Linz Edition 5 Exercise 12.4 Question 7 (Page No. 321)
https://gateoverflow.in/306305
L e t G1 be a context-free grammar and G2 a regular grammar. Is the problem
L(G1 ) ∩ L(G2 ) = ϕ decidable ?
peter-linz peter-linz-edition5 theory-of-computation decidability proof difficult
10.26.106 Peter Linz Edition5: Peter Linz Edition 5 Exercise 2.4 Question 10 https://gateoverflow.in/308016
Show that given a regular language L, its minimal dfa is unique within a simple relabeling of
the states.
peter-linz peter-linz-edition5 theory-of-computation finite-automata
10.26.107 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 1 (Page No. 238)
https://gateoverflow.in/308551
Write a Turing machine simulator in some higher-level programming language. Such a
simulator should accept as input the description of any Turing machine, together with an initial configuration, and
should produce as output the result of the computation.
peter-linz peter-linz-edition5 theory-of-computation turing-machine difficult
10.26.108 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 10 (Page No. 239)
https://gateoverflow.in/309035
Design a Turing machine that finds the middle of a string of even length. Specifically, if
w = a1 a2 . . . an an+1 . . . a2n , with ai ∈ Σ, the Turing machine should produce ŵ = a1 a2 . . . an can+1 . . . a2n , where
c ∈ Γ − Σ.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.109 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 11(a) (Page No. 239)
https://gateoverflow.in/309036
Design Turing machines to compute the following functions for x and y positive integers
represented in unary.
f(x) = 3x
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.110 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 11(b) (Page No. 239)
https://gateoverflow.in/309038
Design Turing machines to compute the following functions for x and y positive integers
represented in unary.
f(x, y) = x − y, x > y,
= 0, x ≤ y.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.111 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 11(c) (Page No. 239)
https://gateoverflow.in/309039
Design Turing machines to compute the following functions for x and y positive integers
represented in unary
f(x, y) = 2x + 3y .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.112 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 11(d) (Page No. 239)
https://gateoverflow.in/309041
Design Turing machines to compute the following functions for x and y positive integers
represented in unary
f(x) = x2 , if x is even,
x+1
= 2 , if x is odd.
10.26.113 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 11(e) (Page No. 239)
https://gateoverflow.in/309042
Design Turing machines to compute the following functions for x and y positive integers
represented in unary.
f(x) = x mod 5.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.114 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 11(f) (Page No. 239)
https://gateoverflow.in/309043
Design Turing machines to compute the following functions for x and y positive integers
represented in unary.
10.26.115 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 12 (Page No. 239)
https://gateoverflow.in/309044
Design a Turing machine Γ = {0, 1, □} that, when started on any cell containing a blank or
a 1, will halt if and only if its tape has a 0 somewhere it.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.116 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 13 (Page No. 239)
https://gateoverflow.in/309045
Example : Design a Turing machine that accepts
L = {an bn cn : n ≥ 1} .
10.26.117 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 14 (Page No. 239
https://gateoverflow.in/309047
Example : Design a Turing machine that copies strings of 1′ s. More precisely, find a machine
that performs the computation
q0 w ⊢∗ qf ww,
Give the sequence of instantaneous descriptions that the Turing machine in Example goes through when presented with the
input 111. What happens when this machine is started with 110 on its tape ?
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.118 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 15 (Page No. 239)
https://gateoverflow.in/309048
Example : Design a Turing machine that copies strings of 1′ s. More precisely, find a machine
that performs the computation
q0 w ⊢∗ qf ww,
Give convincing arguments that the Turing machine in Example does in fact carry out the indicated computation.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.119 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 16 (Page No. 239)
https://gateoverflow.in/309050
Example : Let x and y be two positive integers represented in unary notation. Construct a
Turing machine that will halt in a final state qy if x ≥ y, and that will halt in a nonfinal state qn if x < y. More
specifically, the machine is to perform the computation
q0 w(x)0w(y) ⊢∗ qy w(x)0w(y) if x ≥ y ,
10.26.120 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 17 (Page No. 239)
https://gateoverflow.in/309052
Example : Given two positive integers x and y, design a Turing machine that computes x + y.
Suppose that in Example we had decided to represent x and y in binary. Write a Turing machine program for doing the
indicated computation in this representation
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.121 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 18 (Page No. 240)
https://gateoverflow.in/309089
Example : Given two positive integers x and y, design a Turing machine that computes x + y.
10.26.122 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 19 (Page No. 240)
https://gateoverflow.in/309407
You may have noticed that all the examples in these sections had only one final state. Is it
generally true that for any Turing machine, there exists another one with only one final state that accepts the same
language?
peter-linz peter-linz-edition5 theory-of-computation turing-machine proof
10.26.123 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 2 (Page No. 238)
https://gateoverflow.in/308552
Design a Turing machine with no more than three states that accept the language L(a(a + b)∗ ).
Assume that Σ = {a, b} . Is it possible to do this with a two-state machine ?
10.26.124 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 3 (Page No. 238)
https://gateoverflow.in/308553
Example : For Σ = {a, b} design a Turing machine that accepts
L = {an bn : n ≥ 1} .
Determine what the Turing machine in Example does when presented with the inputs aba and aaabbbb.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.125 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 4 (Page No. 238)
https://gateoverflow.in/308555
Example : For Σ = {a, b} design a Turing machine that accepts
L = {an bn : n ≥ 1} .
Is there any input for which the Turing machine in Example goes into an infinite loop?
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.126 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 5 (Page No. 238)
https://gateoverflow.in/308558
What language is accepted by the Turing machine whose transition graph is in the figure below ?
10.26.127 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 6 (Page No. 238)
https://gateoverflow.in/308561
Example : Design a Turing machine that copies strings of 1′ s. More precisely, find a machine
that performs the computation
q0 q ⊢∗ qf ww,
What happens in Example if the string w contains any symbol other than 1?
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.128 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(a) (Page No. 238)
https://gateoverflow.in/308563
Construct Turing machines that will accept the following languages on {a, b}.
L = L(aba∗ b) .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.129 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(b) (Page No. 238)
https://gateoverflow.in/308564
Construct Turing machines that will accept the following languages on {a, b}
L = {w : |w| is even } .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.130 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(c) (Page No. 238)
https://gateoverflow.in/309020
Construct Turing machines that will accept the following languages on {a, b}.
L = {w : |w| is a multiple of 3} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.131 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(d) (Page No. 238)
https://gateoverflow.in/309023
Construct Turing machines that will accept the following languages on {a, b}.
L = {an bm : n ≥ 1, n ≠ m} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.132 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(e) (Page No. 238)
https://gateoverflow.in/309025
Construct Turing machines that will accept the following languages on {a, b}
L = {w : na (w) = nb (w)} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.133 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(f) (Page No. 238)
https://gateoverflow.in/309026
Construct Turing machines that will accept the following languages on {a, b}.
L = {an bm an+m : n ≥ 0, m ≥ 1} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.134 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(g) (Page No. 239)
https://gateoverflow.in/309029
Construct Turing machines that will accept the following languages on {a, b}.
L = {an bn an bn : n ≥ 0} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.135 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 7(h) (Page No. 239)
https://gateoverflow.in/309030
Construct Turing machines that will accept the following languages on {a, b}
L = {an b2n : n ≥ 0} .
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.136 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 8 (Page No. 239)
https://gateoverflow.in/309031
Design a Turing machine that accepts the language.
10.26.137 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.1 Question 9 (Page No. 239)
https://gateoverflow.in/309032
Construct a Turing machine to compute the function
f(w) = wR ,
10.26.139 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 2 (Page No. 244)
https://gateoverflow.in/309409
Establish a convention for representing positive and negative integers in unary notation. With
your convention, sketch the construction of a subtracter for computing x − y.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.140 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 3(a) (Page No. 244)
https://gateoverflow.in/309410
Using adders, subtracters, comparers, copies or multipliers, draw block diagrams for Turing
machines that compute the functions for all positive integers n
10.26.141 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 3(b) (Page No. 244)
https://gateoverflow.in/309411
Using adders, subtracters, comparers, copies or multipliers, draw block diagrams for Turing
machines that compute the functions for all positive integers n
f(n) = n5 ,
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.142 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 3(c) (Page No. 244)
https://gateoverflow.in/309412
Using adders, subtracters, comparers, copies or multipliers, draw block diagrams for Turing
machines that compute the functions for all positive integers n
f(n) = 2n ,
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.143 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 3(d) (Page No. 244)
https://gateoverflow.in/309415
Using adders, subtracters, comparers, copies or multipliers, draw block diagrams for Turing
machines that compute the functions for all positive integers n
f(n) = n!,
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.144 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 3(e) (Page No. 244)
https://gateoverflow.in/309413
Using adders, subtracters, comparers, copiers or multipliers, draw block diagrams for Turing
machines that compute the functions for all positive integers n
f(n) = nn! ,
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.145 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 4 (Page No. 244)
https://gateoverflow.in/309419
Use a block diagram to sketch the implementation of a function f defined for all
w1 , w2 , w3 ∈ {1}+ by
f(w1 , w2 , w3 ) = i,
where i is such that |wi | = max(|w1 |, |w2 |, |w3 |) if no two w′ s have the same length, and i = 0 otherwise.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.146 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 5(a) (Page No. 244)
https://gateoverflow.in/309420
Provide a “high-level” description for Turing machines that accept the following languages on
{a, b}. For each problem, define a set of appropriate macroinstructions that you feel are reasonably easy to implement.
Then use them for the solution.
L = {wwR }.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.147 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 5(b) (Page No. 245)
https://gateoverflow.in/309422
Provide a “high-level” description for Turing machines that accept the following languages on
{a, b}. For each problem, define a set of appropriate macroinstructions that you feel are reasonably easy to implement.
Then use them for the solution.
10.26.148 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 5(c) (Page No. 245)
https://gateoverflow.in/309423
Provide a “high-level” description for Turing machines that accept the following languages on
{a, b}. For each problem, define a set of appropriate macroinstructions that you feel are reasonably easy to implement.
Then use them for the solution.
10.26.149 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 5(d) (Page No. 245)
https://gateoverflow.in/309424
Provide a “high-level” description for Turing machines that accept the following languages on
{a, b}. For each problem, define a set of appropriate macroinstructions that you feel are reasonably easy to implement.
Then use them for the solution.
L = {an bm : m = n2 , n ≥ 1}.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.150 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 5(e) (Page No. 245)
https://gateoverflow.in/309425
Provide a “high-level” description for Turing machines that accept the following languages on
{a, b}. For each problem, define a set of appropriate macroinstructions that you feel are reasonably easy to implement.
Then use them for the solution.
10.26.151 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 6 (Page No. 245)
https://gateoverflow.in/309429
Suggest a method for representing rational numbers on a Turing machine, then sketch a method
for adding and subtracting such numbers.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.152 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 7 (Page No. 245)
https://gateoverflow.in/309430
Sketch the construction of a Turing machine that can perform the addition and multiplication of
positive integers x and y given in the usual decimal notation.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.153 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.2 Question 8,9,10 (Page No. 245)
https://gateoverflow.in/309432
Exercise 8 : Give an implementation of the macroinstruction
searchright(a, qi , qj ),
which indicates that the machine is to search its tape to the right of the current position for the first occurrence of the symbol a.
If an a is encountered before a blank, the machine is to go into state qi , otherwise it is to go into state qj .
Exercise 9 : Use the macroinstruction in the previous exercise to design a Turing machine on Σ = {a, b} that accepts the
language L(ab∗ ab∗ a).
Exercise 10 : Use the macroinstructions searchright in Exercise 8 to create a Turing machine program that replaces the
symbol immediately to the left of the leftmost a by a blank. If the input contains no a, replace the rightmost nonblank symbol
by a b.
peter-linz peter-linz-edition5 theory-of-computation turing-machine
10.26.154 Peter Linz Edition5: Peter Linz Edition 5 Exercise 9.3 Question 1 (Page No. 248)
https://gateoverflow.in/309434
Consider the set of machine language instructions for a computer of your choice. Sketch how the
various instructions in this set could be carried out by a Turing machine.
peter-linz peter-linz-edition5 theory-of-computation turing-machine difficult
10.27.1 Pigeonhole Principle: Peter Linz Edition 4 Exercise 4.3 Question 18 (Page No. 124) https://gateoverflow.in/309823
10.28.1 Polynomials: Michael Sipser Edition 3 Exercise 3 Question 21 (Page No. 190) https://gateoverflow.in/323649
Let c1 xn + c2 xn−1 + ⋯ + cn x + cn+1 be a polynomial with a root at x = x0 . Let cmax be the largest absolute
value of a ci . Show that ∣x0 ∣< (n + 1) c∣max
c∣
.
1
10.29.1 Post Correspondence Problem: Michael Sipser Edition 3 Exercise 5 Question 17 (Page No. 240)
https://gateoverflow.in/323981
Show that the Post Correspondence Problem is decidable over the unary alphabet Σ = {1} .
10.29.2 Post Correspondence Problem: Michael Sipser Edition 3 Exercise 5 Question 18 (Page No. 240)
https://gateoverflow.in/323982
Show that the Post Correspondence Problem is undecidable over the binary alphabet
Σ = {0, 1} .
michael-sipser theory-of-computation post-correspondence-problem decidability proof
10.29.3 Post Correspondence Problem: Michael Sipser Edition 3 Exercise 5 Question 19 (Page No. 240)
https://gateoverflow.in/323983
In the silly Post Correspondence Problem , SP CP , the top string in each pair has the same
length as the bottom string. Show that the SP CP is decidable.
10.29.4 Post Correspondence Problem: Michael Sipser Edition 3 Exercise 5 Question 21 (Page No. 240)
https://gateoverflow.in/323985
L e t AMBI GCFG = {⟨G⟩ ∣ G is an ambiguous CFG}. Show that AMBIGCFG is
undecidable.
(Hint: Use a reduction from P CP . Given an instance
P ={ [ ] ,[ ,] [ , …}]
t1 t2 tk
b1 b2 bk
of the Post Correspondence Problem, construct a CFG G with the rules
S→T ∣B
T → t1 T a1 ∣ ⋯ ∣ tk T ak ∣ t1 a1 ∣ ⋯ ∣ tk T ak
B → b1 Ba1 ∣ ⋯ ∣ bk Bak ∣ b1 a1 ∣ ⋯ ∣ bk T ak ,
where a1 , … , ak are new terminal symbols. Prove that this reduction works.)
10.29.5 Post Correspondence Problem: Michael Sipser Edition 3 Exercise 5 Question 3 (Page No. 239)
https://gateoverflow.in/323943
Find a match in the following instance of the Post Correspondence Problem.
{ [ [ ] ], , [ [] , }]
ab b aba aa
abab a b a
michael-sipser theory-of-computation turing-machine post-correspondence-problem proof
10.30.1 Post Corresponding Problem: Michael Sipser Edition 3 Exercise 5 Question 8 (Page No. 239)
https://gateoverflow.in/323970
In the proof of Theorem 5.15, we modified the Turing machine M so that it never tries to move
its head off the left-hand end of the tape. Suppose that we did not make this modification to M . Modify the P CP
construction to handle this case.
michael-sipser theory-of-computation turing-machine post-corresponding-problem proof
10.31.1 Prefix: Michael Sipser Edition 3 Exercise 1 Question 40 (Page No. 89) https://gateoverflow.in/310925
Recall that string x is a prefix of string y if a string z exists where xz = y, and that x is a proper prefix of y if in
addition x ≠ y. In each of the following parts, we define an operation on a language A. Show that the class of regular
languages is closed under that operation.
10.32.1 Prefix Closed: Michael Sipser Edition 3 Exercise 2 Question 40 (Page No. 158) https://gateoverflow.in/323326
Say that a language is prefix-closed if all prefixes of every string in the language are also in the language. Let C be an
infinite, prefix-closed, context-free language. Show that C contains an infinite regular subset.
michael-sipser theory-of-computation context-free-languages prefix-closed
10.33.1 Prefix Free Language: Michael Sipser Edition 3 Exercise 2 Question 52 (Page No. 159)
https://gateoverflow.in/323445
Show that every DCFG generates a prefix-free language.
michael-sipser theory-of-computation context-free-grammars prefix-free-language proof
10.34.1 Pumping Lemma: Michael Sipser Edition 3 Exercise 1 Question 29 (Page No. 88) https://gateoverflow.in/310479
Use the pumping lemma to show that the following languages are not regular.
a. A1 = {0n 1n 2n |n ≥ 0}
b. A2 = {www|w ∈ {a, b}∗ }
c. A3 = {a2 |n ≥ 0} (Here,a2 means a strings of 2n a's.)
n n
10.34.2 Pumping Lemma: Michael Sipser Edition 3 Exercise 1 Question 30 (Page No. 88) https://gateoverflow.in/310480
Describe the error in the following “proof" that 0∗ 1∗ is not a regular language. (An error must exist because 0∗ 1∗ is
regular.) The proof is by contradiction. Assume that 0∗ 1∗ is regular. Let p be the pumping length for 0∗ 1∗ given by the
pumping lemma. Chooses to be the string 0p 1p . You know that s is a member of 0∗ 1∗ ,but example 1.73 shows that s cannot
be pumped. Thus you have a contradiction. So 0∗ 1∗ is not regular.
michael-sipser theory-of-computation finite-automata pumping-lemma proof
10.34.3 Pumping Lemma: Michael Sipser Edition 3 Exercise 1 Question 54 (Page No. 91) https://gateoverflow.in/311034
10.34.4 Pumping Lemma: Michael Sipser Edition 3 Exercise 1 Question 55 (Page No. 91) https://gateoverflow.in/311035
The pumping lemma says that every regular language has a pumping length p, such that every string in the language
′
can be pumped if it has length p or more. If p is a pumping length for language A, so is any length p ≥ p. The
minimum pumping length for A is the smallest p that is a pumping length for A.For example, if A = 01∗ , the minimum
pumping length is 2. The reason is that the string s = 0 is in A and has length 1 yet s cannot be pumped ; but any string in A
of length 2 or more contains a 1 and hence can be pumped by dividing it so that x = 0, y = 1, and z is the rest. For each of
the following languages, give the minimum pumping length and justify your answer.
10.34.5 Pumping Lemma: Michael Sipser Edition 3 Exercise 2 Question 30 (Page No. 157) https://gateoverflow.in/311296
Use the pumping lemma to show that the following languages are not context free .
a. {0n 1n 0n 1n ∣ n ≥ 0}
b. {0n #02n #03n ∣ n ≥ 0}
c. {w#t ∣ w is a substring of t, where w, t ∈ {a, b}∗ }
d. {t1 #t2 #. . . #tk ∣ k ≥ 2, each ti ∈ {a, b}∗ , and ti = tj for some i ≠ j}
10.34.6 Pumping Lemma: Michael Sipser Edition 3 Exercise 2 Question 34 (Page No. 157) https://gateoverflow.in/311300
Let G = (V , Σ, R, S) be the following grammar. V = {S, T, U}; Σ = {0, #}; and R is the set of rules :
S → TT ∣ U
T → 0T ∣ T0 ∣ #
U → 0U00 ∣ #
Consider the language B = L(G), where G is the grammar which is given above .The pumping lemma for context-free
languages, Theorem 2.34, states the existence of a pumping length p for B. What is the minimum value of p that works in
the pumping lemma? Justify your answer .
michael-sipser theory-of-computation context-free-languages pumping-lemma proof
10.34.7 Pumping Lemma: Michael Sipser Edition 3 Exercise 2 Question 36 (Page No. 158) https://gateoverflow.in/311304
Give an example of a language that is not context free but that acts like a CFL in the pumping lemma . Prove that your
example works. (See the analogous example for regular languages in Question 54.)
10.34.8 Pumping Lemma: Michael Sipser Edition 3 Exercise 2 Question 37 (Page No. 158) https://gateoverflow.in/311316
Prove the following stronger form of the pumping lemma, where in both pieces v and y must be nonempty when the
string s is broken up .If A is a context-free language, then there is a number k where, if s is any string in A of length at
least k, then s may be divided into five pieces , s = uvxyz, satisfying the conditions :
10.34.9 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 1 (Page No. 122) https://gateoverflow.in/309725
Prove the following version of the pumping lemma. If L is regular, then there is an m such that,
every w ∈ L of length greater than m can be decomposed as w = xyz, with |yz| ≤ m and |y| ≥ 1, such that xy i z is
in L for all i.
peter-linz peter-linz-edition4 theory-of-computation pumping-lemma
10.34.10 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 10 (Page No. 123) https://gateoverflow.in/309733
10.34.11 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 11 (Page No. 123) https://gateoverflow.in/208310
10.34.12 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 12 (Page No. 123) https://gateoverflow.in/309735
Apply the pumping lemma to show that L = {an bk cn+k : n ≥ 0, k ≥ 0 } is not regular.
peter-linz peter-linz-edition4 theory-of-computation pumping-lemma regular-languages
10.34.13 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 13 (Page No. 123) https://gateoverflow.in/309739
10.34.14 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 14 (Page No. 123) https://gateoverflow.in/309737
Prove or disprove the following statement: If L1 and L2 are non regular languages, then L1 ∪ L2 is
also non regular.
peter-linz peter-linz-edition4 theory-of-computation regular-languages pumping-lemma
10.34.15 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 15 (Page No. 123) https://gateoverflow.in/309820
Consider the languages below. For each, make a conjecture whether or not it is regular. Then
prove your conjecture.
(e) L = {an bl : n ≤ l ≤ 2n }
(g) L = {an bl : |n − l| = 2 }
10.34.16 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 16 (Page No. 123) https://gateoverflow.in/309821
10.34.17 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 2 (Page No. 122) https://gateoverflow.in/309726
10.34.18 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 26 (Page No. 124) https://gateoverflow.in/309832
10.34.19 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 3 (Page No. 122) https://gateoverflow.in/309727
10.34.20 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 4 (Page No. 122) https://gateoverflow.in/309728
10.34.22 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 6 (Page No. 122) https://gateoverflow.in/304888
10.34.23 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 7 (Page No. 123) https://gateoverflow.in/309730
Show that the language L = {an bn : n ≥ 0 } ∪ {an bn+1 : n ≥ 0 } ∪ {an bn+2 : n ≥ 0 } is not regular.
peter-linz peter-linz-edition4 theory-of-computation pumping-lemma
10.34.24 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 8 (Page No. 123) https://gateoverflow.in/309731
10.34.25 Pumping Lemma: Peter Linz Edition 4 Exercise 4.3 Question 9 (Page No. 123) https://gateoverflow.in/309732
10.34.26 Pumping Lemma: Peter Linz Edition 4 Exercise 8.1 Question 1 (Page No. 212) https://gateoverflow.in/315584
10.34.27 Pumping Lemma: Peter Linz Edition 4 Exercise 8.1 Question 5 (Page No. 212) https://gateoverflow.in/315585
10.34.28 Pumping Lemma: Peter Linz Edition 4 Exercise 8.1 Question 8 (Page No. 212) https://gateoverflow.in/315586
10.34.29 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 1 (Page No. 212) https://gateoverflow.in/310030
is not context-free.
peter-linz peter-linz-edition5 theory-of-computation pumping-lemma proof
10.34.30 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 2 (Page No. 212) https://gateoverflow.in/310031
10.34.31 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 3 (Page No. 212) https://gateoverflow.in/310032
10.34.32 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 4 (Page No. 212) https://gateoverflow.in/310033
Show that L = {w ∈ {a, b, c}∗ : n2a (w) + n2b (w) = n2c (w)} is not a context-free.
10.34.33 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 5 (Page No. 212) https://gateoverflow.in/310034
10.34.34 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 6 (Page No. 212) https://gateoverflow.in/310035
10.34.35 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(a) (Page No. 212) https://gateoverflow.in/310036
L = {an bj : n ≤ j2 } .
peter-linz peter-linz-edition5 theory-of-computation pumping-lemma proof context-free-languages
10.34.36 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(b) (Page No. 212) https://gateoverflow.in/310037
L = {an bj : n ≥ (j − 1)3 } .
peter-linz peter-linz-edition5 theory-of-computation pumping-lemma proof context-free-languages
10.34.37 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(c) (Page No. 212) https://gateoverflow.in/310038
L = {an bj ck : k = jn} .
peter-linz peter-linz-edition5 theory-of-computation pumping-lemma proof context-free-languages
10.34.38 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(d) (Page No. 212) https://gateoverflow.in/310039
L = {an bj ck : n < j, n ≤ k ≤ j} .
peter-linz peter-linz-edition5 theory-of-computation pumping-lemma proof context-free-languages
10.34.40 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(f) (Page No. 212) https://gateoverflow.in/310041
.
peter-linz peter-linz-edition5 theory-of-computation pumping-lemma proof context-free-languages
10.34.41 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(g) (Page No. 212) https://gateoverflow.in/310042
10.34.42 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(h) (Page No. 212) https://gateoverflow.in/310043
10.34.43 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(i) (Page No. 212) https://gateoverflow.in/310044
10.34.44 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(j) (Page No. 212) https://gateoverflow.in/310045
10.34.45 Pumping Lemma: Peter Linz Edition 5 Exercise 8.1 Question 7(k) (Page No. 212) https://gateoverflow.in/310046
10.35.1 Pushdown Automata: Michael Sipser Edition 3 Exercise 2 Question 10 (Page No. 155)
https://gateoverflow.in/311117
Give an informal description of a pushdown automaton that recognizes the language
A = {ai bj ck ∣ i = j or j = k where i, j, k ≥ 0}.
michael-sipser theory-of-computation context-free-languages pushdown-automata
10.35.2 Pushdown Automata: Michael Sipser Edition 3 Exercise 2 Question 11 (Page No. 155)
https://gateoverflow.in/311118
Convert the CFG G4
E→E+T ∣T
T →T ×F ∣F
F → (E) ∣ a
10.35.3 Pushdown Automata: Michael Sipser Edition 3 Exercise 2 Question 12 (Page No. 156)
https://gateoverflow.in/311120
Convert the CFG G
R → XRX ∣ S
S → aTb ∣ bTa
T → XTX ∣ X ∣ ϵ
X→a∣b
10.35.4 Pushdown Automata: Michael Sipser Edition 3 Exercise 2 Question 47 (Page No. 159)
https://gateoverflow.in/323437
Let Σ = {0, 1} and let B be the collection of strings that contain at least one 1 in their second
half. In other words, B = {uv ∣ u ∈ Σ∗ , v ∈ Σ∗ 1Σ∗ and ∣ u ∣≥∣ v ∣} .
10.35.5 Pushdown Automata: Michael Sipser Edition 3 Exercise 2 Question 5 (Page No. 155)
https://gateoverflow.in/311110
Give informal descriptions and state diagrams of pushdown automata for the languages in the
following languages In all parts, the alphabet ∑ is {0, 1}.
a. {w| w contains at least three 1’s} b. {w| w starts and ends with the same symbol}
c. {w| the length of w is odd} d. {w| the length of w is odd and its middle symbol is a 0}
e. {w|w = wR , that is, w is a palindrome} f. The empty set.
michael-sipser theory-of-computation context-free-languages pushdown-automata
10.35.6 Pushdown Automata: Michael Sipser Edition 3 Exercise 2 Question 7 (Page No. 155)
https://gateoverflow.in/311112
Give informal English descriptions of PDAs for the following languages.
a. The set of strings over the alphabet {a, b} with more a′ s than b′ s
b. The complement of the language {an bn |n ≥ 0}
c. {w#x|wR is a substring of x for w, x ∈ {0, 1}∗ }
d. {x1 #x2 #. . . #xk |k ≥ 1, each xi ∈ {a, b}∗ , and for some i and j, xi = xR
j }
10.35.7 Pushdown Automata: Michael Sipser Edition 3 Exercise 4 Question 24 (Page No. 212)
https://gateoverflow.in/323820
A useless state in a pushdown automaton is never entered on any input string. Consider the
problem of determining whether a pushdown automaton has any useless states. Formulate this problem as a language
and show that it is decidable.
michael-sipser theory-of-computation pushdown-automata decidability proof
10.35.8 Pushdown Automata: Michael Sipser Edition 3 Exercise 5 Question 33 (Page No. 241)
https://gateoverflow.in/324084
Consider the problem of determining whether a P DA accepts some string of the form
{ww ∣ w ∈ {0, 1}∗ } . Use the computation history method to show that this problem is undecidable.
michael-sipser theory-of-computation pushdown-automata decidability proof
10.35.9 Pushdown Automata: Peter Linz Edition 4 Exercise 7.1 Question 1 (Page No. 183) https://gateoverflow.in/310346
Find a pda with fewer than four states that accepts the language L ={an bn : n ≥ 0 } ∪ {a}.
peter-linz peter-linz-edition4 theory-of-computation pushdown-automata
10.35.10 Pushdown Automata: Peter Linz Edition 4 Exercise 7.2 Question 1 (Page No. 195)
https://gateoverflow.in/315424
Show that the pda constructed in Example 7.6 accepts the string aaabbbb that is in the language
generated by the given grammar.
Example 7.6: Construct a pda that accepts the language generated by a grammar with productions
S → aSbb|a.
10.35.11 Pushdown Automata: Peter Linz Edition 4 Exercise 7.2 Question 2 (Page No. 195)
https://gateoverflow.in/315425
Prove that the pda in Example 7.6 accepts the language L = {an+1 b2n : n ≥ 0 }.
10.36.1 Recursive And Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 6 (Page No.
188) https://gateoverflow.in/323629
In Theorem 3.21, we showed that a language is Turing-recognizable iff some enumerator enumerates it. Why didn’t we
use the following simpler algorithm for the forward direction of the proof? As before, s1 , s2 , … is a list of all strings in
Σ∗ .
E =" Ignore the input.
1. Repeat the following for i = 1, 2, 3, … .
2. Run M on si .
3. If it accepts, print out si . "
10.37.1 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 11 (Page No. 189)
https://gateoverflow.in/323634
A Turing machine with doubly infinite tape is similar to an ordinary Turing machine, but its tape
is infinite to the left as well as to the right. The tape is initially filled with blanks except for the portion that contains the
input. Computation is defined as usual except that the head never encounters an end to the tape as it moves leftward.
Show that this type of Turing machine recognizes the class of Turing-recognizable languages.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages descriptive
10.37.2 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 12 (Page No. 189)
https://gateoverflow.in/323636
A Turing machine with left reset is similar to an ordinary Turing machine, but the transition
function has the form
δ : Q × Γ → Q × Γ × {R, RESET}
If δ(q, a) = (r, b, RESET), when the machine is in state q reading an a, the machine’s head jumps to the left-hand end of
the tape after it writes b on the tape and enters state r. Note that these machines do not have the usual ability to move the head
one symbol left. Show that Turing machines with left reset recognize the class of Turing-recognizable languages.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages descriptive
10.37.3 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 13 (Page No. 189)
https://gateoverflow.in/323637
A Turing machine with stay put instead of left is similar to an ordinary Turing machine, but the
transition function has the form
δ : Q × Γ → Q × Γ × {R, S}
At each point, the machine can move its head right or let it stay in the same position. Show that this Turing machine variant is
not equivalent to the usual version. What class of languages do these machines recognize?
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages descriptive
10.37.4 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 14 (Page No. 189)
https://gateoverflow.in/323638
A queue automaton is like a push-down automaton except that the stack is replaced by a queue.
A queue is a tape allowing symbols to be written only on the left-hand end and read only at the right-hand end. Each
write operation (we’ll call it a push) adds a symbol to the left-hand end of the queue and each read operation (we’ll call
it a pull) reads and removes a symbol at the right-hand end. As with a PDA, the input is placed on a separate read-only input
tape, and the head on the input tape can move only from left to right. The input tape contains a cell with a blank symbol
following the input, so that the end of the input can be detected. A queue automaton accepts its input by entering a special
accept state at any time. Show that a language can be recognized by a deterministic queue automaton iff the language is
Turing-recognizable.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages descriptive
10.37.5 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 16 (Page No. 189)
https://gateoverflow.in/323642
Show that the collection of Turing-recognizable languages is closed under the operation of
a. union. b. concatenation.
c. star. d. intersection.
e. homomorphism.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages
10.37.6 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 17 (Page No. 189)
https://gateoverflow.in/323643
L e t B = {⟨M1 ⟩, ⟨M1 ⟩, …} be a Turing-recognizable language consisting of TM
descriptions. Show that there is a decidable language C consisting of TM descriptions such that every machine
described in B has an equivalent machine in C and vice versa.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages descriptive
10.37.7 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 19 (Page No. 190)
https://gateoverflow.in/323646
Show that every infinite Turing-recognizable language has an infinite decidable subset.
10.37.8 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 3 Question 20 (Page No. 190)
https://gateoverflow.in/323647
Show that single-tape TMs that cannot write on the portion of the tape containing the input
string recognize only regular languages.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages proof
10.37.9 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 4 Question 18 (Page No. 212)
L e t C be a language. Prove that C is Turing-recognizable iff a decidable language D exists such that
C = {x ∣ ∃y(⟨x, y⟩ ∈ D)} .
https://gateoverflow.in/323797
10.37.10 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 4 Question 20 (Page No. 212)
https://gateoverflow.in/323800
Let A and B be two disjoint languages. Say that language C separates A and B if A ⊆ C and
B ⊆ ¯C
¯¯¯
. Show that any two disjoint co-Turing-recognizable languages are separable by some decidable language.
michael-sipser theory-of-computation recursive-recursively-enumerable-languages proof
10.37.11 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 4 Question 30 (Page No. 212)
https://gateoverflow.in/323826
L e t A be a Turing-recognizable language consisting of descriptions of Turing machines,
{⟨M1 ⟩, ⟨M2 ⟩, …} , where every Mi is a decider. Prove that some decidable language D is not decided by any decider
Mi whose description appears in A. (Hint: You may find it helpful to consider an enumerator for A.)
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages decidability proof
10.37.12 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 4 Question 5 (Page No. 211)
https://gateoverflow.in/323766
L e t ETM = {⟨M⟩ ∣ M is a TM and L(M) = ϕ} . Show that ETM , the complement of
ETM , is Turing-recognizable.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages proof
10.37.13 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 5 Question 2 (Page No. 239)
https://gateoverflow.in/323834
Show that EQCFG is co-Turing-recognizable.
10.37.14 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 5 Question 22 (Page No. 240)
https://gateoverflow.in/323987
Show that A is Turing-recognizable iff A ≤m ATM .
10.37.15 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 5 Question 24 (Page No. 240)
https://gateoverflow.in/323989
¯¯¯¯¯¯¯¯¯¯
L e t J = {w ∣ either w = 0x for some x ∈ ATM , or w = 1y for some y ∈ ATM } . Show
¯¯
¯
that neither J nor J is Turing-recognizable.
michael-sipser theory-of-computation turing-machine recursive-recursively-enumerable-languages proof
10.37.16 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 5 Question 35 (Page No. 242)
https://gateoverflow.in/324086
Say that a variable A in CFG G is necessary if it appears in every derivation of some string
w ∈ G . Let NECESSARYCFG = {⟨G, A⟩ ∣ A is a necessary variable in G} .
10.37.17 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 5 Question 36 (Page No. 242)
https://gateoverflow.in/324088
Say that a CFG is minimal if none of its rules can be removed without changing the language
generated. Let MI NCFG = {⟨G⟩ ∣ G is a minimal CFG} .
10.37.18 Recursive Recursively Enumerable Languages: Michael Sipser Edition 3 Exercise 5 Question 7 (Page No. 239)
https://gateoverflow.in/323969
¯¯¯¯
Show that if A is Turing-recognizable and A ≤m A, then A is decidable.
10.38.1 Reduction: Michael Sipser Edition 3 Exercise 5 Question 23 (Page No. 240) https://gateoverflow.in/323988
10.38.2 Reduction: Michael Sipser Edition 3 Exercise 5 Question 25 (Page No. 240) https://gateoverflow.in/323990
10.38.3 Reduction: Michael Sipser Edition 3 Exercise 5 Question 4 (Page No. 239) https://gateoverflow.in/323965
If A ≤m B and B is a regular language, does that imply that A is a regular language? Why or why not?
michael-sipser theory-of-computation regular-languages reduction proof
10.38.4 Reduction: Michael Sipser Edition 3 Exercise 5 Question 5 (Page No. 239) https://gateoverflow.in/323966
Show that ATM is not mapping reducible to ETM . In other words, show that no computable function reduces ATM to
ETM . (Hint: Use a proof by contradiction, and facts you already know about ATM and ETM .)
michael-sipser theory-of-computation turing-machine reduction proof
10.38.5 Reduction: Michael Sipser Edition 3 Exercise 5 Question 6 (Page No. 239) https://gateoverflow.in/323968
10.39.1 Regular Grammar: Peter Linz Edition 4 Exercise 3.1 Question 27 (Page No. 77) https://gateoverflow.in/207632
Find a regular expression that denotes all bit strings whose value, when interpreted as a binary integer, is greater than or
equal to 40.
theory-of-computation peter-linz peter-linz-edition4 regular-expressions regular-grammar
10.39.2 Regular Grammar: Peter Linz Edition 4 Exercise 3.1 Question 5 (Page No. 75) https://gateoverflow.in/304808
10.39.3 Regular Grammar: Peter Linz Edition 4 Exercise 3.1 Question 7 (Page No. 76) Exercise 3.3 Question 9 (Page No.
97) https://gateoverflow.in/136177
Regular Expression:-
Q1) What languages do the expression (∅*)* and a∅ denote?
Q2) Find a regular expression and finite automata for all bit strings, with leading bit 1 interpreted as a binary integer, with
values not between 10 and 30.
Regular Grammar:-
Q1) Suggest a construction by which a left-linear grammar can be obtained from an nfa directly.
Q2) Find a regular grammar and draw the nfa or dfa that generates the language
L = { w ∈ {a, b}* / (number of a in w + 3*number of b) in w is even }
10.39.4 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 1 (Page No. 96) https://gateoverflow.in/308586
10.39.5 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 10 (Page No. 97) https://gateoverflow.in/308593
10.39.6 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 11 (Page No. 97) https://gateoverflow.in/308594
10.39.7 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 12 (Page No. 97) https://gateoverflow.in/308595
10.39.8 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 13 (Page No. 97) https://gateoverflow.in/308596
10.39.9 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 14 (Page No. 97) https://gateoverflow.in/308597
Show that for every regular language not containing λ there exists a right-linear grammar whose productions are
restricted to the forms
A → aB ,
or
A → a,
where A, B ∈ V , and a ∈ T
peter-linz peter-linz-edition4 theory-of-computation regular-grammar
10.39.10 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 17 (Page No. 97) https://gateoverflow.in/308599
Let G1 = (V1 , Σ, S1 , P1 ) be right-linear and G2 = (V2 , Σ, S2 , P2 ) be a left-linear grammar, and assume that V1 and
V2 are disjoint. Consider the linear grammar G =({S }∪V1 ∪ V2 , Σ, S, P ) , where S is not in V1 ∪ V2 and
Find a regular grammar that generates the language L(aa∗ (ab + a)∗ ) .
10.39.12 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 3 (Page No. 96) https://gateoverflow.in/308588
S → abA,
A → baB,
B → aA|bb.
peter-linz peter-linz-edition4 theory-of-computation regular-grammar
10.39.13 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 4 (Page No. 96) https://gateoverflow.in/308589
10.39.14 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 5 (Page No. 96) https://gateoverflow.in/308590
10.39.15 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 6 (Page No. 97) https://gateoverflow.in/304807
S->aaA | ε
A->bA | abA | S
theory-of-computation peter-linz peter-linz-edition4 finite-automata regular-languages regular-grammar
10.39.16 Regular Grammar: Peter Linz Edition 4 Exercise 3.3 Question 7 (Page No. 97) https://gateoverflow.in/308592
Find a regular grammar that generates the language on Σ = {a, b} consisting of all strings with no
more than three a's.
peter-linz peter-linz-edition4 theory-of-computation regular-grammar
10.39.17 Regular Grammar: Peter Linz Edition 4 Exercise 5.2 Question 11 (Page No. 145) https://gateoverflow.in/309999
Rice’s theorem. Let P be any nontrivial property of the language of a Turing machine. Prove that the problem of
determining whether a given Turing machine’s language has property P is undecidable. In more formal terms, let P be
a language consisting of Turing machine descriptions where P fulfills two conditions. First, P is nontrivial—it contains some,
but not all, TM descriptions. Second, P is a property of the T M ′ s language—whenever L(M1 ) = L(M2 ) , we have
⟨M1 ⟩ ∈ P iff ⟨M2 ⟩ ∈ P . Here, M1 and M2 are any TMs . Prove that P is an undecidable language.
michael-sipser theory-of-computation turing-machine decidability rice-theorem proof
10.40.2 Rice Theorem: Michael Sipser Edition 3 Exercise 5 Question 29 (Page No. 241) https://gateoverflow.in/324076
Rice’s theorem. Let P be any nontrivial property of the language of a Turing machine. Prove that the problem of
determining whether a given Turing machine’s language has property P is undecidable. In more formal terms, let P be
a language consisting of Turing machine descriptions where P fulfills two conditions. First, P is nontrivial—it contains some,
but not all, TM descriptions. Second, P is a property of the T M ′ s language—whenever L(M1 ) = L(M2 ) , we have
⟨M1 ⟩ ∈ P iff ⟨M2 ⟩ ∈ P . Here, M1 and M2 are any TMs . Prove that P is an undecidable language.
Show that both conditions are necessary for proving that P is undecidable.
michael-sipser theory-of-computation turing-machine decidability rice-theorem proof
10.40.3 Rice Theorem: Michael Sipser Edition 3 Exercise 5 Question 30 (Page No. 241) https://gateoverflow.in/324077
Use Rice’s theorem, to prove the undecidability of each of the following languages.
10.41.1 Rotational Closure Of Language: Michael Sipser Edition 3 Exercise 1 Question 67 (Page No. 93)
https://gateoverflow.in/311049
Let the rotational closure of language A be RC(A) = {yx|xy ∈ A}.
10.42.1 Scarnes Cut: Michael Sipser Edition 3 Exercise 1 Question 68 (Page No. 93) https://gateoverflow.in/311052
In the traditional method for cutting a deck of playing cards, the deck is arbitrarily split two parts, which are exchanged
beforereassembling the deck. In a more complex cut, called Scarne’s cut, the deck is broken into three parts and the
middle part in placed first in the reassembly. We’ll take Scarne’s cut as the inspiration for an operation on languages . For a
language A, let CUT(A) = {yxz| xyz ∈ A}.
10.43.1 Sets: Michael Sipser Edition 3 Exercise 0 Question 3 (Page No. 26) https://gateoverflow.in/309903
a. Is A a subset of B?
b. Is B a subset of A?
c. What is A ∪ B?
d. What is A ∩ B?
e. What is A × B?
10.43.2 Sets: Michael Sipser Edition 3 Exercise 0 Question 4 (Page No. 26) https://gateoverflow.in/309904
If A has a elements and B has b elements, how many elements are in A × B? Explain your answer.
michael-sipser theory-of-computation sets easy
10.43.3 Sets: Michael Sipser Edition 3 Exercise 0 Question 5 (Page No. 26) https://gateoverflow.in/309905
If C is a set with c elements, how many elements are in the power set of C? Explain your answer.
michael-sipser theory-of-computation sets easy
10.44.1 Shuffle: Michael Sipser Edition 3 Exercise 2 Question 39 (Page No. 158) https://gateoverflow.in/323325
For the definition of the shuffle operation. For languages A and B, let the shuffle of A and B be the language
{w|w = a1 b1 … ak bk , where a1 ⋅ ⋅ ⋅ ak ∈ A and b1 ⋅ ⋅ ⋅ bk ∈ B, each ai , bi ∈ Σ∗ }.
Show that the class of context-free languages is not closed under shuffle.
michael-sipser theory-of-computation context-free-languages shuffle
10.45.1 Simplification: Peter Linz Edition 4 Exercise 6.1 Question 13 (Page No. 162) https://gateoverflow.in/208947
Use the construction in the proof of Theorem 1.49 to give the state diagrams of NF A′ s recognizing the star of the
languages described in
10.46.2 State Diagram: Michael Sipser Edition 3 Exercise 1 Question 3 (Page No. 83) https://gateoverflow.in/310436
The formal description of a DFA M is (q1, q2, q3, q4, q5 , u, d, δ, q3, q3), where δ is given by the following table.
Give the state diagram of this machine.
10.46.3 State Diagram: Michael Sipser Edition 3 Exercise 1 Question 4 (Page No. 83) https://gateoverflow.in/310437
Each of the following languages is the intersection of two simpler languages. In each part, construct DFAs for the
simpler languages, then combine them using the construction discussed in footnote 3 (page 46) to give the state
diagram of a DFA for the language given. In all parts, Σ = {a, b}.
10.46.4 State Diagram: Michael Sipser Edition 3 Exercise 1 Question 6 (Page No. 84) https://gateoverflow.in/310441
Give state diagrams of DFAs recognizing the following languages. In all parts, the alphabet is {0, 1}.
Give state diagrams of NFA's with the specified number of states recognizing each of the following languages. In all
parts, the alphabet is {0, 1}.
10.46.6 State Diagram: Michael Sipser Edition 3 Exercise 1 Question 8 (Page No. 84) https://gateoverflow.in/310443
Use the construction in the proof of Theorem 1.45 to give the state diagrams of NFA’s recognizing the union of the
languages described in
a. L1 = {w| w begins with a 1 and ends with a 0} ∪ L2 = {w| w contains at least three 1s}
b.
L1 = {w| w contains the substring 0101 (i.e., w = x0101y for some x and y)} ∪ L2 = {w| w doesn’t contain the substri
10.46.7 State Diagram: Michael Sipser Edition 3 Exercise 1 Question 9 (Page No. 85) https://gateoverflow.in/310450
Use the construction in the proof of Theorem 1.47 to give the state diagrams of NFA's recognizing the concatenation
of the languages described in and input alphabet is Σ = {0, 1}
10.47.1 Suffix Operation: Michael Sipser Edition 3 Exercise 2 Question 25 (Page No. 157) https://gateoverflow.in/311285
For any language A, let SUFFIX(A) = {v ∣ uv ∈ A for some string u}. Show that the class of context-free
languages is closed under the SUFFIX operation.
michael-sipser theory-of-computation context-free-languages suffix-operation proof
10.48.1 Synchronizable Dfa: Michael Sipser Edition 3 Exercise 1 Question 59 (Page No. 92)
https://gateoverflow.in/311040
L e t M = (Q, Σ, δ, q0 , F) be a DFA and let h be a state of M called its “home”. A
synchronizing sequence for M and h is a string s ∈ ∑∗ where δ(q, s) = h for every q ∈ Q. (Here we have
extended δ to strings, so that δ(q, s) equals the state where M ends up when M starts at state q and reads input s. ) Say that M
is synchronizable if it has a synchronizing sequence for some state h. Prove that if M is a k-state synchronizable DFA, then
it has a synchronizing sequence of length at most k3 .Can you improve upon this bound ?
michael-sipser theory-of-computation finite-automata synchronizable-dfa descriptive
10.49.1 Transducer: Michael Sipser Edition 3 Exercise 1 Question 24 (Page No. 87) https://gateoverflow.in/310471
A finite state transducer (FST) is a type of deterministic finite automaton whose output is a string and not just
accept or reject. The following are state diagrams of finite state transducers T1 and T2.
Each transition of an FST is labeled with two symbols, one designating the input symbol for that transition and the other
designating the output symbol. The two symbols are written with a slash, /, separating them. In T1 , the transition from q1 to q2
has input symbol 2 and output symbol 1. Some transitions may have multiple input-output pairs, such as the transition in T1
from q1 to itself. When an FST computes on an input string w, it takes the input symbols w1 ⋅ ⋅ ⋅ wn one by one and, starting
at the start state, follows the transitions by matching the input labels with the sequence of symbols w1 ⋅ ⋅ ⋅ wn = w. Every time
it goes along a transition, it outputs the corresponding output symbol. For example, on input 2212011, machine T1 enters the
sequence of states q1 , q2 , q2 , q2 , q2 , q1 , q1 , q1 and produces output 1111000. On input abbb, T2
outputs 1011.
Give the sequence of states entered and the output produced in each of the following parts.
a. T1 on input 011
b. T1 on input 211
c. T1 on input 121
d.T1 on input 0202
e. T2 on input b
f. T2 on input bbab
g. T2 on input bbbbbb
h. T2 on input ϵ
Answer Keys
10.1.1 Q-Q 10.2.1 N/A 10.2.2 N/A 10.2.3 N/A 10.3.1 N/A
10.3.2 N/A 10.3.3 N/A 10.3.4 Q-Q 10.3.5 Q-Q 10.3.6 Q-Q
10.3.7 Q-Q 10.3.8 Q-Q 10.3.9 Q-Q 10.3.10 Q-Q 10.3.11 Q-Q
10.3.12 Q-Q 10.3.13 Q-Q 10.3.14 Q-Q 10.3.15 Q-Q 10.3.16 Q-Q
10.3.17 Q-Q 10.3.18 Q-Q 10.3.19 Q-Q 10.3.20 Q-Q 10.3.21 Q-Q
10.3.22 Q-Q 10.3.23 Q-Q 10.3.24 Q-Q 10.3.25 Q-Q 10.3.26 Q-Q
10.3.27 Q-Q 10.3.28 Q-Q 10.3.29 Q-Q 10.3.30 Q-Q 10.3.31 Q-Q
10.4.1 Q-Q 10.4.2 N/A 10.4.3 N/A 10.5.1 N/A 10.6.1 Q-Q
10.6.2 Q-Q 10.6.3 Q-Q 10.6.4 Q-Q 10.6.5 Q-Q 10.6.6 Q-Q
10.6.7 N/A 10.6.8 N/A 10.6.9 N/A 10.6.10 N/A 10.6.11 N/A
10.6.12 N/A 10.6.13 N/A 10.6.14 Q-Q 10.6.15 Q-Q 10.6.16 N/A
10.6.17 N/A 10.6.18 N/A 10.6.19 N/A 10.6.20 N/A 10.6.21 Q-Q
10.6.22 Q-Q 10.6.23 Q-Q 10.6.24 Q-Q 10.6.25 Q-Q 10.6.26 Q-Q
10.6.27 Q-Q 10.6.28 Q-Q 10.6.29 Q-Q 10.6.30 Q-Q 10.6.31 Q-Q
10.6.32 Q-Q 10.6.33 Q-Q 10.6.34 Q-Q 10.6.35 Q-Q 10.6.36 Q-Q
10.6.37 Q-Q 10.6.38 Q-Q 10.6.39 Q-Q 10.6.40 Q-Q 10.6.41 Q-Q
10.6.42 Q-Q 10.6.43 Q-Q 10.6.44 Q-Q 10.6.45 Q-Q 10.6.46 Q-Q
10.6.47 Q-Q 10.6.48 Q-Q 10.6.49 Q-Q 10.6.50 Q-Q 10.6.51 Q-Q
10.6.52 Q-Q 10.6.53 Q-Q 10.6.54 Q-Q 10.6.55 Q-Q 10.6.56 Q-Q
10.6.57 Q-Q 10.6.58 Q-Q 10.6.59 Q-Q 10.6.60 Q-Q 10.6.61 Q-Q
10.6.62 Q-Q 10.6.63 Q-Q 10.6.64 Q-Q 10.6.65 Q-Q 10.6.66 Q-Q
10.6.67 Q-Q 10.6.68 Q-Q 10.6.69 Q-Q 10.6.70 Q-Q 10.6.71 Q-Q
10.6.72 Q-Q 10.6.73 Q-Q 10.6.74 Q-Q 10.6.75 Q-Q 10.6.76 Q-Q
10.6.77 Q-Q 10.6.78 Q-Q 10.6.79 Q-Q 10.6.80 Q-Q 10.6.81 Q-Q
10.6.82 Q-Q 10.6.83 Q-Q 10.6.84 Q-Q 10.6.85 Q-Q 10.6.86 Q-Q
10.6.87 Q-Q 10.6.88 Q-Q 10.6.89 Q-Q 10.6.90 Q-Q 10.6.91 Q-Q
10.6.92 Q-Q 10.6.93 Q-Q 10.6.94 Q-Q 10.6.95 Q-Q 10.6.96 Q-Q
10.6.97 Q-Q 10.7.1 N/A 10.7.2 N/A 10.8.1 N/A 10.9.1 N/A
10.10.1 N/A 10.11.1 Q-Q 10.11.2 N/A 10.12.1 N/A 10.12.2 N/A
10.13.1 Q-Q 10.13.2 Q-Q 10.13.3 Q-Q 10.13.4 Q-Q 10.13.5 Q-Q
10.14.1 Q-Q 10.14.2 Q-Q 10.14.3 Q-Q 10.14.4 Q-Q 10.14.5 Q-Q
10.14.6 Q-Q 10.14.7 Q-Q 10.14.8 Q-Q 10.14.9 Q-Q 10.14.10 Q-Q
10.14.11 Q-Q 10.14.12 Q-Q 10.14.13 Q-Q 10.14.14 Q-Q 10.14.15 Q-Q
10.14.16 Q-Q 10.14.17 Q-Q 10.14.18 Q-Q 10.14.19 Q-Q 10.14.20 Q-Q
10.14.21 Q-Q 10.14.22 Q-Q 10.14.23 Q-Q 10.14.24 Q-Q 10.14.25 Q-Q
10.14.26 Q-Q 10.14.27 Q-Q 10.15.1 N/A 10.15.2 N/A 10.15.3 Q-Q
10.15.4 Q-Q 10.16.1 N/A 10.17.1 Q-Q 10.17.2 Q-Q 10.17.3 Q-Q
10.17.4 Q-Q 10.18.1 N/A 10.19.1 Q-Q 10.19.2 N/A 10.19.3 N/A
10.19.4 N/A 10.19.5 N/A 10.19.6 Q-Q 10.19.7 Q-Q 10.19.8 Q-Q
10.19.9 N/A 10.19.10 Q-Q 10.19.11 Q-Q 10.19.12 Q-Q 10.19.13 N/A
10.19.14 Q-Q 10.19.15 Q-Q 10.19.16 Q-Q 10.19.17 N/A 10.19.18 Q-Q
10.19.19 Q-Q 10.19.20 Q-Q 10.19.21 Q-Q 10.19.22 Q-Q 10.19.23 Q-Q
10.19.24 Q-Q 10.19.25 Q-Q 10.19.26 N/A 10.19.27 N/A 10.19.28 N/A
10.19.29 N/A 10.19.30 N/A 10.19.31 N/A 10.19.32 N/A 10.19.33 N/A
10.19.34 N/A 10.19.35 N/A 10.19.36 N/A 10.19.37 N/A 10.19.38 N/A
10.19.39 N/A 10.19.40 N/A 10.19.41 N/A 10.19.42 N/A 10.19.43 N/A
10.19.44 N/A 10.19.45 N/A 10.19.46 N/A 10.19.47 Q-Q 10.19.48 Q-Q
10.19.49 Q-Q 10.19.50 Q-Q 10.19.51 Q-Q 10.19.52 N/A 10.19.53 N/A
10.19.54 Q-Q 10.19.55 N/A 10.19.56 Q-Q 10.19.57 Q-Q 10.19.58 N/A
10.19.59 N/A 10.19.60 N/A 10.19.61 N/A 10.19.62 N/A 10.19.63 N/A
10.19.64 N/A 10.19.65 N/A 10.19.66 Q-Q 10.19.67 N/A 10.19.68 N/A
10.19.69 Q-Q 10.19.70 N/A 10.19.71 N/A 10.19.72 N/A 10.19.73 N/A
10.19.74 N/A 10.19.75 N/A 10.19.76 N/A 10.19.77 N/A 10.19.78 N/A
10.19.79 N/A 10.19.80 N/A 10.19.81 N/A 10.19.82 N/A 10.19.83 N/A
10.19.84 N/A 10.19.85 N/A 10.19.86 N/A 10.19.87 N/A 10.19.88 N/A
10.19.89 N/A 10.19.90 N/A 10.19.91 N/A 10.19.92 N/A 10.19.93 N/A
10.19.94 N/A 10.19.95 N/A 10.19.96 N/A 10.19.97 N/A 10.19.98 N/A
10.19.99 N/A 10.19.100 N/A 10.19.101 N/A 10.19.102 N/A 10.19.103 N/A
10.20.1 N/A 10.20.2 Q-Q 10.20.3 Q-Q 10.20.4 Q-Q 10.20.5 Q-Q
10.20.6 Q-Q 10.20.7 Q-Q 10.20.8 Q-Q 10.20.9 N/A 10.20.10 N/A
10.20.11 N/A 10.20.12 N/A 10.20.13 N/A 10.20.14 N/A 10.20.15 Q-Q
10.20.16 Q-Q 10.20.17 Q-Q 10.20.18 Q-Q 10.20.19 Q-Q 10.20.20 Q-Q
10.20.21 Q-Q 10.20.22 Q-Q 10.20.23 Q-Q 10.20.24 Q-Q 10.20.25 Q-Q
10.20.26 Q-Q 10.21.1 N/A 10.22.1 Q-Q 10.22.2 Q-Q 10.22.3 Q-Q
10.22.4 Q-Q 10.22.5 Q-Q 10.22.6 Q-Q 10.22.7 Q-Q 10.22.8 Q-Q
10.22.9 Q-Q 10.22.10 Q-Q 10.22.11 Q-Q 10.22.12 Q-Q 10.22.13 Q-Q
10.22.14 Q-Q 10.22.15 Q-Q 10.22.16 Q-Q 10.22.17 Q-Q 10.22.18 Q-Q
10.22.19 Q-Q 10.22.20 Q-Q 10.22.21 Q-Q 10.22.22 Q-Q 10.22.23 Q-Q
10.22.24 Q-Q 10.22.25 Q-Q 10.22.26 Q-Q 10.22.27 Q-Q 10.23.1 Q-Q
10.24.1 Q-Q 10.24.2 Q-Q 10.25.1 N/A 10.25.2 N/A 10.25.3 N/A
10.25.4 N/A 10.25.5 Q-Q 10.25.6 Q-Q 10.25.7 Q-Q 10.25.8 Q-Q
10.25.9 N/A 10.25.10 N/A 10.25.11 Q-Q 10.25.12 Q-Q 10.25.13 Q-Q
10.25.14 Q-Q 10.25.15 Q-Q 10.25.16 Q-Q 10.25.17 Q-Q 10.25.18 Q-Q
10.25.19 Q-Q 10.25.20 Q-Q 10.25.21 Q-Q 10.25.22 Q-Q 10.25.23 Q-Q
10.25.24 Q-Q 10.25.25 Q-Q 10.25.26 Q-Q 10.25.27 Q-Q 10.25.28 Q-Q
10.25.29 Q-Q 10.25.30 Q-Q 10.25.31 Q-Q 10.25.32 Q-Q 10.25.33 Q-Q
10.25.34 Q-Q 10.25.35 Q-Q 10.25.36 Q-Q 10.25.37 Q-Q 10.25.38 Q-Q
10.25.39 Q-Q 10.25.40 Q-Q 10.25.41 Q-Q 10.25.42 Q-Q 10.25.43 Q-Q
10.25.44 Q-Q 10.25.45 Q-Q 10.25.46 Q-Q 10.25.47 Q-Q 10.25.48 Q-Q
10.25.49 Q-Q 10.25.50 Q-Q 10.25.51 Q-Q 10.25.52 Q-Q 10.25.53 Q-Q
10.25.54 Q-Q 10.25.55 N/A 10.25.56 Q-Q 10.25.57 Q-Q 10.25.58 Q-Q
10.25.59 Q-Q 10.25.60 Q-Q 10.25.61 Q-Q 10.25.62 Q-Q 10.25.63 Q-Q
10.25.64 Q-Q 10.25.65 Q-Q 10.25.66 Q-Q 10.25.67 Q-Q 10.25.68 Q-Q
10.25.69 Q-Q 10.25.70 Q-Q 10.25.71 Q-Q 10.25.72 Q-Q 10.25.73 Q-Q
10.25.74 Q-Q 10.25.75 Q-Q 10.25.76 Q-Q 10.25.77 Q-Q 10.25.78 Q-Q
10.25.79 Q-Q 10.25.80 Q-Q 10.25.81 Q-Q 10.25.82 Q-Q 10.25.83 Q-Q
10.25.84 Q-Q 10.25.85 Q-Q 10.25.86 Q-Q 10.25.87 Q-Q 10.25.88 Q-Q
10.25.89 Q-Q 10.25.90 Q-Q 10.25.91 Q-Q 10.25.92 Q-Q 10.25.93 Q-Q
10.25.94 Q-Q 10.25.95 Q-Q 10.25.96 Q-Q 10.25.97 Q-Q 10.25.98 Q-Q
10.25.99 Q-Q 10.25.100 Q-Q 10.25.101 Q-Q 10.25.102 Q-Q 10.25.103 Q-Q
10.25.104 Q-Q 10.25.105 Q-Q 10.25.106 Q-Q 10.25.107 Q-Q 10.25.108 Q-Q
10.25.109 Q-Q 10.25.110 Q-Q 10.25.111 Q-Q 10.25.112 Q-Q 10.25.113 Q-Q
10.25.114 Q-Q 10.25.115 Q-Q 10.25.116 Q-Q 10.25.117 Q-Q 10.25.118 Q-Q
10.25.119 Q-Q 10.25.120 Q-Q 10.25.121 Q-Q 10.25.122 Q-Q 10.25.123 Q-Q
10.25.124 Q-Q 10.25.125 Q-Q 10.25.126 Q-Q 10.25.127 Q-Q 10.25.128 Q-Q
10.25.129 Q-Q 10.25.130 Q-Q 10.25.131 Q-Q 10.25.132 Q-Q 10.25.133 Q-Q
10.25.134 Q-Q 10.25.135 Q-Q 10.25.136 Q-Q 10.25.137 Q-Q 10.25.138 Q-Q
10.25.139 Q-Q 10.25.140 Q-Q 10.25.141 Q-Q 10.25.142 Q-Q 10.25.143 Q-Q
10.25.144 Q-Q 10.25.145 Q-Q 10.25.146 Q-Q 10.25.147 Q-Q 10.26.1 N/A
10.26.2 Q-Q 10.26.3 N/A 10.26.4 Q-Q 10.26.5 Q-Q 10.26.6 N/A
10.26.7 Q-Q 10.26.8 N/A 10.26.9 N/A 10.26.10 Q-Q 10.26.11 Q-Q
10.26.12 N/A 10.26.13 Q-Q 10.26.14 Q-Q 10.26.15 N/A 10.26.16 N/A
10.26.17 Q-Q 10.26.18 Q-Q 10.26.19 N/A 10.26.20 N/A 10.26.21 Q-Q
10.26.22 N/A 10.26.23 Q-Q 10.26.24 Q-Q 10.26.25 Q-Q 10.26.26 Q-Q
10.26.27 N/A 10.26.28 Q-Q 10.26.29 Q-Q 10.26.30 Q-Q 10.26.31 Q-Q
10.26.32 Q-Q 10.26.33 N/A 10.26.34 N/A 10.26.35 N/A 10.26.36 Q-Q
10.26.37 Q-Q 10.26.38 N/A 10.26.39 Q-Q 10.26.40 Q-Q 10.26.41 N/A
10.26.42 Q-Q 10.26.43 Q-Q 10.26.44 Q-Q 10.26.45 Q-Q 10.26.46 N/A
10.26.47 N/A 10.26.48 N/A 10.26.49 N/A 10.26.50 N/A 10.26.51 N/A
10.26.52 N/A 10.26.53 N/A 10.26.54 N/A 10.26.55 N/A 10.26.56 N/A
10.26.57 N/A 10.26.58 N/A 10.26.59 N/A 10.26.60 N/A 10.26.61 N/A
10.26.62 N/A 10.26.63 Q-Q 10.26.64 Q-Q 10.26.65 N/A 10.26.66 N/A
10.26.67 Q-Q 10.26.68 Q-Q 10.26.69 Q-Q 10.26.70 Q-Q 10.26.71 Q-Q
10.26.72 Q-Q 10.26.73 N/A 10.26.74 Q-Q 10.26.75 N/A 10.26.76 N/A
10.26.77 N/A 10.26.78 N/A 10.26.79 N/A 10.26.80 N/A 10.26.81 N/A
10.26.82 N/A 10.26.83 N/A 10.26.84 N/A 10.26.85 N/A 10.26.86 N/A
10.26.87 N/A 10.26.88 N/A 10.26.89 N/A 10.26.90 N/A 10.26.91 N/A
10.26.92 N/A 10.26.93 N/A 10.26.94 N/A 10.26.95 N/A 10.26.96 N/A
10.26.97 N/A 10.26.98 N/A 10.26.99 N/A 10.26.100 N/A 10.26.101 N/A
10.26.102 N/A 10.26.103 N/A 10.26.104 N/A 10.26.105 N/A 10.26.106 Q-Q
10.26.107 Q-Q 10.26.108 Q-Q 10.26.109 Q-Q 10.26.110 Q-Q 10.26.111 Q-Q
10.26.112 Q-Q 10.26.113 Q-Q 10.26.114 Q-Q 10.26.115 Q-Q 10.26.116 Q-Q
10.26.117 Q-Q 10.26.118 Q-Q 10.26.119 Q-Q 10.26.120 Q-Q 10.26.121 Q-Q
10.26.122 N/A 10.26.123 Q-Q 10.26.124 Q-Q 10.26.125 Q-Q 10.26.126 Q-Q
10.26.127 Q-Q 10.26.128 Q-Q 10.26.129 Q-Q 10.26.130 Q-Q 10.26.131 Q-Q
10.26.132 Q-Q 10.26.133 Q-Q 10.26.134 Q-Q 10.26.135 Q-Q 10.26.136 Q-Q
10.26.137 Q-Q 10.26.138 Q-Q 10.26.139 Q-Q 10.26.140 Q-Q 10.26.141 Q-Q
10.26.142 Q-Q 10.26.143 Q-Q 10.26.144 Q-Q 10.26.145 Q-Q 10.26.146 Q-Q
10.26.147 Q-Q 10.26.148 Q-Q 10.26.149 Q-Q 10.26.150 Q-Q 10.26.151 Q-Q
10.26.152 Q-Q 10.26.153 Q-Q 10.26.154 Q-Q 10.27.1 Q-Q 10.28.1 N/A
10.29.1 N/A 10.29.2 N/A 10.29.3 N/A 10.29.4 N/A 10.29.5 N/A
10.30.1 N/A 10.31.1 Q-Q 10.32.1 Q-Q 10.33.1 N/A 10.34.1 Q-Q
10.34.2 N/A 10.34.3 N/A 10.34.4 N/A 10.34.5 Q-Q 10.34.6 N/A
10.34.7 N/A 10.34.8 Q-Q 10.34.9 Q-Q 10.34.10 Q-Q 10.34.11 Q-Q
10.34.12 Q-Q 10.34.13 Q-Q 10.34.14 Q-Q 10.34.15 Q-Q 10.34.16 Q-Q
10.34.17 Q-Q 10.34.18 Q-Q 10.34.19 Q-Q 10.34.20 Q-Q 10.34.21 Q-Q
10.34.22 Q-Q 10.34.23 Q-Q 10.34.24 Q-Q 10.34.25 Q-Q 10.34.26 Q-Q
10.34.27 Q-Q 10.34.28 N/A 10.34.29 N/A 10.34.30 N/A 10.34.31 N/A
10.34.32 N/A 10.34.33 Q-Q 10.34.34 N/A 10.34.35 N/A 10.34.36 N/A
10.34.37 N/A 10.34.38 N/A 10.34.39 N/A 10.34.40 N/A 10.34.41 N/A
10.34.42 N/A 10.34.43 N/A 10.34.44 N/A 10.34.45 N/A 10.35.1 Q-Q
10.35.2 Q-Q 10.35.3 Q-Q 10.35.4 N/A 10.35.5 Q-Q 10.35.6 Q-Q
10.35.7 N/A 10.35.8 N/A 10.35.9 Q-Q 10.35.10 Q-Q 10.35.11 Q-Q
10.36.1 N/A 10.37.1 N/A 10.37.2 N/A 10.37.3 N/A 10.37.4 N/A
10.37.5 Q-Q 10.37.6 N/A 10.37.7 N/A 10.37.8 N/A 10.37.9 N/A
10.37.10 N/A 10.37.11 N/A 10.37.12 N/A 10.37.13 N/A 10.37.14 N/A
10.37.15 N/A 10.37.16 N/A 10.37.17 N/A 10.37.18 N/A 10.38.1 N/A
10.38.2 N/A 10.38.3 N/A 10.38.4 N/A 10.38.5 N/A 10.39.1 Q-Q
10.39.2 Q-Q 10.39.3 Q-Q 10.39.4 Q-Q 10.39.5 Q-Q 10.39.6 Q-Q
10.39.7 Q-Q 10.39.8 Q-Q 10.39.9 Q-Q 10.39.10 Q-Q 10.39.11 Q-Q
10.39.12 Q-Q 10.39.13 Q-Q 10.39.14 Q-Q 10.39.15 Q-Q 10.39.16 Q-Q
10.39.17 Q-Q 10.40.1 N/A 10.40.2 N/A 10.40.3 N/A 10.41.1 N/A
10.42.1 N/A 10.43.1 Q-Q 10.43.2 Q-Q 10.43.3 Q-Q 10.44.1 Q-Q
10.45.1 Q-Q 10.46.1 Q-Q 10.46.2 N/A 10.46.3 N/A 10.46.4 N/A
10.46.5 N/A 10.46.6 N/A 10.46.7 Q-Q 10.47.1 N/A 10.48.1 N/A
10.49.1 Q-Q