Thales Android Interview

Android

1) Difference between Service and Aysnc Task.
2) What is Broadcast Receiver and when to use one.
3) What is fragment
4) Tell the activity lifecycle
5) Why do we use DDMS
6) adb commands used by you

 

Java
1) What is static method
2) What values can be accessed from a static method in java


Git

1) Git command to add a file

2) Difference between git pull rebase vs git pull merge
https://www.atlassian.com/git/tutorials/merging-vs-rebasing

SQL
1) Difference between inner join and full join


Network

1) How to send a file from computer to server
2) What is ssh command

Linux
1) List the top 10 process which are taking most CPU.

Advertisements

C/C++ Interview Questions

https://www.toptal.com/c-plus-plus/interview-questions

 

BASICS

  1. Notice the line that reads

    i = (j++, k++);

    This line actually performs three actions at once. These are the three actions, in order:

    1. Assigns the value of k to i. This happens because the left value (lvalue) always evaluates to the rightmost argument. In this case, it evaluates to k. Notice that it does not evaluate to k++, because k++ is a postfix incremental expression, and k is not incremented until the assignment of k to i is made. If the expression had read ++k, the value of ++k would be assigned to i because it is a prefix incremental expression, and it is incremented before the assignment is made.

    2. Increments j.

    3. Increments k.

  2. Is left-to-right or right-to-left order guaranteed for operator precedence?

    The simple answer to this question is neither. The C language does not always evaluate left-to-right or right-to-left. Generally, function calls are evaluated first, followed by complex expressions and then simple expressions.

    Additionally, most of today’s popular C compilers often rearrange the order in which the expression is evaluated in order to get better optimized code. You therefore should always implicitly define your operator precedence by using parentheses.

    For example, consider the following expression:

    a = b + c/d / function_call() * 5

    The way this expression is to be evaluated is totally ambiguous, and you probably will not get the results you want. Instead, try writing it by using implicit operator precedence:

    a = b + (((c/d) / function_call()) * 5)

    Using this method, you can be assured that your expression will be evaluated properly and that the compiler will not rearrange operators for optimization purposes.

     

  3. What is an lvalue?

    An lvalue is an expression to which a value can be assigned. The lvalue expression is located on the left side of an assignment statement, whereas an rvalue is located on the right side of an assignment statement. Each assignment statement must have an lvalue and an rvalue. The lvalue expression must reference a storable variable in memory. It cannot be a constant. For instance, the following lines show a few examples of lvalues:

    int x;
    int* p_int;
    x = 1;
    *p_int = 5;
    

    The variable x is an integer, which is a storable location in memory. Therefore, the statement x = 1 qualifies x to be an lvalue. Notice the second assignment statement, *p_int = 5. By using the * modifier to reference the area of memory that p_int points to, *p_int is qualified as an lvalue. In contrast, here are a few examples of what would not be considered lvalues:

    #define CONST_VAL 10
    int x;
    /* example 1 */
    1 = x;
    /* example 2 */
    CONST_VAL = 5;
    

    In both statements, the left side of the statement evaluates to a constant value that cannot be changed because constants do not represent storable locations in memory. Therefore, these two assignment statements do not contain lvalues and will be flagged by your compiler as errors.

     

  4. Can an array be an lvalue?

    Is an array an expression to which we can assign a value? The answer to this question is no, because an array is composed of several separate array elements that cannot be treated as a whole for assignment purposes. The following statement is therefore illegal:

    int x[5], y[5];

    x = y;

    You could, however, use a for loop to iterate through each element of the array and assign values individually, such as in this example:

    int i;
    int x[5];
    int y[5];
    ...
    for (i=0; i<5; i++)
         x[i] = y[i]
    ...
    

    Additionally, you might want to copy the whole array all at once. You can do so using a library function such as the memcpy() function, which is shown here:

    memcpy(x, y, sizeof(y));

    It should be noted here that unlike arrays, structures can be treated as lvalues. Thus, you can assign one structure variable to another structure variable of the same type, such as this:

    typedef struct t_name
    {
         char last_name[25];
         char first_name[15];
         char middle_init[2];
    } NAME;
    ...
    NAME my_name, your_name;
    ...
    your_name = my_name;
    ...
    

    In the preceding example, the entire contents of the my_name structure were copied into the your_name structure. This is essentially the same as the following line:

    memcpy(your_name, my_name, sizeof(your_name));

     

MACROS

Java Read Blogs Java Interview

http://javahungry.blogspot.com/2013/08/singleton-design-pattern-use-in-java.html

http://tutorials.jenkov.com/java-concurrency/volatile.html

http://javahungry.blogspot.com/2013/06/difference-between-string-stringbuilder.html

https://www.tutorialspoint.com/design_pattern/factory_pattern.htm

https://www.tutorialspoint.com/design_pattern/abstract_factory_pattern.htm

http://javahungry.blogspot.com/2013/06/top-25-most-frequently-asked-core-java.html

http://www.journaldev.com/1321/java-string-interview-questions-and-answers

http://www.journaldev.com/797/what-is-java-string-pool

http://www.journaldev.com/588/java-switch-case-string

Java revise

1) Scanner scan = new Scanner(System.in);
scan.close(); –> close the stream opened

2) difference between Stringbuffer and Stringbuilder

3) find duplicate elements in an array.

4) Solving tower of Hanoi problem using an algorithm

 

 

Eclipse useful shortcuts ===>

Ctrl + Shift + T  ==> Open Type in Hierarchy

Ctrl + Shift + U  ==> Find occurrences of expression in current file

Ctrl + Alt + H     ==> Open Call Hierarchy

Ctrl + Shift + R  ==> Open Resource (file, folder or project)

HashSet

  1. There’s no need to call equals if hashCode differs
  2. There’s no need to call hashCode if (obj1 == obj2)
  3. There’s no need for hashCode and/or equals just to iterate – you’re not comparing objects
  4. When needed to distinguish in between objects.