├── .github
└── ISSUE_TEMPLATE
│ ├── custom.md
│ └── new-issue-template.md
├── .gitignore
├── .idea
├── $CACHE_FILE$
├── codeStyles
│ └── Project.xml
└── misc.xml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
└── images
└── interview.png
/.github/ISSUE_TEMPLATE/custom.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Custom issue template
3 | about: Describe this issue template's purpose here.
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/new-issue-template.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: New Issue template
3 | about: Describe this issue template's purpose here.
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.aar
4 | *.ap_
5 | *.aab
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 | # Uncomment the following line in case you need and you don't have the release build type files in your app
18 | # release/
19 |
20 | # Gradle files
21 | .gradle/
22 | build/
23 |
24 | # Local configuration file (sdk path, etc)
25 | local.properties
26 |
27 | # Proguard folder generated by Eclipse
28 | proguard/
29 |
30 | # Log Files
31 | *.log
32 |
33 | # Android Studio Navigation editor temp files
34 | .navigation/
35 |
36 | # Android Studio captures folder
37 | captures/
38 |
39 | # IntelliJ
40 | *.iml
41 | .idea/workspace.xml
42 | .idea/tasks.xml
43 | .idea/gradle.xml
44 | .idea/assetWizardSettings.xml
45 | .idea/dictionaries
46 | .idea/libraries
47 | # Android Studio 3 in .gitignore file.
48 | .idea/caches
49 | .idea/modules.xml
50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
51 | .idea/navEditor.xml
52 |
53 | # Keystore files
54 | # Uncomment the following lines if you do not want to check your keystore files in.
55 | #*.jks
56 | #*.keystore
57 |
58 | # External native build folder generated in Android Studio 2.2 and later
59 | .externalNativeBuild
60 | .cxx/
61 |
62 | # Google Services (e.g. APIs or Firebase)
63 | # google-services.json
64 |
65 | # Freeline
66 | freeline.py
67 | freeline/
68 | freeline_project_description.json
69 |
70 | # fastlane
71 | fastlane/report.xml
72 | fastlane/Preview.html
73 | fastlane/screenshots
74 | fastlane/test_output
75 | fastlane/readme.md
76 |
77 | # Version control
78 | vcs.xml
79 |
80 | # lint
81 | lint/intermediates/
82 | lint/generated/
83 | lint/outputs/
84 | lint/tmp/
85 | # lint/reports/
86 |
--------------------------------------------------------------------------------
/.idea/$CACHE_FILE$:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Android
10 |
11 |
12 | Chrome OSCorrectnessLintAndroid
13 |
14 |
15 | Code style issuesJava
16 |
17 |
18 | CorrectnessLintAndroid
19 |
20 |
21 | Declaration redundancyJava
22 |
23 |
24 | Java
25 |
26 |
27 | LintAndroid
28 |
29 |
30 | Probable bugsJava
31 |
32 |
33 |
34 |
35 | OptionalAssignedToNull
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at . All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ---------------------------------
2 | Contributors
3 | ---------------------------------
4 | * Niharika Arora
5 |
6 | * Abhijith Sreekar
7 |
8 | * Chintan Parmar
9 |
10 |
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android-Interview-Questions
2 |
3 | 
4 |
5 | A repository containing interview questions on DS, Java & Android based on my experiences.
6 |
7 | Note: I am not writing up the answers here for now as If I provide you the answers, what will you do? :-)
8 |
9 | Also, you will restrict yourself to those answers only. Try and learn more deeply abut the concepts. For any particular questions, You can ask anytime.
10 |
11 |
12 | ## DS
13 |
14 | 1) https://www.geeksforgeeks.org/find-minimum-element-in-a-sorted-and-rotated-array/
15 |
16 | 2) https://www.geeksforgeeks.org/largest-subarray-with-equal-number-of-0s-and-1s//
17 |
18 | 3) https://www.geeksforgeeks.org/find-triplets-array-whose-sum-equal-zero/
19 |
20 | 4) https://www.geeksforgeeks.org/level-order-traversal-in-spiral-form/
21 |
22 | 5) https://www.geeksforgeeks.org/construct-tree-from-given-inorder-and-preorder-traversal/
23 |
24 | 6) https://www.geeksforgeeks.org/write-an-efficient-c-function-to-convert-a-tree-into-its-mirror-tree/
25 |
26 | 7) https://www.geeksforgeeks.org/maximum-sum-such-that-no-two-elements-are-adjacent/
27 |
28 | 8) [https://www.geeksforgeeks.org/longest-common-subarray-in-the-given-two-arrays/?ref=leftbar-rightbar](https://www.geeksforgeeks.org/longest-common-subarray-in-the-given-two-arrays/?ref=leftbar-rightbar)
29 |
30 | 9) [https://www.geeksforgeeks.org/maximum-sum-path-across-two-arrays/](https://www.geeksforgeeks.org/maximum-sum-path-across-two-arrays/)
31 |
32 | 10) [https://www.geeksforgeeks.org/merge-two-sorted-arrays-o1-extra-space/](https://www.geeksforgeeks.org/merge-two-sorted-arrays-o1-extra-space/)
33 |
34 | 11) [https://www.geeksforgeeks.org/segregate-0s-and-1s-in-an-array-by-traversing-array-once/](https://www.geeksforgeeks.org/segregate-0s-and-1s-in-an-array-by-traversing-array-once/)
35 |
36 | 12) [https://www.geeksforgeeks.org/construction-of-longest-monotonically-increasing-subsequence-n-log-n/](https://www.geeksforgeeks.org/construction-of-longest-monotonically-increasing-subsequence-n-log-n/)
37 |
38 | 13) [https://www.geeksforgeeks.org/kth-smallestlargest-element-unsorted-array/](https://www.geeksforgeeks.org/kth-smallestlargest-element-unsorted-array/)
39 |
40 | 14) [https://www.geeksforgeeks.org/find-zeroes-to-be-flipped-so-that-number-of-consecutive-1s-is-maximized/](https://www.geeksforgeeks.org/find-zeroes-to-be-flipped-so-that-number-of-consecutive-1s-is-maximized/)
41 |
42 | 15) [https://www.geeksforgeeks.org/reverse-a-doubly-linked-list/](https://www.geeksforgeeks.org/reverse-a-doubly-linked-list/)
43 |
44 | 16) [https://www.geeksforgeeks.org/longest-common-increasing-subsequence-lcs-lis/](https://www.geeksforgeeks.org/longest-common-increasing-subsequence-lcs-lis/)
45 |
46 | 17) [https://www.geeksforgeeks.org/fix-two-swapped-nodes-of-bst/](https://www.geeksforgeeks.org/fix-two-swapped-nodes-of-bst/)
47 |
48 | 18) [https://www.geeksforgeeks.org/backttracking-set-2-rat-in-a-maze/](https://www.geeksforgeeks.org/backttracking-set-2-rat-in-a-maze/)
49 |
50 | 19) [https://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/](https://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/)
51 |
52 | 20) [https://www.geeksforgeeks.org/find-minimum-element-in-a-sorted-and-rotated-array/](https://www.geeksforgeeks.org/find-minimum-element-in-a-sorted-and-rotated-array/)
53 |
54 | 21) [https://www.geeksforgeeks.org/maximum-product-subarray/](https://www.geeksforgeeks.org/maximum-product-subarray/)
55 |
56 | 22) [https://www.geeksforgeeks.org/merge-k-sorted-arrays/](https://www.geeksforgeeks.org/merge-k-sorted-arrays/)
57 |
58 | 23) [https://www.geeksforgeeks.org/sort-an-array-of-0s-1s-and-2s/](https://www.geeksforgeeks.org/sort-an-array-of-0s-1s-and-2s/)
59 |
60 | 24) [https://www.geeksforgeeks.org/a-product-array-puzzle/](https://www.geeksforgeeks.org/a-product-array-puzzle/)
61 |
62 | 25) [https://www.geeksforgeeks.org/count-frequencies-elements-array-o1-extra-space-time/](https://www.geeksforgeeks.org/count-frequencies-elements-array-o1-extra-space-time/)
63 |
64 | 26) [https://www.geeksforgeeks.org/median-of-two-sorted-arrays-of-different-sizes/](https://www.geeksforgeeks.org/median-of-two-sorted-arrays-of-different-sizes/)
65 |
66 | 27) [https://www.geeksforgeeks.org/find-maximum-path-sum-in-a-binary-tree/](https://www.geeksforgeeks.org/find-maximum-path-sum-in-a-binary-tree/)
67 |
68 | 28) [https://www.geeksforgeeks.org/lowest-common-ancestor-in-a-binary-search-tree/](https://www.geeksforgeeks.org/lowest-common-ancestor-in-a-binary-search-tree/)
69 |
70 | 29) [https://www.geeksforgeeks.org/lowest-common-ancestor-binary-tree-set-1](https://www.geeksforgeeks.org/lowest-common-ancestor-binary-tree-set-1)
71 |
72 | 30) [https://www.geeksforgeeks.org/sorted-linked-list-to-balanced-bst/](https://www.geeksforgeeks.org/sorted-linked-list-to-balanced-bst/)
73 |
74 | 31) [https://www.geeksforgeeks.org/given-an-array-a-and-a-number-x-check-for-pair-in-a-with-sum-as-x/](https://www.geeksforgeeks.org/given-an-array-a-and-a-number-x-check-for-pair-in-a-with-sum-as-x/)
75 |
76 | 32) [https://www.educative.io/edpresso/how-to-find-the-most-frequent-word-in-an-array-of-strings](https://www.educative.io/edpresso/how-to-find-the-most-frequent-word-in-an-array-of-strings)
77 |
78 | 33) Continuation Question to `32`, What is the time complexity of your solution and how can you improve it?
79 |
80 | 34) What is the time complexity of mergeSort, quickSort and Binary search?
81 |
82 | 35) What is the time complexity for removing an element from LinkedList?
83 |
84 | ## Java
85 |
86 | * Interfaces vs Abstract Classes.Why Interfaces if abstract classes are already there.
87 |
88 | * JAVA 8 new features
89 |
90 | * Hashmap implementation,ArrayList implementation
91 |
92 | * How to make a class immutable.
93 |
94 | * String pools,intern keyword,new() keyword
95 |
96 | * Linked list vs Array,Array vs ArrayList,Set vs List vs Map,Iterator vs Enumeration.
97 |
98 | * How to compare two objects in Set?(hint : equals() and hashcode() overriding)
99 |
100 | * How ClickListener implemented in Java?
101 |
102 | * Programs based on Inheritance and multithreading. (Most Important)
103 |
104 | * 1.) Add(String string) 2.) Add (Object object), you called Add(null) what will be the output here?
105 |
106 | * Why main Static?
107 |
108 | * Static vs Singleton? Which to prefer when?
109 |
110 | * Can a static method be overloaded/overridden?Can a constructor be made static? Can we override/overload constructor? Which type of error you get-Compile/Runtime.
111 |
112 | * Can we have final/static/default methods in interface/abstract classes?
113 |
114 | * Check for every keyword? Which type of error-Compile time or runtime(I remember it after I tried a sample in Android studio).
115 |
116 | * Stack vs Heap allocation in Java.
117 |
118 | * Why is String immutable?
119 |
120 | * Why reflection in Java?Introspection vs Reflection?
121 |
122 | * Anonymous vs Inner Classes.Static Inner Classes. Can we have Static inner classes on Top?
123 |
124 | * What is the naming structure for an inner class in java?
125 |
126 | * Default value for Access specifiers,primitie types.
127 |
128 | * Protected vs Default. Do static retain value if an application is removed from recent.
129 |
130 | * How is the Exception class implemented in java?Try/Catch with finally block.
131 |
132 | * Any situation when finally won’t get executed?
133 |
134 | * Is Java pass by value/reference?
135 |
136 | * What will be the result if StringBuffer value compared with String — strbuf.equals(str) /str.equals(strbuf)
137 |
138 | * Synchronization in Java.
139 |
140 | * Can one interface extend/implement other/Can one abstract class extend other? Can interface extend abstract classes?
141 |
142 | * Runtime vs compile time polymorphism with real-world scenarios. How do you define encapsulation?
143 |
144 | * this vs super() keyword
145 |
146 | * Implement own Garbage collection in java.
147 |
148 | * Why runnable interface if we have already had Thread class in Java?
149 |
150 | * Why thread pool in Java?
151 |
152 | * Order of call of constructors during Inheritance.
153 |
154 | ## Kotlin
155 |
156 | * Why should we use Kotlin for Android Development?
157 |
158 | * Kotlin operators - apply, run, let, ?
159 |
160 | * How Kotlin is null-safe?
161 |
162 | * What is the difference between var and val?
163 |
164 | * How const is different from val?
165 |
166 | * What is the difference between ?. and !!
167 |
168 | * How to define static functions in Kotlin?
169 |
170 | * What are Data Classes in Kotlin?
171 |
172 | * What do you mean by Sealed classes in Kotlin?
173 |
174 | * Collections in Kotlin.
175 |
176 | * Difference between lateinit and lazy.
177 |
178 | * What is Kotlin synthetic binding?
179 |
180 | * Difference between Kotlin Synthetics, View binding and Butterknife?
181 |
182 | * What are extension functions in Kotlin?
183 |
184 | * What are lambda expressions?
185 |
186 | * What are Higher-Order functions in Kotlin?
187 |
188 | * Difference between let, run, with, also, apply in Kotlin.
189 |
190 | * What is the best way for performing tasks on a background thread in kotlin?
191 |
192 | * What are Coroutines in Kotlin?
193 |
194 | * What are the different Coroutines Scope?
195 |
196 | * Why use suspend function in Kotlin Coroutines?
197 |
198 | * Explain Coroutine LifecycleScope.
199 |
200 | * What is Kotlin Flow?
201 |
202 | * Kotlin Flow vs RxJava.
203 |
204 | * Room vs Realm? Why not Realm?
205 |
206 |
207 | ## Android
208 |
209 | (Also they ask for code not just theory things. Keep this in mind.)
210 |
211 | * Activity/Fragment/Broadcast/Application/Service Lifecycle (Explain with one line description)
212 |
213 | * Which lifecycle method gets called when A goes to B/come back to A? Activity Launch Modes with examples
214 |
215 | * Let’s say 4 activities are there A->B->C->D. How to launch A from D finishing in between activities?
216 |
217 | * 4 Activities are there A->B->C->D.How to finish application from D if none of the activities opened earlier finished till now?
218 |
219 | * How CLEAR_TOP flag intent works in android?
220 |
221 | * Service vs IntentService?When to prefer which type of service?
222 |
223 | * Explain ways for Activity to activity communication/Activity to fragment communication/Fragment to fragment communication.
224 |
225 | * How to make a service persist even after Application killed?
226 |
227 | * How to achieve Interprocess communication in android?
228 |
229 | * How Async task internally works? Async task implementation?
230 |
231 | * Cons of using Async task? How to overcome this limitation?
232 |
233 | * Why Job Scheduler?
234 |
235 | * Notification related changes in Oreo?
236 |
237 | * How to handle Background service and execution limits with new Oreo Updates?
238 |
239 | * Have you seen Google I/O 2018? What were the updates for Android there?
240 |
241 | * Why do we use Headless fragments?
242 |
243 | * Memory Leakage, Causes, and preventions in Android? I have written a blog out here.You can refer [this too](https://medium.com/@nik.arora8059/memory-management-in-android-3bdf307c8e23)
244 |
245 | * Ways to optimize an Android Application.
246 |
247 | * Proguard-Obfuscation/ Minification, Build Variants, Flavours.
248 |
249 | * How to achieve MultiThreading in Android?
250 |
251 | * Suppose you have 10 images to fetch from Server. What is the best way to fetch images? (Hint: Read about ThreadPool and Executor)
252 |
253 | * Builder vs Factory Pattern with an example
254 |
255 | * Why MVP not MVC? They will ask you to make a wireframe kind of thing on paper to demonstrate MVP pattern in android.
256 |
257 | * Why RXJAVA so popular nowadays?
258 |
259 | * Problems in RXJAVA? They can provide you with some scenarios to get to know if you can find out the problems with it.
260 |
261 | * Map vs Flat map? (Most commonly asked in RXJAVA)
262 |
263 | * Should we provide a context in presenter/Model? Answering yes/no is not enough. You have to provide a solution for it.
264 |
265 | * Why Schedulers and How Rxjava internally works with them? SusbcribeOn vs ObserveOn, Schedulers on which both of these work? .subscribe(new Subscriber…) vs .subscribe(new Observer…)
266 |
267 | * IOScheduler/new Thread Scheduler in RXJava
268 |
269 | * How dagger internally worksDagger vs Dagger2? Explain the purpose of every annotation taken in Dagger2.
270 |
271 | * How do you decide scope in Dagger? Why Qualifier annotation?
272 |
273 | * Why do we use Handlers? Do you know the Loopers? What’s the role of Message queue? With this, they will go for Main Thread working. They will also ask you about the exceptions we get as Looper.prepare() exceptions
274 |
275 | * Cause of Memory leak during the Async Task?
276 |
277 | * Explain Singleton pattern. Problems with it and Handling. (hint: Double checked locking/synchronization)
278 |
279 | * Why do you prefer Retrofit over Volley? Why Picasso? Now they will ask all the third party libraries you have used. Be honest with your answer. They may go deep in any of those.
280 |
281 | * Why ConstraintLayout?Barriers vs Guidelines, Why Group/Chains?
282 |
283 | * Why do we prefer Framelayout for Fragments?
284 |
285 | * Why ANR?How to prevent it?
286 |
287 | * Do async.execute make threads in parallel or serial?
288 |
289 | * How to make a custom view in android? Explain lifecycle methods. Difference between onLayout/onMeasure.
290 |
291 | * Have you ever faced any issue with SingleInstance launch mode or example if you have used it? Providing real-life examples are preferred more.
292 |
293 | * When 1 fragment added over another-Explain lifecycle methods. Another question would be if you replace instead of adding it. The 3rd question will be if you have back stack there.
294 |
295 | * Why fragment newInstance() is there (Best practice for instantiating a new Android Fragment)
296 |
297 | * Suppose you have to update location every minute even if you don’t get permission. But the tricky thing here is how will you notify the server-Through the same service you were sending updates using FusedLocationProvider/Will you use some other service or broadcast. Just design the whole thing.
298 |
299 | * Observable.just/Observable.from/Observable.create in RXJAVA?
300 |
301 | * Why Instant Apps? How do you achieve this?
302 |
303 | * How to load Large Bitmaps? Handle Memory leaks and Sample sizing
304 |
305 | * How parcelable internally works? Design it.
306 |
307 | * What happens if your serializable class contains a member which is not serializable? How to handle it?
308 |
309 | * Why do we use WeakReferences?
310 |
311 | * How to retain data on orientation change? Explain lifecycle during orientation changes.
312 |
313 | * How to make endless circular recyclerView?
314 |
315 | * Suppose you have given an array of array of custom Objects. Which data structure will you use to show these on UI?
316 |
317 | * How do you handle opening activity using notifications?
318 |
319 | * How to achieve Push notifications in android? Explain behavior during App in front/Background-How to handle both scenarios.
320 |
321 | * How to download files in parallel?
322 |
323 | * Why Realm?Realm Methods, Realm vs Sqlite.
324 |
325 | * How to handle different screen sizes/density/languages/orientation in android?
326 |
327 | * What the Fragment’s method setRetainInstance(boolean) does?
328 |
329 | * Keep yourself up to date with the latest library versions if using.
330 |
331 | * Why is there a need for JobIntentService?(hint:: Oreo update)
332 |
333 | * Basics for Testing in Android-They will ask some questions about Espresso,mockito,roboelectric(not in that deep).Stub vs mock. Also if you are following MVP pattern. Be prepared for the questions now.
334 |
335 | * How the OS handles process flow. When is the app killed or removed from recent memory? How OS decides this.
336 |
337 | * Which method gets called when home button pressed, back pressed etc.(Most commonly asked)
338 |
339 | * Manifest related attributes -allowBackup,intent-filters,process,taskAffinity,permission vs uses-permission etc.
340 |
341 | * Draw a simple basic design you follow to make an android application(folder structure, methods, variables)
342 |
343 | * Why services preferred over Broadcast receiver for background applications
344 |
345 | * Broadcast-related changes in Oreo and Handling them.
346 |
347 | * Accessibility services in android. How do you handle system apps(I mentioned this work too, so asked)
348 |
349 | * Thread.start() vs run method,submit vs Execute ,callable vs runnable
350 |
351 | * View Holder pattern.ListView vs RecyclerView.
352 |
353 | * Remote Views and How to use them?
354 |
355 | * Inner Classes vs Static Classes?
356 |
357 | * Volatile vs Transient
358 |
359 | * Internal Implementation of Picasso, Glide
360 |
361 | * Internal implementation of Recyclerview
362 |
363 | * Design Patterns and Practical Usage
364 |
365 | * Custom View and Lifecycle
366 |
367 | * Singleton vs Static and why we use them?
368 |
369 | * Deep vs Dynamic Linking
370 |
371 | * Livedata postValue vs set
372 |
373 | * Livedata vs ObservableField
374 |
375 | * ViewModelFactory
376 |
377 | * HashCode and Equals Implementation
378 |
379 | * Dagger - Component vs SubComponenets
380 |
381 | * TDD and frameworks - if using , tell the challenges faced
382 |
383 | * GSON vs Jackson vs Moshi
384 |
385 | * MultiModule Benfeits
386 |
387 | * Android Bundle - and Dynamic Feature usage
388 |
389 | * Proguard vs R8
390 |
391 | * What is Scoped Storage and how to implement?
392 |
393 | * Observable vs Completable vs Single
394 |
395 | * Rx vs Coroutines. Which one you prefer and when?
396 |
397 | * Difference between MVP and MVVM?
398 |
399 | * Explain SOLID principles?
400 |
401 | * Difference between const and val
402 |
403 | * When is onPause() called without onStop() being called?
404 |
405 | * Dagger vs Koin?
406 |
407 | * Any 5 RxJava operatrs. How subscribeOn and observeOn works?
408 |
409 | * Headless Fragments.
410 |
411 | * Workmanager, type of requests, methods, minimum interval before a job repeat itself.
412 |
413 | * Workmanager vs JobScheduler.
414 |
415 | * Why ConstraintLayout? Tell some properties which I find worth.
416 |
417 | * How SharedPreferences work internally?
418 |
419 |
420 | >You will be given assignments as your first/last round. They just want to know how you follow the standards. Some ask for UI thing, other ask for architectural patterns. Just check your methods and play well with the logic.That’s all.
421 |
422 | ## System Design
423 |
424 | * Design Whatsapp/Chat application/Facebook messenger.
425 |
426 | * Implement search functionality with debounce operator (If user keeps on typing, then cancel the last network call and hit for the present one, How will you achieve that?)
427 |
428 | * Design a Location Tracking application
429 |
430 | * Design Uber/Ola.
431 |
432 | * Design Twitter.
433 |
434 | * Design Bookmyshow.
435 |
436 | ### That’s all Guys. The moment I come out of the interview room, I always note down the questions on Google Keep. Blogs & Github links helped me so much in cracking these interviews. See Now I can help others too -:)
437 |
438 | If you learn about the concepts for the above questions, I am sure you will get your basics strong and with the strong basics, you can easily crack any interview.
439 |
440 | I have written an [article](https://blog.usejournal.com/interview-questions-for-android-java-ds-f5081cb3aa09) on the same.
441 |
442 | If you have more questions, I will be happy to learn, add & share. Please raise a [PR](https://github.com/niharika2810/android-interview-questions/compare) and contribute. :-)
443 |
444 |
445 |
446 |
447 |
--------------------------------------------------------------------------------
/images/interview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niharika2810/android-interview-questions/aba449d373b3f95f42d9204e12013166545483c0/images/interview.png
--------------------------------------------------------------------------------