Embedded Software test questions (C language) V1.0

Source: Internet
Author: User
Tags modifier mutex

Embedded Software test questions ( C language) V1.0

following - a choice question, each question may have one or more correct answers, please find all the correct answers in the parentheses corresponding to each question. Multiple selection, wrong choice, missing or not selected, are not divided. 2 points per question. Total of.

In order to shorten the space and save everyone's time, the code in the question may not be the complete code, do not consider whether the code can be compiled and executable, just analyze the code itself.

1. Define an array int a[2] = {1,3}, then the value of A is (D)

A, 0; B, 1; C, 3; D, uncertain;

2, have the following code:

float a = 123.45678;

if (123.45678 = = a)

{

printf ("a = 123.45678");

}

else if (123.45678 > a)

{

printf ("a > 123.45678");

}

else if (123.45678 < a)

{

printf ("A < 123.45678");

}

Else

{

printf ("not sure");

}

Can you tell me the result of the above code output is (ABC)

A, a = 123.45678; B, a > 123.45678; C, a < 123.45678; D, uncertain;

3, run the following code on a 32-bit PC, the result may be (C)

int *a = NULL;

Char B[8] = {0};

printf ("sizeof (a) =%d,sizeof (b) =%d", sizeof (a), sizeof (b));

A, sizeof (a) = 2,sizeof (b) = 2; b, sizeof (a) = 4,sizeof (b) = 4;

C, sizeof (a) = 4,sizeof (b) = 8; D, sizeof (a) = 8,sizeof (b) = 8;

4. After running the following code, which values can be the value of the variable x (AC)

X = Y ^ 0x80;

x = x & 0xF0;

A, 0xF0, B, 0x0F, C, 112

5. After running the following code, which values can be the value of the variable R (BCD)

int A;

.../* Ignore some code here */

R = (a+1)% 0xABCD;

A, 0xABCD, B, 0, C, N, D, 1024;

6, code "const int A[2] ={5, 2};" The function of medium const is (BD)

A, modifier A; B, modifier {5, 2};

C, stating that A is read-only; D, stating that the contents stored in array A are read-only;

7, the meaning of the keyword "NULL" is (C)

A, uninitialized pointer, B, undefined pointer;

C, null pointer; D, integral type "0";

8, the following code may be the role of (C)

int A, B;

.../* Ignore some code here */

A = a ^ b;

b = a ^ b;

A = a ^ b;

A, A, B and B, judge the size of a, b relationship;

C, Exchange A, B value; D, the value of the encryption A, B;

9. If the variable is defined in a 32-bit system with a large-endian (Big big): "unsigned long testcpuarchitecture = 0x12345678;", then "* (unsigned char*) & The value of Testcpuarchitecture "should be (A)

A, 0x12; B, 0x34; C, 0x56; D, 0x78

10. In a 32-bit system with the following code, the values of sizeof (a_bit_t) and sizeof (BITMAP) are (B)

typedef unsigned char uint8;

typedef struct{

Uint8 bit:1;

}a_bit_t;

a_bit_t bitmap[16] = {0};

A, B, 1,16; C, 4,2; D, 4, 16;

11, a pointer is defined as: "char *ptr = NULL;", then the following statements are correct (AB)

A, the pointer points to the content can be modified;

B, the value of the pointer itself can be modified;

C, the location of the pointer itself can be modified;

D, pointers can only point to a storage location where characters are stored;

12, a function if there is no "return" statement, then this function will (D)

A, has been infinitely cyclic operation, B, may be in any sentence at the exit;

C, at any time may crash; D, exit after the completion of the operation;

13, macro definition has the characteristics (ABD)

A, can be called by multiple functions, B, there may be side effects;

C, the operation efficiency is higher than the definition function, D, after multiple calls occupy more code storage space than the function;

14. In a "while" loop, the number of allowed "break" and "continue" is (D)

A, the two can only use one, each can only use one time;

B, break can be used multiple times, continue can only once;

C, break can only be used once, continue can be many times;

D, both are not limited to the number of times;

15, the following is the function of the Static keyword (ABC)

A, modifying local variables, indicating that this variable can only be accessed within the current function, which is stored outside the heap and stack;

B, modifier function, indicating that this function can only be accessed within the current file;

C, modify the global variable, indicating that this variable can only be accessed within the current file;

D, the parameters of the modifier function, indicating that the entry is read-only and cannot be modified;

16, the following code after the end of the operation, I value is (B)

int i = 1;

Switch (i)

{

Case 0:

i++;

Break

Case 1:

++i;

Case 3:

i++;

Break

Case 4:

i++;

Default

++i;

}

A, 2 B, 3 C, 4 D, 5

17, in a 32-bit system has the following definition, then the value of sizeof (U) is (C)

Union {

char c;

Char *p;

}u;

A, 1 B, 2 C, 4 D, 8

18, "Wild Hands" is (BD)

A, undefined pointer, B, no assigned pointer;

C, the point of the address is determined, but the contents of which are unknown; D, the point of the address is an indeterminate pointer;

19, the role of IFNDEF...DEFINE...ENDIF in the header file is (B)

A, stating that this is a header file;

B, to prevent duplication of inclusion;

C, optimize the header file, so that it occupies less storage space;

D, define the name of the header file so that it can be referenced;

20. The following code, which lines are compile-time error or run-time exception (C)

1:char A;

2:char *str=&a;

3:strcpy (str, "Hello");

4:printf (str);

A, 1th Line; B, 2nd line; C, 3rd line; D, 4th line;

21, why the structure of the data passed to the inside of the function, it is recommended that the parameters of the function using struct pointer instead of structure (BD)

A, save the heap; B, save the stack; C, save the Code; D, more efficient operation;

22, in a 32-bit system has a two-way list, each linked list member holds three character information, a linked list member needs to occupy at least a few bytes of storage space (C)

A, 3, B, 9, C, N, D, 18

23, the data structure can be used to implement the circular queue can be (BC)

A, balanced binary tree; B, array; C, bidirectional linked list; D, conflict-free hash table

24, in the case of a large number of data members and the data content is more random, find a member of the average efficiency of the most efficient data structure is (D)

A, balanced binary tree; B, array; C, bidirectional linked list; D, conflict-free hash table

25, the last data into the stack stored in the stack (a)

A, top, B, Middle, C, bottom, D, can be any position;

26, assuming A = 100,b = 1000, then the following two for loop, which is more efficient (A)

A:

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

{

for (k=0; k<b; k++)

{

printf ("i=%d, k=%d\n", I, k);

}

}

B:

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

{

for (k=0; k<a; k++)

{

printf ("i=%d, k=%d\n", I, k);

}

}

A, A; b, b; C, the same; D, cannot be determined;

27, FIFO features are (B)

A, FIFO full time, will lead to confusion of member data;

B, the first member to enter the first out;

C, FIFO empty time, its internal all storage unit value is 0;

D, it and the stack are equivalent;

28, the common sorting algorithm has (AB)

A, Bubble method, B, insert method, C, Ergodic method, D, reverse method;

29, in an integer array with 1000 members, whose members are arranged from small to large, the fastest algorithm to find out if there is a value on average is (C)

A, ergodic method, B, stochastic method, C, dichotomy method, D, reverse method;

30, if an event needs to meet 5 conditions at the same time to run, then the use of the shape such as:

if (a && b && c && d && e)

{

...//Pending execution of the statement;

}

statement, the 5 conditions should be placed in what order. A

A, the occurrence probability from low to high arrangement; B, the probability of occurrence from high to low arrangement;

C, randomly placed; D, the probability of occurrence of the medium in the first place;

31. The following enumeration features are (AB)

A, can be defined as a data type; B, the enumeration value must be an integer;

C, enumeration values must be contiguous; D, enumerations and macro definitions are the same;

32, if a section of normal code appears an extra semicolon, shaped like:

jar = quart;

printf ("%d,", jar);

Jar = jar + PINT;

;

printf ("%d\n", jar);

Then this code will (D)

A, cannot compile pass; B, can compile through, but can not run;

C, can be compiled through, but the runtime may crash, D, without any impact;

33, the following paragraph of code, that is, after the IF statement more than a semicolon, then (CD)

if (a && b);

{

printf ("Hello word!\n");

}

A, no matter a, B is what value, will not print out "helloword!" ; B, cannot compile pass;

C, regardless of a, B is what value, will print out "helloword!" ; D, can be compiled through;

34. The problem with the following code is (BC)

char a = 0;

Char *p;

while (a < = 255)

{

p = malloc (100);

......

a++;

}

Free (p);

p = NULL;

A, there is A wild pointer, B, there is A memory leak, C, there is a cycle of death, D, there is no problem;

35, have the following code:

Enum LIQUID {ounce = 1,cup = 2,pint = 16,quart = +, gallon = 128};

Enum Liquid jar;

jar = quart;

printf ("%d,", jar);

Jar = jar + PINT;

printf ("%d\n", jar);

The printed content will be (C)

A, 0, B, 0, 0, C, +, D, 32, random value;

36, the following code problems exist (C)

typedef struct data_member_s{

struct data_member_s *p_nest;

int A;

int b;

Char c[4];

}data_member_t;

int main ()

{

data_member_t d = {. P_nest = NULL,. A = 1,. B = 2,. C = "ABCD"};

printf ("%d,%d,%s\n", D.A, D.B, D.C);

}

A, the structure of the definition is not correct; B, the structure of the initial error;

C, the printed statement may be error, D, there is no problem;

37, a function (CD)

A, must have the entry, B, must have the return value;

C, you can call yourself; D, the return value can be another function;

38, do{...} while () and while () {...} The features of the statement are (ACD)

A, the former will execute at least once {...} In the statement;

B, the latter may be a cycle of death, while the former will not;

C, two can use break to jump out;

D, both can use the Continue statement;

39, the following is

for (STATEMENT1;STATEMENT2;STATEMENT3)

{

.../* Loop body */

}

The characteristic of the statement is (D)

The three expressions of a, statement1, Statement2 and Statement3 cannot be empty at the same time;

B, for the operating efficiency than while high;

C, the For loop body cannot use the break statement;

D, the For loop body can use the Continue statement;

40. The following statement is correct (AB)

A, If...else ... Statements and Switch...case ... Statements can be nested with each other;

B, can use the switch statement of the scene can be used if...else ... The statement implementation of the class;

C, can use If...else ... The scenario of a class statement can be implemented with a switch statement;

D, in Switch...case ... The use of the continue statement in the body of the statement jumps to the switch head to restart execution;

41. In systems with n processes, the execution time of each process is averaged over a long period of time (D)

A, 1/n; B, 1/2n; C, 1/n2; D, indeterminate

42. The function of the process "time slice rotation" in the operating system is (C)

A, the system process and the application process rotation operation;

B, high-priority processes and low-priority processes running in turn;

C, rotation between the processes with priority;

D, process and interrupt rotation operation;

43. What are the ways to protect (ABCD) when cross-process global resource sharing

A, binary signal volume, B, counting system signal quantity;

C, shutdown process scheduling; D, close all interrupts;

44, when creating a process, the necessary parameters are (ABC)

A, the process available stack depth, B, process priority;

C, process entry function; D, the end time of the process;

45. When you protect a global resource with a kernel object that has no priority inheritance mechanism (such as a normal binary semaphore), it may cause (B) that a mutex (mutex) should be used.

A, can not effectively protect data integrity; B, process priority rollover;

C, process hangs; D, kernel crashes;

46. Two ways of interacting information between processes can have (ABC)

A, global variables; B, signal volume;

C, queue or pipeline; D, interrupt;

47. When the process of being suspended (suspend) resumes running (B)

A, the time-out is up; B, is aroused by another process or interrupt;

C, automatic at any time, D, wait until other processes are not running;

48, a process of stack space overflow may cause (a)

A, system crashes; B, process hangs; C, process is deleted; D, process is restarted;

49, if a high-priority process into the "dead loop", always occupy the CPU does not release, may cause (AB)

A, high CPU utilization, B, low-priority processes are not running;

C, the interruption is not executed; D, the process scheduler crashes;

50. If a process frequently requests dynamic memory (such as using malloc) and does not release it, it may cause (ABD)

A, other processes do not apply dynamic memory; B, the process does not apply to dynamic memory;

C, the process can not switch; D, dynamic memory exhaustion;

Embedded Software test questions (C language) V1.0

Related Article

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.