Answer: No
As we have 2 == operators, so they are executed from left to right.
a == b == c
⇒ (a == b) == c
⇒ (10 == 10) == 10
⇒ true == 10
⇒ 1 == 10
⇒ false
Why is true converted to 1?
The rule for == says if one of the operands is boolean, it's converted to number before the comparison.
true is converted to its number value, which is 1.
As we have 2 == operators, so they are executed from left to right.
a == b == c
⇒ (a == b) == c
⇒ (10 == 10) == 10
⇒ true == 10
⇒ 1 == 10
⇒ false
Why is true converted to 1?
The rule for == says if one of the operands is boolean, it's converted to number before the comparison.
true is converted to its number value, which is 1.
Dear Community,
It's become challenging to balance content creation alongside my full-time job and creation of app that will give you any course for free - I am working on that after work for previous 8 months).
This is why I've assembled a team (15 people atm) to help. They're compensated from my own pocket, so I decided to occasionally post some ads to at least reduce the costs of maintaining our community a little bit.
Rest assured, any ads will be clearly labeled, and I'll give my best to filter out any scams.
Thank you for your support and understanding!
For any questions feel free to contact me directly at @mldatascientist
Warm regards,
Big Data specialist
It's become challenging to balance content creation alongside my full-time job and creation of app that will give you any course for free - I am working on that after work for previous 8 months).
This is why I've assembled a team (15 people atm) to help. They're compensated from my own pocket, so I decided to occasionally post some ads to at least reduce the costs of maintaining our community a little bit.
Rest assured, any ads will be clearly labeled, and I'll give my best to filter out any scams.
Thank you for your support and understanding!
For any questions feel free to contact me directly at @mldatascientist
Warm regards,
Big Data specialist
18 Most common used Java List methods
1. add(E element) - Adds the specified element to the end of the list.
2. addAll(Collection<? extends E> c) - Adds all elements of the specified collection to the end of the list.
3. remove(Object o) - Removes the first occurrence of the specified element from the list.
4. remove(int index) - Removes the element at the specified position in the list.
5. get(int index) - Returns the element at the specified position in the list.
6. set(int index, E element) - Replaces the element at the specified position in the list with the specified element.
7. indexOf(Object o) - Returns the index of the first occurrence of the specified element in the list.
8. contains(Object o) - Returns true if the list contains the specified element.
9. size() - Returns the number of elements in the list.
10. isEmpty() - Returns true if the list contains no elements.
11. clear() - Removes all elements from the list.
12. toArray() - Returns an array containing all the elements in the list.
13. subList(int fromIndex, int toIndex) - Returns a view of the portion of the list between the specified fromIndex, inclusive, and toIndex, exclusive.
14. addAll(int index, Collection<? extends E> c) - Inserts all elements of the specified collection into the list, starting at the specified position.
15. iterator() - Returns an iterator over the elements in the list.
16. sort(Comparator<? super E> c) - Sorts the elements of the list according to the specified comparator.
17. replaceAll(UnaryOperator<E> operator) - Replaces each element of the list with the result of applying the given operator.
18. forEach(Consumer<? super E> action) - Performs the given action for each element of the list until all elements have been processed or the action throws an exception.
1. add(E element) - Adds the specified element to the end of the list.
2. addAll(Collection<? extends E> c) - Adds all elements of the specified collection to the end of the list.
3. remove(Object o) - Removes the first occurrence of the specified element from the list.
4. remove(int index) - Removes the element at the specified position in the list.
5. get(int index) - Returns the element at the specified position in the list.
6. set(int index, E element) - Replaces the element at the specified position in the list with the specified element.
7. indexOf(Object o) - Returns the index of the first occurrence of the specified element in the list.
8. contains(Object o) - Returns true if the list contains the specified element.
9. size() - Returns the number of elements in the list.
10. isEmpty() - Returns true if the list contains no elements.
11. clear() - Removes all elements from the list.
12. toArray() - Returns an array containing all the elements in the list.
13. subList(int fromIndex, int toIndex) - Returns a view of the portion of the list between the specified fromIndex, inclusive, and toIndex, exclusive.
14. addAll(int index, Collection<? extends E> c) - Inserts all elements of the specified collection into the list, starting at the specified position.
15. iterator() - Returns an iterator over the elements in the list.
16. sort(Comparator<? super E> c) - Sorts the elements of the list according to the specified comparator.
17. replaceAll(UnaryOperator<E> operator) - Replaces each element of the list with the result of applying the given operator.
18. forEach(Consumer<? super E> action) - Performs the given action for each element of the list until all elements have been processed or the action throws an exception.
Common Programming Interview Questions
How do you reverse a string?
How do you determine if a string is a palindrome?
How do you calculate the number of numerical digits in a string?
How do you find the count for the occurrence of a particular character in a string?
How do you find the non-matching characters in a string?
How do you find out if the two given strings are anagrams?
How do you calculate the number of vowels and consonants in a string?
How do you total all of the matching integer elements in an array?
How do you reverse an array?
How do you find the maximum element in an array?
How do you sort an array of integers in ascending order?
How do you print a Fibonacci sequence using recursion?
How do you calculate the sum of two integers?
How do you find the average of numbers in a list?
How do you check if an integer is even or odd?
How do you find the middle element of a linked list?
How do you remove a loop in a linked list?
How do you merge two sorted linked lists?
How do you implement binary search to find an element in a sorted array?
How do you print a binary tree in vertical order?
Conceptual Coding Interview Questions
What is a data structure?
What is an array?
What is a linked list?
What is the difference between an array and a linked list?
What is LIFO?
What is FIFO?
What is a stack?
What are binary trees?
What are binary search trees?
What is object-oriented programming?
What is the purpose of a loop in programming?
What is a conditional statement?
What is debugging?
What is recursion?
What are the differences between linear and non-linear data structures?
General Coding Interview Questions
What programming languages do you have experience working with?
Describe a time you faced a challenge in a project you were working on and how you overcame it.
Walk me through a project you’re currently or have recently worked on.
Give an example of a project you worked on where you had to learn a new programming language or technology. How did you go about learning it?
How do you ensure your code is readable by other developers?
What are your interests outside of programming?
How do you keep your skills sharp and up to date?
How do you collaborate on projects with non-technical team members?
Tell me about a time when you had to explain a complex technical concept to a non-technical team member.
How do you get started on a new coding project?
How do you reverse a string?
How do you determine if a string is a palindrome?
How do you calculate the number of numerical digits in a string?
How do you find the count for the occurrence of a particular character in a string?
How do you find the non-matching characters in a string?
How do you find out if the two given strings are anagrams?
How do you calculate the number of vowels and consonants in a string?
How do you total all of the matching integer elements in an array?
How do you reverse an array?
How do you find the maximum element in an array?
How do you sort an array of integers in ascending order?
How do you print a Fibonacci sequence using recursion?
How do you calculate the sum of two integers?
How do you find the average of numbers in a list?
How do you check if an integer is even or odd?
How do you find the middle element of a linked list?
How do you remove a loop in a linked list?
How do you merge two sorted linked lists?
How do you implement binary search to find an element in a sorted array?
How do you print a binary tree in vertical order?
Conceptual Coding Interview Questions
What is a data structure?
What is an array?
What is a linked list?
What is the difference between an array and a linked list?
What is LIFO?
What is FIFO?
What is a stack?
What are binary trees?
What are binary search trees?
What is object-oriented programming?
What is the purpose of a loop in programming?
What is a conditional statement?
What is debugging?
What is recursion?
What are the differences between linear and non-linear data structures?
General Coding Interview Questions
What programming languages do you have experience working with?
Describe a time you faced a challenge in a project you were working on and how you overcame it.
Walk me through a project you’re currently or have recently worked on.
Give an example of a project you worked on where you had to learn a new programming language or technology. How did you go about learning it?
How do you ensure your code is readable by other developers?
What are your interests outside of programming?
How do you keep your skills sharp and up to date?
How do you collaborate on projects with non-technical team members?
Tell me about a time when you had to explain a complex technical concept to a non-technical team member.
How do you get started on a new coding project?
🔒💻 27 Free Resources to Learn Ethical Hacking! 💻🔒
🚀 Dive into the world of ethical hacking with these handpicked resources:
Root Me — Challenges
Stök's YouTube — Videos
Hacker101 Videos — Videos
InsiderPhD YouTube — Videos
EchoCTF — Interactive Learning
Vuln Machines — Videos and Labs
Try2Hack — Interactive Learning
Pentester Land — Written Content
Checkmarx — Interactive Learning
Cybrary — Written Content and Labs
RangeForce — Interactive Exercises
Vuln Hub — Written Content and Labs
TCM Security — Interactive Learning
HackXpert — Written Content and Labs
Try Hack Me — Written Content and Labs
OverTheWire — Written Content and Labs
Hack The Box — Written Content and Labs
CyberSecLabs — Written Content and Labs
Pentester Academy — Written Content and Labs
Bug Bounty Reports Explained YouTube — Videos
Web Security Academy — Written Content and Labs
Securibee's Infosec Resources — Written Content
Jhaddix Bug Bounty Repository — Written Content
Zseano's Free Bug Bounty Methodology — Free Ebook
Awesome AppSec GitHub Repository — Written Content
NahamSec's Bug Bounty Beginner Repository — Written Content
Kontra Application Security Training — Interactive Learning
💡 From beginners to pros, these resources offer a plethora of knowledge and hands-on experience to sharpen your ethical hacking skills.
#EthicalHacking #CyberSecurity
➖➖➖➖➖➖➖➖➖➖➖➖➖➖
Join @coding_interview_preparation for more interview questions.
*This channel belongs to @bigdataspecialist group
🚀 Dive into the world of ethical hacking with these handpicked resources:
Root Me — Challenges
Stök's YouTube — Videos
Hacker101 Videos — Videos
InsiderPhD YouTube — Videos
EchoCTF — Interactive Learning
Vuln Machines — Videos and Labs
Try2Hack — Interactive Learning
Pentester Land — Written Content
Checkmarx — Interactive Learning
Cybrary — Written Content and Labs
RangeForce — Interactive Exercises
Vuln Hub — Written Content and Labs
TCM Security — Interactive Learning
HackXpert — Written Content and Labs
Try Hack Me — Written Content and Labs
OverTheWire — Written Content and Labs
Hack The Box — Written Content and Labs
CyberSecLabs — Written Content and Labs
Pentester Academy — Written Content and Labs
Bug Bounty Reports Explained YouTube — Videos
Web Security Academy — Written Content and Labs
Securibee's Infosec Resources — Written Content
Jhaddix Bug Bounty Repository — Written Content
Zseano's Free Bug Bounty Methodology — Free Ebook
Awesome AppSec GitHub Repository — Written Content
NahamSec's Bug Bounty Beginner Repository — Written Content
Kontra Application Security Training — Interactive Learning
💡 From beginners to pros, these resources offer a plethora of knowledge and hands-on experience to sharpen your ethical hacking skills.
#EthicalHacking #CyberSecurity
➖➖➖➖➖➖➖➖➖➖➖➖➖➖
Join @coding_interview_preparation for more interview questions.
*This channel belongs to @bigdataspecialist group
Database keys
Database keys are essential for organizing and managing data effectively. In this post, we'll explore ten key concepts that every IT professional should know.
1. 🗝 𝗣𝗿𝗶𝗺𝗮𝗿𝘆 𝗞𝗲𝘆
- A unique identifier for each record in a table.
- Cannot be null.
- Ensures that each row is unique.
2. 🌉 𝗙𝗼𝗿𝗲𝗶𝗴𝗻 𝗞𝗲𝘆
- A field in one table that refers to the Primary Key of another table.
- Establishes relationships between tables.
3. 🧩 𝗖𝗼𝗺𝗽𝗼𝘀𝗶𝘁𝗲 𝗞𝗲𝘆
- A combination of two or more columns that uniquely identifies each record.
- Useful when a single column can't uniquely identify a record.
4. 💪 𝗦𝘂𝗽𝗲𝗿 𝗞𝗲𝘆
- One or more columns that can uniquely identify a record.
- A Primary Key is a type of Super Key.
5. 🏅 𝗖𝗮𝗻𝗱𝗶𝗱𝗮𝘁𝗲 𝗞𝗲𝘆
- A column or set of columns that could be the Primary Key.
- Must be unique.
6. 🔍 𝗨𝗻𝗶𝗾𝘂𝗲 𝗞𝗲𝘆
- Ensures uniqueness for a column or column combination.
- Similar to Primary Key but allows one null value.
7. 🛤 𝗔𝗹𝘁𝗲𝗿𝗻𝗮𝘁𝗲 𝗞𝗲𝘆
- A Candidate Key that isn't the Primary Key.
- Another option for a unique identifier.
8. 🍃 𝗡𝗮𝘁𝘂𝗿𝗮𝗹 𝗞𝗲𝘆
- A key that's a natural part of the data, like an email address.
9. 🎭 𝗦𝘂𝗿𝗿𝗼𝗴𝗮𝘁𝗲 𝗞𝗲𝘆
- An artificial key created when no natural unique identifier exists.
10. 🔑 𝗦𝗲𝗰𝗼𝗻𝗱𝗮𝗿𝘆 𝗞𝗲𝘆
- Used for data retrieval, not identification.
- Helps create non-clustered indexes.
Database keys are essential for organizing and managing data effectively. In this post, we'll explore ten key concepts that every IT professional should know.
1. 🗝 𝗣𝗿𝗶𝗺𝗮𝗿𝘆 𝗞𝗲𝘆
- A unique identifier for each record in a table.
- Cannot be null.
- Ensures that each row is unique.
2. 🌉 𝗙𝗼𝗿𝗲𝗶𝗴𝗻 𝗞𝗲𝘆
- A field in one table that refers to the Primary Key of another table.
- Establishes relationships between tables.
3. 🧩 𝗖𝗼𝗺𝗽𝗼𝘀𝗶𝘁𝗲 𝗞𝗲𝘆
- A combination of two or more columns that uniquely identifies each record.
- Useful when a single column can't uniquely identify a record.
4. 💪 𝗦𝘂𝗽𝗲𝗿 𝗞𝗲𝘆
- One or more columns that can uniquely identify a record.
- A Primary Key is a type of Super Key.
5. 🏅 𝗖𝗮𝗻𝗱𝗶𝗱𝗮𝘁𝗲 𝗞𝗲𝘆
- A column or set of columns that could be the Primary Key.
- Must be unique.
6. 🔍 𝗨𝗻𝗶𝗾𝘂𝗲 𝗞𝗲𝘆
- Ensures uniqueness for a column or column combination.
- Similar to Primary Key but allows one null value.
7. 🛤 𝗔𝗹𝘁𝗲𝗿𝗻𝗮𝘁𝗲 𝗞𝗲𝘆
- A Candidate Key that isn't the Primary Key.
- Another option for a unique identifier.
8. 🍃 𝗡𝗮𝘁𝘂𝗿𝗮𝗹 𝗞𝗲𝘆
- A key that's a natural part of the data, like an email address.
9. 🎭 𝗦𝘂𝗿𝗿𝗼𝗴𝗮𝘁𝗲 𝗞𝗲𝘆
- An artificial key created when no natural unique identifier exists.
10. 🔑 𝗦𝗲𝗰𝗼𝗻𝗱𝗮𝗿𝘆 𝗞𝗲𝘆
- Used for data retrieval, not identification.
- Helps create non-clustered indexes.
100+ Practice Questions
❍ C/C++
❍ Python
❍ JavaScript
❍ Java
❍ C#
❍ Golang
➊ Simple Numbers
➀ Find a digit at a specific place in a number
➁ Find count of digits in a number
➂ Find the largest digit
➃ Find the 2nd largest digit
➄ Find the kth largest digit
➅ Find the smallest digit
➆ Find the 2nd smallest digit
➇ Find the kth smallest digit
➈ Find generic root (sum of all digits) of a number
➉ Reverse the digits in a number
➀➀ Rotate the digits in a number
➀➁ Is the number a palindrome?
➀➂ Find sum of 'n' numbers
➀➃ Check if a number is perfect square
➀➄ Find a number in an AP sequence
➀➅ Find a number in a GP sequence
➀➆ Find a number in fibonacci sequence
➀➇ Check number divisibility by 2, 3, 5, 9
➀➈ Check if a number is primary or not
20. Given a number, print all primes smaller than it
➁➀ Check if a number is circular prime or not
➁➁ Find all prime factors of a number
➁➂ Find the GCD of 2 numbers
➁➃ Find the LCM of 2 numbers
➁➄ Find the factorial of a number
➁➅ Find the exponentiation of a number
➋ Unit Conversion
➀ Number Base (Binary, Octal, Hexadecimal, Decimal)
➁ Weight (gram, kg, pound)
➂ Height (cm, m, inch, feet)
➃ Temperature (centigrade, fahrenhite)
➄ Distance (km, mile)
➅ Area (m², km², acre)
➆ Volume (ltr, gallon)
➇ Time (sec, min, hour)
➈ Currency
➌ Calculator
➀ Loan EMI Calculator
➁ Fixed Deposit Returns Calculator
➂ Interest Calculator
➃ BMI Calculator
➄ Item Price (considering tax, discount, shipping)
➅ Tip Calculator
➍ Geometry
➀ Find distance between 2 points
➁ Given 2 sides of a right angle triangle, find the 3rd
➂ Find 3rd angle of a triangle when 2 are given
➃ Area of a triangle when 3 sides are given
➄ Area of a right angle triangle
➅ Perimeter of a Square
➆ Area of a Square
➇ Perimeter of a Rectangle
➈ Area of a Rectangle
➉ Circumference of a Circle
➀➀ Area of a Circle
➀➁ Circumference of a Semi-Circle
➀➂ Area of a Semi-Circle
➀➃ Area of a Ring
➀➄ Circumference of an Ellipse
➀➅ Area of an Ellipse
➀➆ Suface Area of a Sphere
➀➇ Volume of a Sphere
➀➈ Surface Area of a Hemisphere
20. Volume of a Hemisphere
➁➀ Surface area of a Cube
➁➁ Volume of a Cube
➁➂ Surface area of a Cylinder
➁➃ Volume of a Cylinder
➎ Vector
➀ Find Scalar Multiplication of a vector
➁ Find addition/subtraction of vectors
➂ Find magnitude of a vector
➃ Find an unit vector along a given vector
➄ Find dot product of 2 vectors
➅ Find cross product of 2 vectors
➆ Check if 2 vectors are orthogonal
➏ Matrix
➀ Find the determinant of a matrix
➁ Find Scalar Multiplication of a matrix
➂ Find addition/subtraction of matrices
➃ Find the transpose of a matrix
➄ Find if 2 matrices are orthogonal
➅ Find inverse of a 2x2 and 3x3 matrix
➐ Set
➀ Find Union of 2 sets
➁ Find Intersection of 2 sets
➂ Find the Difference of 2 sets
➃ Find the Symmetric Difference of 2 sets
➄ Find if a set is subset/superset of another set
➅ Find if 2 sets are disjoints
➑ Special Numbers
➀ Strong Number
➁ Perfect Number
➂ Armstrong Number
➃ Harshad Number
➄ Kaprekar Number
➅ Lychrel Number
➆ Narcissistic Decimal Number
➇ Lucus Number
➈ Catalan Number
➉ Duck Number
➀➀ Ugly Number
➀➁ Abundant Number
➀➂ Deficient Number
➀➃ Automorphic Number
➀➄ Magic Number
➀➅ Friendly Pair Numbers
➀➆ Neon Number
➀➇ Spy Number
➀➈ Happy Number
20. Sunny Number
➁➀ Disarium Number
➁➁ Pronic Number
➁➂ Trimorphic Number
➁➃ Evil Number
➁➄ Amicable Pairs
🚥 Last Words
⬘ If you want to excel in programming, practice a lot.
⬙ Problems based on numbers are easy to start with and they help in improving your analytical skills.
❍ C/C++
❍ Python
❍ JavaScript
❍ Java
❍ C#
❍ Golang
➊ Simple Numbers
➀ Find a digit at a specific place in a number
➁ Find count of digits in a number
➂ Find the largest digit
➃ Find the 2nd largest digit
➄ Find the kth largest digit
➅ Find the smallest digit
➆ Find the 2nd smallest digit
➇ Find the kth smallest digit
➈ Find generic root (sum of all digits) of a number
➉ Reverse the digits in a number
➀➀ Rotate the digits in a number
➀➁ Is the number a palindrome?
➀➂ Find sum of 'n' numbers
➀➃ Check if a number is perfect square
➀➄ Find a number in an AP sequence
➀➅ Find a number in a GP sequence
➀➆ Find a number in fibonacci sequence
➀➇ Check number divisibility by 2, 3, 5, 9
➀➈ Check if a number is primary or not
20. Given a number, print all primes smaller than it
➁➀ Check if a number is circular prime or not
➁➁ Find all prime factors of a number
➁➂ Find the GCD of 2 numbers
➁➃ Find the LCM of 2 numbers
➁➄ Find the factorial of a number
➁➅ Find the exponentiation of a number
➋ Unit Conversion
➀ Number Base (Binary, Octal, Hexadecimal, Decimal)
➁ Weight (gram, kg, pound)
➂ Height (cm, m, inch, feet)
➃ Temperature (centigrade, fahrenhite)
➄ Distance (km, mile)
➅ Area (m², km², acre)
➆ Volume (ltr, gallon)
➇ Time (sec, min, hour)
➈ Currency
➌ Calculator
➀ Loan EMI Calculator
➁ Fixed Deposit Returns Calculator
➂ Interest Calculator
➃ BMI Calculator
➄ Item Price (considering tax, discount, shipping)
➅ Tip Calculator
➍ Geometry
➀ Find distance between 2 points
➁ Given 2 sides of a right angle triangle, find the 3rd
➂ Find 3rd angle of a triangle when 2 are given
➃ Area of a triangle when 3 sides are given
➄ Area of a right angle triangle
➅ Perimeter of a Square
➆ Area of a Square
➇ Perimeter of a Rectangle
➈ Area of a Rectangle
➉ Circumference of a Circle
➀➀ Area of a Circle
➀➁ Circumference of a Semi-Circle
➀➂ Area of a Semi-Circle
➀➃ Area of a Ring
➀➄ Circumference of an Ellipse
➀➅ Area of an Ellipse
➀➆ Suface Area of a Sphere
➀➇ Volume of a Sphere
➀➈ Surface Area of a Hemisphere
20. Volume of a Hemisphere
➁➀ Surface area of a Cube
➁➁ Volume of a Cube
➁➂ Surface area of a Cylinder
➁➃ Volume of a Cylinder
➎ Vector
➀ Find Scalar Multiplication of a vector
➁ Find addition/subtraction of vectors
➂ Find magnitude of a vector
➃ Find an unit vector along a given vector
➄ Find dot product of 2 vectors
➅ Find cross product of 2 vectors
➆ Check if 2 vectors are orthogonal
➏ Matrix
➀ Find the determinant of a matrix
➁ Find Scalar Multiplication of a matrix
➂ Find addition/subtraction of matrices
➃ Find the transpose of a matrix
➄ Find if 2 matrices are orthogonal
➅ Find inverse of a 2x2 and 3x3 matrix
➐ Set
➀ Find Union of 2 sets
➁ Find Intersection of 2 sets
➂ Find the Difference of 2 sets
➃ Find the Symmetric Difference of 2 sets
➄ Find if a set is subset/superset of another set
➅ Find if 2 sets are disjoints
➑ Special Numbers
➀ Strong Number
➁ Perfect Number
➂ Armstrong Number
➃ Harshad Number
➄ Kaprekar Number
➅ Lychrel Number
➆ Narcissistic Decimal Number
➇ Lucus Number
➈ Catalan Number
➉ Duck Number
➀➀ Ugly Number
➀➁ Abundant Number
➀➂ Deficient Number
➀➃ Automorphic Number
➀➄ Magic Number
➀➅ Friendly Pair Numbers
➀➆ Neon Number
➀➇ Spy Number
➀➈ Happy Number
20. Sunny Number
➁➀ Disarium Number
➁➁ Pronic Number
➁➂ Trimorphic Number
➁➃ Evil Number
➁➄ Amicable Pairs
🚥 Last Words
⬘ If you want to excel in programming, practice a lot.
⬙ Problems based on numbers are easy to start with and they help in improving your analytical skills.