Android engineer Written--2015--Wave Guide Company

Source: Internet
Author: User
Tags dashed line sqlite database

1. One of the advantages of using interrupt mode in microcomputers is (C)

    1. Simple and easy to implement
    2. CPU can not work
    3. Can be implemented in response to unexpected events
    4. Fastest Delivery speed

2. Which of the following data j2me is used in the virtual machine type (C)

A.JVM (Java Virtual machine)

B.dvm

C.CVM (or KVM)

D.card VMS

3. The main differences between the following non-CLDC1.1 core class libraries and the J2SE Core class library are: (A)

A: Thread groups or daemon threads are not supported

B. Floating-point data types are not supported

C. Weak references are not supported

D. Limited error handling

4. Which of the following program fragments inserts a node in the middle of the linked list. (assuming that the new node is Neo, you want to insert it after the pointer node) (C).

A   New->next=pointer; Pointer=new

B  New->next=pointer->next; Pointer->next=new

C  pointer->next=new->next; New->next=pointer

D These are not

5. The abstract class description is correct: (A)

A Unable to generate abstract constructor

B You can generate an abstract static method

C Abstract methods that allow private generation

D All of the above descriptions

6. A PNG format picture file A.png, the picture is 70 pixels wide, 20 pixels high, is used to create the Spirte, the program is as follows, the following description is correct: D

Image img;

try{img = image.createimage ("/a.png");

}catch (Exception e) {}

Sprite Sprite = new Sprite (img,20,20);

A. The image is divided into three images at a ratio of 20 pixels wide and 20 pixels high

B. The image is divided into a picture by a ratio of 20 pixels wide and 20 pixels high

C. The picture is used by the sprite and the image of the sprite is depicted in the position of the screen coordinates (20,20).

D. An exception occurred

7. Which of the following methods can be implemented on the screen to paint a dashed line (other parts of the program code omitted

public void Paint (Graphics g)

{

G.setcolor (255,255,255);

G.fillrect (0,0, GetWidth (), getheight ());

/* Code Snippet A */

G.setcolor (255,0,0);

G.drawline (20, 20, 100,20);

/* Code Snippet B */

G.setcolor (125, 125,125);

G.drawline (20,25,100,50);

G.setstrokestyle (Graphics.solid);

/* Code Snippet C */

G.setcolor (125, 125,125);

G.drawline (20,30,100,50);

G.setstrokestyle (graphics.dotted);

/* Code Snippet D */

G.setcolor (255,255,255);

G.drawline (20,50,100,50); }

A. Code snippet a B. Code snippet B c. Code snippet C D. Code snippet D

Answer: C

8. Bluetooth and 802.11B technology are short-range communication technology, the following description is incorrect: (D)

A. Bluetooth and 802.11B are wireless technology, and have selected 2.4GHz spectrum

B. 802.11B is mainly used to connect power consumption of large equipment, such as personal computers and laptops, etc.

C. Bluetooth is mainly used to connect small devices with minimal power consumption, such as PDAs and mobile phones, etc.

D. The speed of data exchange of Bluetooth technology reaches 11mb/s, the distance can reach 100 meters

9. Here is an example of using the Timer class and the TimerTask class to implement the thread (the rest of the code and the design of the class are omitted) to determine what function the following code can achieve: (B)

Timer timer = new timer (); Generates an object for a timer class

TimerTask TT = new TimerTask (); This class inherits the TimerTask class

Timer.schedule (TT, 100, 1000);

A. The run () method of the TimerTask class runs once every 100 milliseconds after waiting 1 seconds after the program starts

B. After the program starts, wait 100 milliseconds, run the TimerTask class's run () method once every 1 seconds

C. The run () method of the TimerTask class runs once every 1000 milliseconds after the program starts for 10 seconds

D. Wait 1 seconds after the program starts, run once every 10 seconds the TimerTask class's Run () method

10. The following information about the use of methods in J2SE is written correctly __c__

A.g.getfont ("Sansserif"); Used to get the current font, not with parameters

B.g.erase (X,Y,W,H); Clears the rectangle at (x, y) point

C.font f = new Font ("serif", font.bold,12);

D.g.setcolor (Color.yellow); Set the current color to yellow

J2ME architectures include B

A Java language, Java Editor, Java Virtual machine

B Configuration, profile, optional package

C CLDC, MIDP, WMA

D CDC, profile, optional package

12. In Java, the method of creating a thread has (B D) Multiple selection

A Implementing the Run Interface

B Implementing the Runnable Interface

C Inheriting the Pocess class, implementing the Run () method

D Inherit the thread class, implement the Run () method

13.D

14. In MIDP, the synchronization of code mainly includes the following methods? (BC)

A. Using global variables

B. Using the Callserially method

C. Use the Synchronized keyword, including for individual statements or for the entire method or object

D. Using the Servicepaint method

15. The operating system has the function of process management, storage management, file management and device management, which is incorrect in the following description? (A).
A Process management is mainly the management of the program
B Storage management primarily manages memory resources
C File management can effectively support the operation of files, to resolve file sharing, confidentiality and protection issues
D Device management refers to the management of all input in a computer system except CPU and memory.

Second, simple answer

1. What is synchronous and asynchronous, and what are the similarities and differences between the two, illustrate the application situation. 5 min

1 if the data is shared between threads. For example, the data being written may be read by another thread later, or the data being read may have been written by another thread, then the data is shared and must be accessed synchronously.

When an application calls a method that takes a long time to execute on an object and does not want the program to wait for the method to be returned, it should use asynchronous programming, which is often more efficient in many cases with asynchronous approaches.

2.Android commonly used five kinds of layout, and briefly explain the characteristics of these common layout. 10 min

2 second question, five layouts

First, Framelayout

This layout can be seen as a invade heap of things, there is a square of the upper left corner of the rectangle invade, we put the first thing, to put another, it is placed in the original position above, in order to put, will cover the original things. This layout is relatively simple, it can only put a little more simple things.

Second, LinearLayout

Linear layout, this thing, from the outer frame can be understood as a Div, he first is a one from the top down listed on the screen. Each of the linearlayout can be divided into vertical layouts (android:orientation= "vertical") and horizontal layouts (android:orientation= "horizontal"). When vertical layout, there is only one element for each row, and multiple elements are descending vertically; when horizontal layout, there is only a row, and each element is arranged to the right. There is an important attribute android:layout_weight= "1" in the LinearLayout, which represents the line spacing when vertical layout, the column width when horizontal, the larger the weight value.

Third, Absolutelayout

The absolute layout is like a div specifying the absolute property, specifying the position of the element with X, y coordinates android:layout_x= "20px"

Android:layout_y= "12px" This layout is also relatively simple, but in the vertical random switch, often problems, and a number of elements, the calculation is more troublesome.

Iv. Relativelayout

The relative layout can be understood as the layout of an element as a reference object. The main attributes are:

Relative to an element

android:layout_below= "@id/aaa" the element under the ID AAA

Android:layout_toleftof= "@id []b] The left side of the element is the BBB

Place relative to the parent element

Android:layout_alignparentleft= "true" left-justified on parent element

Android:layout_alignparentright= "true" to the right of the parent element, you can also specify the margin, and so on, as detailed in the API

Wu, Tablelayout

The table layout is similar to the table in HTML. Every tablelayout has a table row Tablerow,tablerow inside can define each element in detail, set his alignment android:gravity= "".

Each layout has its own appropriate way, and these five layout elements can be nested within each other to make an aesthetically pleasing interface.

3. Write the If statement that compares the BOOL flag with the "0 value", and write out the IF statement that compares the float X with the "0 value"; Please write out the IF statement of the Char *p compared to the "0 value"; 5 points

BOOL if (!var) ... And if (Var) ...

float if ((Var >=-EPS) && (var <= eps) ... And if (var >= EPS | | var <=-eps)

char* if (var = = NULL) ... And if (var! = NULL) ...

4. There are several types of memory allocation area, and the function of each memory area is simply explained. 10 points

1. Program counter

Each thread has a separate program counter that records the bytecode instructions that are being executed by the current thread, which is "thread-private" memory.

2. Virtual Machine stack

Mainly responsible for the memory part of the method execution, in each method execution will create a stack pin store local variables, operands and other methods related information, each time the call to completion of the method, all corresponding to a stack in the virtual machine stack in the process of entering and exiting the stack.

3. Local Method Stack

Similar to the virtual machine stack, only responsible for local native methods, but also throws Stackoverflowerror and OutOfMemoryError errors.

4. Java Heap (Java heap), GC heap

The main storage object instance, can be configured to set different generations of size and garbage collection policy, many optimizations are also implemented on the heap.

5. Method area, non-heap, permanent generation

Main storage virtual Machine load class information, constants, static variables, etc.

6. Direct Memory

Direct memory is not shown in the diagram, thinking that he is not a part of the data area when the virtual machine is running, not the management of virtual machines,

5. Simply describe the architecture of the Android system with illustrations or text. 5 min

Android's system architecture, like its operating system, employs a layered architecture. From the architecture diagram, Android is divided into four tiers, from the high-level to the lower layer, which are application layer, application framework layer, system run-level and Linux core.

The advantages and principles of 6.Java garbage collection, and consider two recycling mechanisms. 5 min

The program can use System.GC () or Runtime.getruntime (). GC () To request garbage collection, how it works: reference counting, Tag replication

The advantages and disadvantages of the garbage collection mechanism: Java's garbage collection mechanism the programmer does not have to worry about allocating memory space, reducing memory overflow. But at the same time sacrificing some performance.

7.Android in the activity,intent,contentprovider,servide of the respective definition and characteristics. 5 min

Activity: activities. An activity is a visual user interface that a user can manipulate, and each activity is implemented as a separate class and inherited from the active base class.

Intent: Intention. The most important part is the data corresponding to the action and the action.

Content Provider: An android application can save their data to a file, a SQLite database, or even any valid device. Content providers can work when you want to share your app data with other apps.

Service: Services, a program component with a long life cycle and no user interface.

8. What is the pros and cons of Java serialization, serialization, and how to implement it. 5 min

8 serialization is a mechanism for dealing with the flow of objects, so-called object flow is the flow of the object's contents. It is possible to read and write to a Fluidized object, or to transfer the streamed object between the networks.

Serialization implementation: Implement the Serializable interface for the class that needs to be serialized, there is no method to implement, implementsserializable just to annotate that the object is serializable, and then use an output stream ( such as: FileOutputStream) to construct a ObjectOutputStream object, followed by the WriteObject (object obj) of the ObjectOutputStream object method to write out (that is, save its state) the object with the parameter obj, and the input stream to restore.

9. The output of the following procedure is ___c___. int t (int x,int y,intcp,int dp) {cp=x*x+y*y; dp=x*x-y*y;} main () {int a=4,b=3,c=5,d=6:t (a,b,c,d); printf ("%d%d\n", c,d );

A 4 5

B 4 6

C 5 6

D 5 5

10 interrupts are an important part of the embedded system, which leads to a lot of compiler developers providing an extension--let standard C support interrupts. With the fact that a new keyword __interrupt is generated, the following code uses the __interrupt keyword to define an interrupt service subroutine (ISR), please comment on this code, find out the error and correct it. Please point out the problem:

__interruptdouble Compute_area (double radius)

{

Double area = PI * radius * RADIUS;

printf ("area =%f", area);

return area;

}

1, ISR can not pass parameters, must use void;

2, ISR should be short and efficient, so it is not recommended to do floating point in the ISR, should only be sent by the interrupt message or set the flag and then by the application layer to handle other work;

3, the ISR should not have re-entry and performance problems, so using the pintf () function is not good

11. How to implement a queue function with two stacks? Ask for the algorithm and ideas. 10 min

#include <iostream>

#include <stack>

Class Tmyqueue

{

Private

Stack<char> s1,s2;

Public

void push (char c)

{

while (!s2.empty ())

{

char x = S2.top ();

S2.pop ();

S1.push (x);

}

S1.push (c);

}

Char pop ()

{

char c;

while (!s1.empty ())

{

char x = S1.top ();

S1.pop ();

S2.push (x);

}

c = S2.top ();

S2.pop ();

return C;

}

BOOL Empty () const

{

Return S1.empty () && s2.empty ();

}

};

int main ()

{

Tmyqueue Q;

int i;

Char buf1[4] = "one";

Char buf2[4] = "both";

Char buf3[6] = "three";

for (i = 0; i < 3; i++)

Q.push (Buf1[i]);

for (i = 0; i < 3; i++)

Q.push (Buf2[i]);

for (i = 0; i < 3; i++)

cout << Q.pop ();

cout << Endl;

for (i = 0; i < 5; i++)

Q.push (Buf3[i]);

while (!q.empty ())

{

cout << Q.pop ();

}

cout << Endl;

return 0;

}

Android engineer Written--2015--Wave Guide Company

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.