Android - Sample Interview Question (Junior Level)

Which of the following is the best and safest way to query for all UserName which ends with a specific name? (assume the name is an input taken from the  user)

  1. Cursor cursor = m_db.query(MY_TABLE, new String[] {"rowid","UserName"},"UserName" +" LIKE '"+" ?"+"%'", new String[]{name}, null, null, null);
  2. Cursor cursor = m_db.query(MY_TABLE, new String[] {"rowid","UserName"},"UserName" +" LIKE '"+name+"%'", null, null, null, null);
  3. Cursor cursor = m_db.query(MY_TABLE, new String[] {"rowid","UserName"}, "UserName LIKE '?'", new String[]{name+"%"}, null, null, null);
  4. None of the above.
Tests in Android for Juniors

Test Name Difficulty Time (minutes) No. of Questions
Android Online Test for Juniors Android Junior 60 30

More Specific Tests in Android for Juniors

Test Name Difficulty Time (Minutes) No. of Questions
Android-Data-Storage Online Test for Juniors Android - Data Storage Junior 20 10
Android-Application-Components Online Test for Juniors Android - Application Components Junior 20 10
Android-Application-Fundamentals Online Test for Juniors Android - Application Fundamentals Junior 20 10
Android-User-Interface Online Test for Juniors Android - User Interface Junior 20 10