Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
20 views
Programming Data Structures Obj
Uploaded by
Mariya Babu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Programming Data Structures Obj For Later
Download
Save
Save Programming Data Structures Obj For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
20 views
Programming Data Structures Obj
Uploaded by
Mariya Babu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Programming Data Structures Obj For Later
Carousel Previous
Carousel Next
Save
Save Programming Data Structures Obj For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 5
Search
Fullscreen
POSTAL Book Package Computer Science & IT Objective Practice Sets Programming and Data Structures Contents SI. Topic Page No. 1. Programming Methodology 2 2. Arrays a4 3. Stack 40 4. Queue. 54 5. Linked Lists 63 6. Trees 76 7. Hashing Techniques 97erie Re eee Programming Methodology Tras ‘Multiple Choice Questions & NAT Questions Consider the following function declaration Aint *) Which of the following is correct about the declaration? (@) fis a function which takes integer pointer as argument and returns integer. (b) fis a function which takes integer pointer as an argument and returns address of an integer. (6) fis apointer to a function which takes integer pointer as an argument and returns integer. (@) fis a pointer to a function which takes integer pointer as an argument and returns address of an integer. Find the output of the following program: main() { exter inti 20; pirntf("%d", i) (@) Linkererror —_(b) 20 (c) Compiler error (d) None of these Consider the following code? void main( ) {static int i= 5. it(--i) { main ( ) printf ("6d", } } How many zero’s are printed in the output? Which of the following is correct output for the program code given below? main() { void pr); pr (); pr ()) pr (); } void pr() { stalic int i= 1; printf (*%60", (65+ 1++)): } (@) 66,67,68 —(b) 66, 66, 66 (©) 67,6869 (d) None of these Which of the following are equivalent to the statement? int k= (F<< 3) + (>> 2) (@) int k= i+ 8 + 4 (b) intk=ie34jo (c) intk=ie 3+ j/2 (d) int k = i/8 + j* 4; Consider the following foo function and identity the return value of foo function. int fo0 (unsigned int 2) { intex= while (nl = 0) ( if(n& t)xse 1 n>> } return ¢; (a) It counts the total number of bits set in an unsigned integer. (b) It counts the number of bits which are zero, (c) Itcounts the number of occurrences of 01 (d) Itreturns the same value as ‘rMADE EASY 7. Consider the following code: 10 int (int a, int b) { if(b else if (b % 2 { 0) return 1 0) return (f(a, b/2) Ma, b/2)) else { } return (a+ fa, b/2) + fla, bI2)); The return value of (2, 10) is 8. Whatiis output of the following program? #include
# define R 10 # define C20 int main() { } @ (C) int(*P) [A] [Ch printi("%6d'", size of (*P)) getchar( ) return 0; 4 (b) 8 2 (d) None of these 9. Match List-I with List-II 1. 2. 3. Co (@) (b) 2 () 2 () List-1 typedet int (« ptt) (); ptr p; int (* P) [4]; int * Pi4l; List-II Pointer to an array of integer WW. Pointer to a function returning an integer Array of pointers, pointing to integer des: A vaeoe 2023 Programming & Data Structures Objective Practice Sets Consider the folowing pseudocode program inti main () ( i=3 si) RO) } void § () ( print i // prints the value of i on the current line of output print ** // prints a blank space on the current line of output } void F() { inti in2 s0) } What is the output of the program if the pseudocode uses either static (exical) scoping or dynamic scoping? Static Scoping Dynamic Scoping (a) 32 32 (b) 33 22 © 33 23 @ 33 32 Consider the following code: inta=32,b=2,¢ ‘Switch (X), { Case 2: printi("%d", a); Case 4: printf(“%a", b); Case 6: break: Case 8: printi(“%a", ); default: print(“%a", B); } Find the missing statement X, if the above 'C’ code prints the output as 32, (@ bee (0) bee-2 (9) beor2 (a) None of these18 Computer Science & Information Technology EXEEESY Programming Methodology 1 10. 19. 28. 37. 45. 54. 63. 72. 81. 89, 98. 6 2 @ 3 @ 4 @ & @ 14. @ 12 @ 13% @ 14. (@) 20. (21) 21. @) 22. @ 23. (@) 29. (@) 30. (@) 31. (b) 32. (@) 38. (0) 39. (60) 40. (115) 41. (2) 46. (c) 47, (@) 48. (b) 49. (@) 55. (c) 56. (d) 57. (65) 58. (2) 64. (c) 65. (166) 66. (c) 67. (61) 73. (23) 74. (c) 75. (61) 76. () 82. (60) 83. (c) 84. (656) 85. (@) 90. (106) 91. (a) 92. (17) 93, (abc) 99. (a,c) 100. (b) Programming Methodology + (b) The correct declaration for (a) is int f(int ») The correct declaration for (b) is int* flint“); The correct declaration for (c) is int (+f) {int =) The correct declaration for (d) is int «(+f) (int +) (a) Linker error: Undefined symbol-7 Extern int i; Specifies to the compiler that the memory for iis allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name ‘7’ is available in any other program with memory space allocaled for it, Hence linker error occurred, 4) The variable ‘i is declared as static, hence memory for ‘’ willbe allocated for only once, as it encounters the statement. The function main) will be called recursively unless i becomes equal to zero and since main ( is recursively called, so the value of static i, i@. 0 will be printed every time the controls retumed. So total 4 times zero is printed 2023 MADE EASY @ 6 (@ 7. (1024 8 @ 9 tb) (©) 15.) 16 @) 17. &) 18. @ (240) 24. (9) 25. ©) 26. ©) 27. (©) (2) 33. (114) 84.) 85. 60) 36. (10) (43211234) 42, (c) 43. (a) 44. (0) () 50. (©) 51. (©) 52 (©) 53. (b) (13) 59. (@) 60. (40) 61.) 62. (@) (6) 68. (290) 69. (1365) 70. (10) 71. (@) (@) 77. (0) 78. (15) 79. (0) 80. (300) (@) 86. (>) 87. (@) 88. (302011) (b) 94 (0) 95. (@) 96. (b) 97. id) - (d) The correct output is “BCD" when the function pr () is first called the value of i is initialized to 1 After the pr () completes its execution i = 2 is retained for its next call as "i is static variable, 65 +1 = 66(B) 65 +2 = 67(C) 65 + 8 = 68(0) BCDis the correct output - (a) << and >> are bit wise operators used to multiply and divide by power of 2 respectively (shitt operators) jcc3ie8 jr>2aji4 . (a) It counts the number of bits set in an unsigned imeger. while (nl = 0) { if (n&1) x4 [* performs bit wise AND operator and it conaiition is satisfied if result contains aileast one 1MADE EASY 023 er oiicctvepractcesers | 19 nosat 12. (c) } Return statement can contain an expression. "r++; Maintains the count for number of 1s 13. @) n>>=1 Shift the ‘bit number by 1 bitto right 7. (1024) ifs AQ ic 2, 10) returns 2"° value = 1024 maint) f Prints: 3 main) 2,10) i=3; m4 —A_ AO BO “4 2.8) * 12,5) ay 1 wg Peat: | 80 ZN o 2+ 2,2) 2,2) a0 Output printed by the code: 3,3 Weta |=2 +2 ZN_ 14. (e) Beted x Only constants or enurns can be used with cases of switch. 2+4 is a const expression, 8 (a) 15. (a) int (+) [F] [C] = pointer to an array of array of Let string gate be stored from memory location integer. 1000, Output: 10 * 20 * size of (int) which is 800 for compliers with integer size as 4 bytes and 400 for cheratray wy ; - rs 8 So) ll characer compilers with integer size as 2 bytes. bier] Tam Ton sao Tom "Frost ond The pointer pis de-referenced, hence it yields type ofthe object. In the present case, itis an array of Given loop prints string from A[0] to ALS}, be array of integers. ‘gate’ So, it prints R* C* sizeof in) 16. (6) ow Size of () retums length of sting including null character (\*). While strlen () returns length of string A: retum type is int. It is a pointer to a function. , . without including nll character. B: (* P} declares pointer. (* P) [4] is array pointed So hore oulputis X= 9, Y=8. by pointer C:* P[4] declares array of pointers. 17. (b) 10. (@) Aer Executon Using static scoping: First print prints the global elelelta iwhose value is 3. Second print prints the global 5 | 6 iwhose value is 3. 5 | 6 | S| — Using dynamic scoping: First print prints the 20 | 6 | &a | & global i whose value is 3. Second print prints the 20 | 20 | &a | & local i whose value is 2 (from the function it was 20 | 20 | & | & called). 20 | 30 | &b | &p 41. (ce) Xibeox2is® Case 8: prints 3 then default case prints 2 Output prints 32.
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6125)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (932)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8214)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2922)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4972)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Tóibín
3.5/5 (2061)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1987)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2641)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2530)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
Outlier Detection
PDF
No ratings yet
Outlier Detection
30 pages
OSLAB2
PDF
No ratings yet
OSLAB2
8 pages
os-n190750-LAB 511111
PDF
No ratings yet
os-n190750-LAB 511111
11 pages
Os Lab - 6
PDF
No ratings yet
Os Lab - 6
5 pages
Os Lab - 5
PDF
No ratings yet
Os Lab - 5
5 pages
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Principles: Life and Work
From Everand
Principles: Life and Work
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Steve Jobs
From Everand
Steve Jobs
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Yes Please
From Everand
Yes Please
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
The Outsider: A Novel
From Everand
The Outsider: A Novel
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
John Adams
From Everand
John Adams
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
Outlier Detection
PDF
Outlier Detection
OSLAB2
PDF
OSLAB2
os-n190750-LAB 511111
PDF
os-n190750-LAB 511111
Os Lab - 6
PDF
Os Lab - 6
Os Lab - 5
PDF
Os Lab - 5
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
Little Women
From Everand
Little Women
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel