当前位置:天才代写 > CS代写 > 软件开发考试代写 ECSE 202代写

软件开发考试代写 ECSE 202代写

2022-08-15 15:33 星期一 所属: CS代写 浏览:139

软件开发考试代写

ECSE 202 Introduction to Software Development

Final Examination

软件开发考试代写 INSTRUCTIONS: (Examples) This is a CLOSED BOOK examination. This is a MULTIPLE CHOICE examination. Mark your answers to the multiple-choice

INSTRUCTIONS: (Examples)  软件开发考试代写

  • This is a CLOSED BOOK examination.
  • This is a MULTIPLE CHOICE examination.
  • Mark your answers to the multiple-choice questions on the enclosed computer sheet using PENCIL ONLY. Each question is worth 1.5 marks, a wrong answer will receive 0.
  • You are permitted REGULAR AND TRANSLATION dictionaries.
  • STANDARD CALCULATOR permitted ONLY.
  • This examination consists of two parts. The first contains 40 multiple-choice questions; the second consists of 3 written programming questions.

 

TEST QUESTIONS

PART 1    软件开发考试代写

This part consists of 40 multiple-choice questions. Indicate the correct answer to each question on the computer readable sheets provided.

Question 1

What is the correct order of traversal for a binary tree such that nodes are visited in sort order (least to greatest)?

a) right-root-left b) left-root-right c) root-left-right d) root-right-left e) None of the above

Question 2

Which of the following describes the role of a linker?

a) Translates high-level program code into machine instructions.

b) Assembles compiled code and referenced library code into an executable program.

c) The method used by the Java list class to construct linked lists.

d) The method that assigns Java Interactors to event listeners.

e) None of the above

Question 3   软件开发考试代写

What is a thread?

a) A segment of code that operates sequentially to a main program.

b) A segment of code initiated from a main program.

c) A segment of code that operates concurrently with a main program.

d) A segment of code that is completely independent of a main program.

e) None of the above

Question 4

What is the key construct provided in Java to support implementation of event-driven programs?

a) Polling methods b) Listener classes c) Exceptions d) Inheritance e) Out of order execution

Question 5   软件开发考试代写

Consider the following Java implementation of the factorial function:

public static int fact (int i) {
    if (i < 2) return 1;
    return i * fact(i-1);
}

Which of the following statements is false?

a) If fact is called with i=n, it will call itself n-1

b) The recursive form of fact is potentially slower than its for loop counterpart.

c) The example shown has a bug – recursive functions cannot be declared static.

d) The example shown will fail for large values of i.

e) All of the above are true.

Question 6

Which of the following best describes the characteristics of an event-driven program?

a) Program flow is determined by events such as user actions, sensor outputs, or messages from other programs/threads.

b) Any program that involves asynchronous events.

c) Any program that incorporates a Graphical User Interface.

d) Any program that makes use of the acm

e) None of the above

Question 7   软件开发考试代写

What is the minimum size of memory required to represent the following data structure in “C”?

struct thing {
     char name[10];
     union {
          double width;
          int label;
          char type[5];
     } u;
     int weight;
};

a) 31 b) 27 c) 35 d) 20 e) 22

Question 8

A particular machine uses 14 bits to represent signed integers. What is the range of decimal numbers that can be represented using this scheme?

a) [-32768, 32767] b) [-16384, 16383] c) [-8192, 8191] d) [-4096, 4095] e)[-2048, 2047]

Question 9   软件开发考试代写

What is the hexadecimal representation for the binary number 1010100110101?

a) 1535 b) A9A1 c) 12465 d) 5429 e) None of the above

Question 10

Which of the following is not a member of the wrapper class?

a) Double b) Short c) Integer d) Float e) Char

Question 11 

What is meant by the term layered abstraction?

a) Refers to methods inherited from the immediate superclass.

b) Refers to the fact that the methods associated with a particular class may be inherited from different levels within the class hierarchy.

c) The property of a class that hides implementation details from the user.

d) The property of a class that allows it to export selected methods while keeping others hidden.

e) None of the above

Question 12   软件开发考试代写

The Rational class example covered during the course has 2 instance variables of type int corresponding to the numerator and denominator respectively. Consider the following:

public void run() {
     Rational a = new Rational(1,2);
     Rational b = new Rational(1,3);
     Rational b = new Rational(1,6);
     Rational sum = a.add(b).add(c);
}

Assuming the overhead of representing an object in memory is negligible, how many bytes of memory are allocated on the heap and stack respectively on execution of the last statement in run()? You may assume that object references require 4 bytes.

a) 32,16 b) 32,12 c) 40,16 d) 40,12 e) 48,20

Question 13

A particular machine represents integers using a width of 12 bits. What would be the corresponding decimal interpretation of an integer whose binary value is 9A716 under this scheme?

a) 2471 b) -2471 c) -1625 d) -423 e) None of the above

Question 14   软件开发考试代写

What is the primary distinction between a keyboard or mouse event and an action event?

a) Java does not draw distinction between different event types.

b) Keyboard and mouse events are derived from a virtual interface; action events are generated directly.

c) Keyboard and mouse events are generated by device (physical) signals (interrupts). Action events are generated by classes managing virtual devices.

d) Keyboard and mouse listeners deliver messages faster than action listeners.

e) None of the above

Question 15

A binary tree is constructed for the input sequence {4, -21, 35, -9, 4} with corresponding nodes {obj 1, obj 2, obj 3, obj 4, obj 5}. What are the left and right sub-nodes corresponding to obj 3 (35)?

a) obj 5, null b) null, null c) null, obj 4 d) obj 2, obj 3 None of the above

Question 16   软件开发考试代写

What is the purpose of surrounding an input/output operation with a try-catch-throw block?

a) To enable an automatic retry of the offending operation.

b) To enable one to either deal with an error condition, or pass it on to be handled elsewhere.

c) To automatically close the file on error to prevent corruption.

d) To allow the program to automatically search for an alternate file.

e) None of the above

Question 17

A sorting program is implemented on the “C” language to sort large data records. Which of the following will have the greatest impact on program speed?

a) The data types constituting the struct that holds the records.

b) Using arrays instead of linked lists to hold the data.

c) Using linked lists instead of arrays to hold the data.

d) Moving pointers instead of copying structs in exchanges.

e) Using maximum optimization in the compiler settings.

Question 18   软件开发考试代写

What would be the complexity of a radix style sort if the number of bins corresponds to the largest number being sorted?

a) O(1) b) O(N²) c) O(log N) d) O(N log N) e) O(N)

Question 19

What is a bucket array in the context of a Hash Code?

a) Stores hash entries indexed by hash code, with one entry per bucket.

b) Used to implement an array of linked lists, indexed by hash code.

c) Guarantees a search complexity of O(1) regardless of bucket array size.

d) An array for storing hash entries sized to the maximum number of indices of the given hash code.

e) None of the above

Question 20   软件开发考试代写

Consider the “C” and Java implementations of the pop()function from Assignments 3 and 4 respectively. Which of the following best describes the key difference between the two implementations?

a) There is no significant difference; both implementations perform identical steps.

b) The “C” implementation is an order of magnitude faster than its Java

c) The “C” implementation requires fewer lines of code.

d) The Java implementation results in a significantly more compact data structure.

e) The “C” implementation must explicitly delete the node being popped.

Question 21

Which of the following statements is true?

a) In most implementations, a Java Virtual Machine is necessary to run Java

b) Java programs can directly access the physical resources of a computer.

c) “C” programs are always faster than their Java counterparts.

d) “C” programs are always smaller than their Java counterparts.

e) None of the above

Question 22   软件开发考试代写

Consider the following snippet of code:

int A[]={1,2,3,4,5};
int i=2;
A[++i]+=1;

What are the contents of A after execution?

a) 1 2 3 4 5 b) 1 2 4 4 5 c) 1 3 3 4 5 d) 1 2 3 5 5 e) None of the above

Question 23

Consider the following snippet of “C” code that allocates a 2D array of dimensions p[N_ROWS][N_COLS]:

int *p[N_ROWS];
for (i=0;i<N_ROWS;i++)
     p[i]=malloc(sizeof(int)*N_COLS);

Which of the following is true?

a) Memory is contiguous across rows.

b) Memory is contiguous across columns.

c) The entire array spans a contiguous block of memory.

d) This is the only way in which memory can be allocated on a small computer.

e) None of the above

 

软件开发考试代写
软件开发考试代写

 

Question 24   

Consider the snippet of “C” code below:

int a=17;
int b=31;
int *pa=&a;
int *pb=&b;
int *t;
t=a;
a=b;
b=t;
printf(“a=%d b=%d\n”,*pa,*pb);

What values are printed for a & b (assuming this is embedded in a proper program)?

a) a=17 b=31 b) a=17 b=17 c) a=31 b=17 d) a=31 b=31 e) None of the above

Question 25

What value is printed by the following snippet of “C” code:

#include <stdio.h>
int main() {
  char x = 0x24;
  x=x<<2;
  printf(“%d\n”,x);
}

a) 144 b) 72 c) -72 d) -16 e) -112

Question 26  软件开发考试代写

Consider the following snippet of “C” code:

for (i=0;i<length;i++)
     push(string[i]);
for (i=0;i<length;i++)
     string[i]=pop();

If String is initially set to “1 2 3 4 5”, what would be its value after execution of this code?

a) “1 2 3 4 5” b) “1 2 3 4 5 4 3 2 1” c) “54321” d) “5 4 3 2 1” e) None of the above

Question 27

What does the following program do?

#include <stdio.h>
int main() {
  char *string=get_message();
  printf(“%s”,string);
  return 0;
}
char *get_message() {
  char msg[] = “Hello 202\n”);
  return msg;
}

a) Prints arbitrary text data.

b) Prints Hello 202 terminated by a line feed.

c) This code will not compile.

d) Executes an infinite loop.

e) None of the above

Question 28  软件开发考试代写

Which of the following evaluates to false in a “C” if statement for all values of i?

a) i & !ib) i ^ !i c) i | !i d) All of the above e) None of the above

Question 29

When is it preferable to use an ArrayList in place of an array?

a) When speed of operation is important, an ArrayList is always faster in execution than an array.

b) When the array is of a fixed size.

c) When multi-dimensional indices are required.

d) All of the above

e) None of the above

Question 30   软件开发考试代写

Which of the following operations replaces the 13th bit of a 16-bit integer with its complement? Assume that variable Z in the selections below represents this integer. (n.b. bits are numbered from right to left starting at 0).

a) Z!=0x2000; b) Z|=0x20f7; c) Z&=02000; d) Z^=0x2000; e) None of the above

Question 31

A particular machine represents integers using two’s complement with a width of 2 bytes.

Which of the following corresponds to a negative number under this scheme?

a) 5FD116 b) 804016 c) 793A16 d) 104016 e) None of the above

Question 32  软件开发考试代写

Consider the following expression written in either “C” or Java”

float a = 355 / 113;

If printed with 2 decimal places, what is the value that appears?

a) 14 b) 3.13 c) 3.15 d) 3.16 e) 3.00

Question 33

To confirm the expected complexity of a program, it is decided to time its execution with a stopwatch. It is observed that the program returns almost immediately when launched. What would you to obtain an accurate timing for this program?

a) Start watch. Run program in a loop for N iterations (where N is sufficiently large to average out the error). Stop watch and note total duration T. Run time = T / N.

b) Independently time each run with the stopwatch for a total of N runs. Run time = average of individual run times.

c) Insert a pause in the program of exactly 1 second duration. Record the program time with the delay added. Run time = Program time – 1 second.

d) All of the above

e) None of the above

Question 34   软件开发考试代写

Which of the following statements is true regarding classes that implement the Map interface in Java?

a) Provides storage for <key, entry> pairs indexed by key.

b) Can be implemented in O(1) complexity using lookup tables.

c) Has an O(N) complexity when implemented using parallel arrays.

d) Has an O(log N) complexity if parallel arrays sorted by key entry and binary search are used.

e) All of the above

Question 35

What is the value of x in the expression below?

x = 3 + 4 << 2 + 1

a) 20 b) 56 c) 29 d) 35 e) None of the above

Question 36   软件开发考试代写

Which of the statements below best describes the difference between passing an object as a method argument and passing a primitive data type as a method argument?

a) No difference. In both cases the data values corresponding to each argument are copied to the method.

b) No difference. In both cases references to the locations of the respective arguments are copied to the method.

c) In the case of an object, all of its values are copied to the method, whereas for a primitive, a reference is copied.

d) In the case of an object, a reference to the location of the object is copied to the method, whereas for a primitive, the value is copied.

e) None of the above

Question 37

Consider the following program:

#include <stdio.h>
int main() {
  int i,s=0;
  for (i=0;((i<5)||((s+=1)<=5)); i++)
    printf(“s=%d\n”,s);
}

How many times is the printf statement executed?

a) 5 b) 1 c) 9 d) 10 e) None of the above

Question 38   软件开发考试代写

Which of the following is a plausible method for monitoring several sensors with large differences in response time. Assume that none of these sensors is capable of generating exceptions/interrupts.

a) Continuously poll all sensors in a single loop.

b) Set up an appropriate listener with specific code for each sensor.

c) Create a class for each sensor that polls the sensor individually.

d) Accept the fact that response will be limited by the slowest response.

e) Create a class for each sensor that polls the sensor individually. Make this class an extension of the thread class with the appropriate structure.

Question 39

What is the purpose of a hash function?

a) Creates a random number from an integer index for lookup in a bucket array.

b) Generates a universal index for any object type in Java, 64-bits in length.

c) Implements a mapping between data of arbitrary size to data of fixed size.

d) Implements a mapping between data of arbitrary size to data of fixed size that is unique for any input data.

e) None of the above

Question 40

Which of the following represents a valid method for executing a class as a thread?

a) Execute a call to System.class.thread();

b) All classes execute as threads in Java.

c) Include a class that is a member of the thread class.

d) Make sure the class extends the thread class and provide an appropriate run() method.

e) None of the above

 

PART 2    软件开发考试代写

Answer all problems in the space provided

Problem 1 (10 Points)

Write a command line program in “C”, sortToken, that reads in a set of tokens and prints them out in alphabetical order, one token per line subject to the following:

  1. You should verify that the command line contains at least one token.
  2. Your program should conform to the following examples:
% sortToken
Error: no tokens present.
% sortToken e d c b a
a
b
c
d
e
%

You may assume that the following string sorting function is available:

void sortString(int array_length, char *string_array[]);

Hint: remember that argv[0] should not be included in the sort.

Problem 2 (10 Points)

Write a command line program, SOD, in Java that computes the sum of digits for a single integer argument > 0, subject to the following:

  1. The program must check for a correct argument.
  2. It must print out according to the examples below.
  3. It must include a method, doSOD(int i), that computes the sum of digits recursively.

Examples:

java SOD
Error: argument is missing.
java SOD 0
Error: 0 is an invalid argument.
Java SOD 3
Sum of digits of 3 is 6.

Hint: in case you’ve forgotten, it’s

public static void main(String[] args)

Problem 3 (20 points)   软件开发考试代写

Write a command line program, Reverse, in Java that reads all the tokens on the command line and prints them out in reverse order subject to the following:

  1. You will create a Stack class that implements void push(String arg) and String pop(). Memory must be allocated dynamically using a linked list (you may not use the Java LinkedList class).
  2. Each token in args[] will be pushed onto the stack from left to right.
  3. Each element of the stack will then be popped and printed on the output.
  4. You may assume that there is at least one token present, so it is not necessary to check the input.

Example:

java Reverse this is my input
input my is this

 

软件开发考试代写
软件开发考试代写

 

更多代写:数据库代考  托福家庭版  英国数学代上网课   市场营销essay代写  数量论文代写  Web程序代做代写

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式