Palindrome Puzzle interview Question

 Palindrome Puzzle interview Question


Problem: this year on October 2, 2001, the date in MMDDYYYY format will be a palindrome (same forwards as backwards).
when was the last date that this occurred on? (see if you can do it in your head!)


Solution: we know the year has to be less than 2001 since we already have the palindrome for 10/02. it can’t be any year in 1900 because that would result in a day of 91. same for 1800 down to 1400. it could be a year in 1300 because that would be the 31st day. so whats the latest year in 1300 that would make a month? at first i thought it would be 1321, since that would give us the 12th month, but we have to remember that we want the maximum year in the 1300 century with a valid month, which would actually be 1390, since 09/31 is a valid date.
but of course, a question like this wouldn’t be complete without an aha factor. and of course, there are not 31 days in september, only 30. so we have to go back to august 08 which means the correct date would be 08/31/1380.
palindromes also offer another great string question.
write a function that tests for palindromes
bool isPalindrome( char* pStr )
if you start a pointer at the beginning and the end of the string and keep comparing characters while moving the pointers closer together, you can test if the string is the same forwards and backwards. notice that the pointers only have to travel to the middle, not all the way to the other end (to reduce redundancy).
bool isPalindrome( char* pStr )
  if ( pStr == NULL )
   return false;
  char* pEnd = pStr;
  while ( *pEnd != '\0' )
  while(pEnd > pStr)
    if ( *pEnd != *pStr )
      return false;
  return true;
thanks to tom for sending me this one! congrats on the wedding… appreciates your contribution please mail us the questions you have to so that it will be useful to our job search community

Sample for Android Geo Location

Most Android devices allow to determine the current geolocation.  Below is the sample for Android.

Create Project

Create a new project called with the Activity called ShowLocationActivity.
Change your layout file from the res/layout folder to the following code.

<LinearLayout xmlns:android=""
    android:orientation="vertical" >

        android:orientation="horizontal" >

            android:text="Latitude: "
            android:textSize="20dip" >

            android:textSize="20dip" >

        android:layout_height="wrap_content" >

            android:text="Longitute: "
            android:textSize="20dip" >

            android:textSize="20dip" >



Add permissions

Add the following permissions to your application in your AndroidManifest.xml file



Change ShowLocationActivity to the following. It queries the location manager and display the queried values in the activity.


import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

public class ShowLocationActivity extends Activity implements LocationListener {
  private TextView latituteField;
  private TextView longitudeField;
  private LocationManager locationManager;
  private String provider;

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); latituteField = (TextView) findViewById(; longitudeField = (TextView) findViewById(; // Get the location manager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the locatioin provider -> use // default Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider); // Initialize the location fields if (location != null) { System.out.println("Provider " + provider + " has been selected."); onLocationChanged(location); } else { latituteField.setText("Location not available"); longitudeField.setText("Location not available"); } } /* Request updates at startup */ @Override protected void onResume() { super.onResume(); locationManager.requestLocationUpdates(provider, 400, 1, this); } /* Remove the locationlistener updates when Activity is paused */ @Override protected void onPause() { super.onPause(); locationManager.removeUpdates(this); } @Override public void onLocationChanged(Location location) { int lat = (int) (location.getLatitude()); int lng = (int) (location.getLongitude()); latituteField.setText(String.valueOf(lat)); longitudeField.setText(String.valueOf(lng)); } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { Toast.makeText(this, "Enabled new provider " + provider, Toast.LENGTH_SHORT).show(); } @Override public void onProviderDisabled(String provider) { Toast.makeText(this, "Disabled provider " + provider, Toast.LENGTH_SHORT).show(); } }


 Run and Test

If you using the emulator send some geo-coordinates to your device. These geo-coordinate should be displayed as soon as you press the button.

Basic Android Interview questions

Basic Android Interview questions
1) What is Android?

2) What Is the Google Android SDK?

3) What is the Android Architecture?
Android Architecture is made up of 4 key components:
- Linux Kernel
- Libraries
- Android Framework
- Android Applications

4) Describe the Android Framework.

5) What is AAPT?


7) What is the use of an activityCreator?

8 ) Describe Activities.

9) What are Intents?

10) Differentiate Activities from Services.

11) What items are important in every Android project?
- AndroidManifest.xml
- build.xml
- bin/
- src/
- res/
- assets/

12) What is the importance of XML-based layouts?

13) What are containers?

14) What is Orientation?


16) What do you think are some disadvantages of Android?

17) What is adb?

18) What are the four essential states of an activity?
- Active – if the activity is at the foreground
- Destroyed – when the activity process is killed or completed terminated

19) What is ANR?


21) How are escape characters used as attribute?
Escape characters are preceded by double backslashes. For example, a newline character is created using ‘\\n’


23) What is the function of an intent filter?

24) Enumerate the three key loops when monitoring an activity?
- Entire lifetime – activity happens between onCreate and onDestroy
- Visible lifetime – activity happens between onStart and onStop
- Foreground lifetime – activity happens between onResume and onPause

25) When is the onStop() method invoked?


There are 4 possible states:
- foreground activity
- visible activity
- background activity
- empty process

28) How can the ANR be prevented?

29) What role does Dalvik play in Android development?

30) What is the AndroidManifest.xml?

-Declare your application as “debuggable” in your Android Manifest.
-Turn on “USB Debugging” on your device.
-Set up your system to detect your device.


33) What is the importance of Default Resources?

Assuming that all of these multiple resources are able to match the configuration of a device, the ‘locale’ qualifier almost always takes the highest precedence over the others.

35) When does ANR occur?

36) What is AIDL?

37) What data types are supported by AIDL?
AIDL has support for the following data types:

38) What is a Fragment?

39) What is a visible activity?




There are 5 key components under the Android application architecture:
- services
- intent
- resource externalization
- notifications
- content providers

44) What composes a typical Android application project?

45) What is a Sticky Intent?


47) What is portable wi-fi hotspot?

48) What is an action?


50) What language is supported by Android for application development?

What are HTML Tags

What are HTML Tags?

Consider this example
  1. <html>
  2. <head>
  3. <title>Your page title</title>
  4. </head>
  5. <body>
  6. <!-- An HTML comment which is not displayed on the web page -->
  7. <h1>Your page heading</h1>
  8. <p>Your page content in a paragraph.</p>
  9. </body>
  10. </html>
The words <html><head><title></title></head><body><h1><p></p>,</h1></body></html> etc., are called HTML Tags.
The words <html><head><title><body><h1><p> etc., are called opening tags / start tags.
The words </html></head></title></body></h1></p> (with a back slash /) etc., are called closing tags / end tags

What is the syntax to write an HTML Tag?

HTML Tags are not case sensitive and you are free to use both uppercase or lowercase tags or a combination of both. Now a days many websites use lowercase tags and for future specifications (versions) of HTML it is recommended to use lowercase tags.
Any number of line breaks and spaces in a HTML document are treated as a single space character (exception: <pre></pre> tag).

  1. <p>Your page content in a paragraph.</p>
  1. <p>
  2. Your page content in a paragraph.
  3. </p>
  1. <p>
  2. Your page
  3. content in a paragraph.
  4. </p>
  1. <p>
  2. Your page
  3. content in a paragraph.
  4. </p>
  1. <p>
  2. Your page
  3. content
  4. in a paragraph.
  5. </p>
The ouput of all the above codes is same.

List of some commonly used HTML Tags

Please note that the default display of elements will be different from our examples as we use various CSS to style our web page
<a>Anchor tag is used to display hyper linksThis is a link
<b>This tag makes the text inside it boldThis is a bold text
<body>This defines the body of a HTML documentThis tag is found in each and every web page
<br />Introduces a line break in the web page.
It is an empty element which has no closing tag
line 1 
line 2
<button>Creates a clickable button (mostly used in forms)
<div>Used to organise content into divisions (sections)Extensively used in almost all web pages
<em>Emphasizes text inside itThis text is emphasized
<form>Used to submit data using input tagsView forms demo
<frame>Creates a frame which is like a sub-windowView frames demo
<h1> to<h6>Heading tags are used to define the heading of a page


in a <h2> tag
<head>Contains the information of a dcoument like page's titleView example
<hr />Similar to <br /> tag but introduces a horizontal lineline 1 

line 2
<html>It is the root of any HTML documentIt is found in every html document
<i>Makes the text inside it italicizedThis is an italic text
<iframe>Creates an inline frameView iframes demo
<img />Image tag is an empty tag used to insert images
<input />An empty element used to input data
<label>Acts as a label for an input
<li>Display an item of a list (ordered and unordered)

  • Item 1
  • <ol>Make an ordered list of items
    1. Item 1
    2. Item 2
    <p>Display content in a paragraphThis is a paragraph
    This is another paragraph
    <span>Define a section in a documentUsed to style different sections in an element
    <strong>Make the text look more importantThis is a strong text
    <table>Create a tableYou are already viewing this in a table
    <td>Display a table cellThis text is in a table cell
    <tr>Create a table rowThese three cells of the current line form a row
    <ul>Make an unordered list of items
    • Item 1
    • Item 2 appreciates your contribution please mail us the questions you have to so that it will be useful to our job search community

    Keyboard Shortcuts for Microsoft Windows operating system.

    Keyboard Shortcuts for Microsoft Windows operating system.
    Keyboard Shorcuts (Microsoft Windows)
    1. CTRL+C (Copy)
    2. CTRL+X (Cut)
    3. CTRL+V (Paste)
    4. CTRL+Z (Undo)
    5. DELETE (Delete)
    9. F2 key (Rename the selected item)
    15. CTRL+A (Select all)
    22. ALT+TAB (Switch between the open items)
    28. CTRL+ESC (Display the Start menu)
    33. F5 key (Update the active window)
    35. ESC (Cancel the current task)
    Dialog Box - Keyboard Shortcuts
    1. CTRL+TAB (Move forward through the tabs)
    3. TAB (Move forward through the options)
    4. SHIFT+TAB (Move backward through the options)
    9. F1 key (Display Help)
    Microsoft Natural Keyboard Shortcuts
    1. Windows Logo (Display or hide the Start menu)
    3. Windows Logo+D (Display the desktop)
    6. Windows Logo+E (Open My Computer)
    9. Windows Logo+F1 (Display Windows Help)
    10. Windows Logo+ L (Lock the keyboard)
    12. Windows Logo+U (Open Utility Manager)
    13. Accessibility Keyboard Shortcuts
    19. Windows Logo +U (Open Utility Manager)
    20. Windows Explorer Keyboard Shortcuts
    21. END (Display the bottom of the active window)
    22. HOME (Display the top of the active window)
    Shortcut Keys for Character Map
    3. UP ARROW (Move up one row)
    4. DOWN ARROW (Move down one row)
    7. HOME (Move to the beginning of the line)
    8. END (Move to the end of the line)
    9. CTRL+HOME (Move to the first character)
    10. CTRL+END (Move to the last character)
    Microsoft Management Console (MMC)
    Main Window Keyboard Shortcuts
    1. CTRL+O (Open a saved console)
    2. CTRL+N (Open a new console)
    3. CTRL+S (Save the open console)
    5. CTRL+W (Open a new window)
    7. ALT+SPACEBAR (Display the MMC window menu)
    8. ALT+F4 (Close the console)
    9. ALT+A (Display the Action menu)
    10. ALT+V (Display the View menu)
    11. ALT+F (Display the File menu)
    12. ALT+O (Display the Favorites menu)
    MMC Console Window Keyboard Shortcuts
    6. CTRL+F10 (Maximize the active console window)
    7. CTRL+F5 (Restore the active console window)
    9. F2 key (Rename the selected item)
    Remote Desktop Connection Navigation
    5. ALT+HOME (Display the Start menu)
    7. ALT+DELETE (Display the Windows menu)
    Microsoft Internet Explorer Keyboard Shortcuts
    2. CTRL+E (Open the Search bar)
    3. CTRL+F (Start the Find utility)
    4. CTRL+H (Open the History bar)
    5. CTRL+I (Open the Favorites bar)
    6. CTRL+L (Open the Open dialog box)
    9. CTRL+P (Open the Print dialog box)
    10. CTRL+R (Update the current Web ) appreciates your contribution please mail us the questions you have to so that it will be useful to our job search community