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)
28 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)
28 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
Coding Interview Questions For Round 1
PDF
No ratings yet
Coding Interview Questions For Round 1
246 pages
Commvault 2013 PSG
PDF
No ratings yet
Commvault 2013 PSG
9 pages
Samsung Interview Exp
PDF
No ratings yet
Samsung Interview Exp
18 pages
CDS Q6
PDF
No ratings yet
CDS Q6
12 pages
CDS Q8
PDF
No ratings yet
CDS Q8
9 pages
C Language and DS Main
PDF
No ratings yet
C Language and DS Main
62 pages
C Programming - APS106 - Mid - 2005
PDF
No ratings yet
C Programming - APS106 - Mid - 2005
6 pages
Puzzels On C
PDF
No ratings yet
Puzzels On C
14 pages
Int Int Int Int: Main P P Malloc P
PDF
No ratings yet
Int Int Int Int: Main P P Malloc P
11 pages
C C++
PDF
100% (1)
C C++
93 pages
C Test Paper 1
PDF
No ratings yet
C Test Paper 1
35 pages
C, C++ Questions
PDF
No ratings yet
C, C++ Questions
78 pages
Solution 2
PDF
No ratings yet
Solution 2
8 pages
FAQ's of C Programming
PDF
No ratings yet
FAQ's of C Programming
42 pages
Cse (MCQ)
PDF
No ratings yet
Cse (MCQ)
83 pages
Quiz III Solutions
PDF
No ratings yet
Quiz III Solutions
7 pages
Class 1
PDF
100% (1)
Class 1
53 pages
C_Exam
PDF
No ratings yet
C_Exam
12 pages
C Aptitude Questions and Answers With Explanation - 1
PDF
No ratings yet
C Aptitude Questions and Answers With Explanation - 1
20 pages
PPS PYQS
PDF
No ratings yet
PPS PYQS
10 pages
C, C++ Questions
PDF
No ratings yet
C, C++ Questions
39 pages
Tcs Questions With Answers: Note To The Students
PDF
No ratings yet
Tcs Questions With Answers: Note To The Students
55 pages
C Programming Questions
PDF
No ratings yet
C Programming Questions
92 pages
C Programming Questions and Answers
PDF
100% (1)
C Programming Questions and Answers
28 pages
SET B ALL TEST PROGRAM HITBULLS
PDF
No ratings yet
SET B ALL TEST PROGRAM HITBULLS
37 pages
C Questions and Answers
PDF
No ratings yet
C Questions and Answers
76 pages
Try To Solve
PDF
No ratings yet
Try To Solve
96 pages
C Notes
PDF
No ratings yet
C Notes
241 pages
Dsa Q14
PDF
No ratings yet
Dsa Q14
4 pages
Psudeo With Explainations2
PDF
100% (1)
Psudeo With Explainations2
33 pages
qustion_answer_in_c(2024)
PDF
No ratings yet
qustion_answer_in_c(2024)
16 pages
CDS S5
PDF
No ratings yet
CDS S5
6 pages
C Language Bits
PDF
100% (1)
C Language Bits
6 pages
Predict The Output or Error(s) For The Following:: C Aptitude Test Question & Answers
PDF
No ratings yet
Predict The Output or Error(s) For The Following:: C Aptitude Test Question & Answers
8 pages
Book Chapter 3 Programming With C
PDF
No ratings yet
Book Chapter 3 Programming With C
36 pages
LG Placemnt Papers
PDF
No ratings yet
LG Placemnt Papers
174 pages
MCQs
PDF
No ratings yet
MCQs
11 pages
C Programme 123 PDF
PDF
No ratings yet
C Programme 123 PDF
6 pages
C
PDF
No ratings yet
C
22 pages
Midterm 2
PDF
No ratings yet
Midterm 2
8 pages
QUIZ
PDF
No ratings yet
QUIZ
5 pages
Int Int Float: / Some Code
PDF
No ratings yet
Int Int Float: / Some Code
123 pages
All Placement Papers/technical Questions in
PDF
No ratings yet
All Placement Papers/technical Questions in
59 pages
C Interview Question and Answers
PDF
No ratings yet
C Interview Question and Answers
19 pages
C Is An Attitude
PDF
0% (1)
C Is An Attitude
42 pages
C Programming Practice Problems
PDF
No ratings yet
C Programming Practice Problems
26 pages
Midterm Exam Key
PDF
No ratings yet
Midterm Exam Key
8 pages
C Test
PDF
No ratings yet
C Test
17 pages
C Interview Questions
PDF
No ratings yet
C Interview Questions
9 pages
UNIT 5 MCQs
PDF
No ratings yet
UNIT 5 MCQs
12 pages
Practice 03 C Programming Constructs
PDF
No ratings yet
Practice 03 C Programming Constructs
20 pages
Pointers in C-Que Set
PDF
No ratings yet
Pointers in C-Que Set
7 pages
MCQ PPL
PDF
No ratings yet
MCQ PPL
17 pages
MCQ PPL
PDF
100% (2)
MCQ PPL
17 pages
CDS Q5
PDF
No ratings yet
CDS Q5
4 pages
Technical-C-Latest-18 May 2012
PDF
No ratings yet
Technical-C-Latest-18 May 2012
75 pages
ENGG1340-COMP2113-exam (2019-2020)
PDF
No ratings yet
ENGG1340-COMP2113-exam (2019-2020)
14 pages
C-Interview Questions - update 2
PDF
No ratings yet
C-Interview Questions - update 2
56 pages
Outlier Detection
PDF
No ratings yet
Outlier Detection
30 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
OSLAB2
PDF
No ratings yet
OSLAB2
8 pages
Os Lab - 5
PDF
No ratings yet
Os Lab - 5
5 pages