Skipped: Question Number 1

From the following options, select the correct post-order representation of the expression:

(((( 2 + 1 ) * 3 ) / (( 9 - 5 ) + 2 )) - (( 3 * ( 7 - 4 )) + 9 ))

21+3*95-2+/74-3*6+-

21+3*95-2/+74-3*9+-

21+3*95-2+/74-3*9+-

21+3*95-2+/74*3-9+-

Skipped: Question Number 2

Given the following code snippet : void freeList( struct node *n ) { while( n ) { ???? } }

Which one of the following can replace ???? for the function above to release the memory allocated to a linked list? n = n->next; free( n ); struct node m = n;

free( n ); n = m->next; struct node m = n;

n = n->next; free( m ); struct node m = n; free( m ); n = n->next;

Skipped: Question Number 3

Which of the following options denotes the correct objective of the program given below? public static long find(long a, long b) { If (b==0) return a; else return find(b,a%b) } The greatest common divisor

The divisibility of a number

The largest number

The smallest number

Skipped: Question Number 4

Consider the following scenarios:

- An operating system having a list of processes that are waiting to get access of the CPU. - A list of jobs waiting to access the printer for printing.

From the following options, select the ideal data structure that can be used in these scenarios.

Linked List

Array

Queue Stack

Skipped: Question Number 5

Suppose a program is to read words from a file and look them up in a large dictionary, printing to the terminal the ones not found (perhaps because of misspellings). The programmer has decided to use two threads: one to read the words from the file and another to check them against the dictionary.

Which of the following are advantages of using threads, given a single-processor, single-core computer?

1 The two threads could execute in parallel, making the program run faster. 2 While the input thread is waiting for the operating system to deliver some input from the file the spell check thread could be doing some work.

answer 1

answer 2

Both 1 & 2

Neither 1 nor 2

Skipped: Question Number 6

Following good software development practices which of the following would be appropriate ways to handle attempts to add to a full queue or remove from an empty one?

1. have all code check whether the queue is full before attempting to add to it and whether it is empty before attempting to remove from it 2. have q.add print an error message if the queue is full and have q.remove print an error message if the queue is empty 3. have q.add raise (throw) an exception if the queue is full and q.remove raise an exception if the queue is empty (assuming the programming language supports exceptions)

answer #1

answer #2

answer #3

all are equally good

Skipped: Question Number 7

Consider an application that requires inserting and deleting data items in a data structure dynamically.

From the following options, select an appropriate data structure for this scenario.

Linked List

Array

Queue

Stack

Skipped: Question Number 8

The steps to search a Binary Tree are listed here, in an incorrect sequence.

A. Create a temporary variable pointing to the tree data structure. B. Loop through the tree elements. C. Search till the desired search value is not found or till the loop ends. D. Check for the search value. E. Set the variable to the head variable of the tree. Select the option that denotes the correct sequence of the steps.

A, E, B, D, and C

A, D, B, C, and E

B, A, D, E, and C

B, D, C, A, and E

Skipped: Question Number 9

What features must a programming language and its runtime environment provide in order to support automatic memory management?

1. dynamic memory allocation 2. explicit deallocation of data 3. garbage collection

1

2

3

1 and 3, but not 2

Skipped: Question Number 10

In a programming language with only two levels of operator precedence — unary binding tighter than binary — and left-to-right evaluation, what is the value of the following expression?

– 7 – – 5 * – 4 + 3 * 2

4

22 -21

-33

Question Number 1

In C++, polymorphic method calls have a very high overhead. Therefore, to reduce the overhead, C++ treats all its method calls as non-polymorphic. From the following options, select the speak() method declaration of the Dog class in the given code snippet, so that the method is treated as polymorphic. class Animal { public: Animal(const string& name) : name(name) { } const string speak() = 0; const string name; }; class Dog : public Animal { public: Dog(const string& name) : Animal(name) { } const string speak() { return "Bhowww!"; } }; virtual const string speak() = 0; virtual const string speak() { return "Bhowww!"; } poly const string speak() = 0; poly const string speak() { return "Bhowww!"; } special const string speak() = 0; special const string speak() { return "Bhowww!"; } friend const string speak() = 0; friend const string speak() { return "Bhowww!"; }

Question Number 2

Select the OOP concept described by the following features:

A. Defines the abstract characteristics of a thing (object). B. Defines attributes of the thing. C. Defines the behavior of the thing. D. Represents a blueprint describing the nature of the thing.

Class

Function

Method

Instance

Question Number 3

Select the sorting that always has a time complexity O(n2), irrespective of the condition of the array.

Bubble sort

Selection sort

Merge sort

Quick Sort

Question Number 4

XYZ Inc. has developed a training center automation system. The system allows students to enroll for various courses and appear for the respective exams.

Students enroll for one or more diplomas. The Diploma class contains a member class named DiplomaStructure that describes the courses relevant for that diploma.

Select the appropriate relationship between the two abstractions: Diploma and DiplomaStructure.

Aggregation Association

Using

Inheritance

Question Number 5

From the following options, select the correct Big O notation for the given factorial code: public static int factorial(int i) { int x; int y; x = 1; for (y= 2 ; y <= i ; y++) x = x * y; return x; } O(n)

O(2n)

O(log2 n)

O(n log n)

Question Number 6

Let us consider a class Animal with talk() method. There are two child classes; Cat and Pig, which are inherited from the Animal class. A cat produces a Meow sound and a Pig produces an Oink sound. Though both the child classes inherit the talk method from their base class, they must have their own derived class methods to differentiate between the animal sounds.

Select the option that best describes the OOP concept applicable to this scenario. Overloading Polymorphism

Overriding Polymorphism

Derived Polymorphism

Pure Polymorphism

Question Number 7

From the following options, select the OOP mechanism, that allows treatment of the derived class members just like the members of their parent class.

Polymorphism

Encapsulation

Abstraction

Decoupling

Question Number 8

XYZ Inc. has developed a training center automation system. The system allows students to enroll for various courses and appear for the respective exams.

The system contains two primary abstractions: Student and Exam. An exam can be taken by many students; a student can take many exams. From the following options, select the appropriate relationship that best describes this scenario.

Aggregation

Association

Using Inheritance

From the following options, select the correct Big O notation for the given code snippet:

int search( int str[],int i, int input) { int lownum=0, highnum=n-1; while (lownum<=highnum) { int midnum=(lownum+highnum) / 2; if (str[midnum] == input) return midnum; else if (input < str[midnum]) highnum=midnum-1; else lownum=midnum+1; } return -1; } O(n)

O(log2 n)

O(n2)

O(n log n)

Question Number 10

Select the option that shows the correct matching between the function types and the Big O descriptions.

I Constant 1 O(log n) II Logarithmic 2 O(1) III Linear 3 O(n) IV Quadratic 4 O(n3) V Cubic 5 O(2n) VI Exponential 6 O(n2) (I,2),(II,1),(III,3),(IV,6),(V,4),(VI,5)

(I,3),(II,5),(III,4),(IV,6),(V,2),(VI,I)

(I,5),(II,6),(III,2),(IV,1),(V,4),(VI,3)

(I,1),(II,2),(III,3),(IV,4),(V,5),(VI,6)

Question Number 1

Which of the following is NOT a referential integrity issue in a relational database where the DEPT column of the EMPLOYEE table is designated as a foreign key into the DEPARTMENT table?

deleting a row of DEPARTMENT

inserting a new row into EMPLOYEE with a DEPT whose value is not the primary key of any of the rows in DEPARTMENT inserting a new row into DEPARTMENT with a primary key that is not the value of the DEPT column of any row in EMPLOYEE updating the value of DEPT in a row of EMPLOYEE with a value that is not the primary key of any of the rows in DEPARTMENT

Question Number 2

Select the option that does NOT narrate a normalization principle.

Decomposition should stop immediately when all relation variables are in 5NF. Decomposition should not preserve dependencies.

Every projection should be involved in the reconstruction process. A non-5NF relation variable should be split into a set of 5NF projections.

Question Number 3 Select the option that correctly describes the database replication concept where two or more replicas synchronize each other through a transaction identifier.

Master-Slave

Multimaster

Quorum

Multimasterslave

Question Number 4

You have two relation variables: RelV1 and RelV2. They are not necessarily distinct. You have a set K as a key for RelV1. Consider that FK is a subset of the heading of RelV2 that involves exactly the same attributes as K.

From the following options, select the option that correctly depicts a scenario where FK can be considered as a foreign key.

Every tuple in RelV2 has a FK value that is equal to the K value in some tuple in RelV1. Every tuple in RelV1 has a K value that is equal to the FK value in some tuple in RelV2. Every tuple in RelV2 has a K value that is equal to the FK value in some tuple in RelV1. Every tuple in RelV1 has a FK value that is equal to the K value in some tuple in RelV2.

Question Number 5

Which of the following is NOT guaranteed by transactions in a database system?

Changes made to data during the transaction are not visible to other processes until the transaction completes. Integrity constraints defined in the database schema are satisfied once the transaction completes. All of the changes made to data during a transaction will be permanently stored in the database. While one process is modifying some data within a transaction, a second process must wait until the first completes its transaction before making its own modifications to that data.

Question Number 6

ABC Housekeeping Forces are responsible for maintaining a building that comprises of 100 floors. The maintenance company decides to use a database to schedule work for its employees and also check the status of the work. When an assigned housekeeper does not report for work, an alternate resource is allotted to complete the job.

The Housekeeping database in its current form is given below:

Housekeeper HouseKeeperID HouseKeeperName HouseKeeperSSN SupervisorID

Supervisor SupervisorID SupervisorName SupervisorSSN

Floor FloorNo FloorName

Transaction FloorNo DutyDate HouseKeeperID WorkStatus

AlternateTransaction FloorNo DutyDate AlternateHID AlternateWorkSt Select the option that correctly lists the foreign keys for the different entities. Note that the entity names are given in bold.

Housekeeper – HousekeeperSSN Supervisor – SupervisorSSN Transaction – HousekeeperID AlternateTransaction – AlternateHID Housekeeper – HousekeeperID Supervisor – SupervisorID Floor – FloorNo or FloorName Transaction – FloorNo AlternateTransaction – FloorNo Housekeeper – SupervisorID Transaction – HousekeeperID AlternateTransaction – AlternateHID Housekeeper – SupervisorID Supervisor – HousekeeperID Transaction – HousekeeperID AlternateTransaction – AlternateHID

Question Number 7

ABC Housekeeping Forces are responsible for maintaining a building that comprises of 100 floors. The maintenance company decides to use a database to schedule work for its employees and also check the status of the work. When an assigned housekeeper does not report for work, an alternate resource is allotted to complete the job.

The Housekeeping database in its current form is given below:

Housekeeper HouseKeeperID HouseKeeperName HouseKeeperSSN SupervisorID

Supervisor SupervisorID SupervisorName SupervisorSSN Floor FloorNo FloorName

Transaction FloorNo DutyDate HouseKeeperID WorkStatus

AlternateTransaction FloorNo DutyDate AlternateHID AlternateWorkSt

Select the option that correctly lists the single field primary keys for the various entities. Note that the entity names are given in bold.

Housekeeper – HousekeeperID Supervisor – SupervisorID Transaction – FloorNo AlternateTransaction – FloorNo Housekeeper – HousekeeperID Supervisor – SupervisorID Floor – FloorNo Housekeeper – HousekeeperID Supervisor – SupervisorID Floor – FloorNo Transaction – FloorNo AlternateTransaction – FloorNo Housekeeper – HousekeeperID Supervisor – SupervisorID Floor – FloorNo Transaction – FloorNo

Question Number 8

ABC Housekeeping Forces are responsible for maintaining a building that comprises of 100 floors. The maintenance company decides to use a database to schedule work for its employees and also check the status of the work. When an assigned housekeeper does not report for work, an alternate resource is allotted to complete the job.

The Housekeeping database in its current form is given below:

Housekeeper HouseKeeperID HouseKeeperName HouseKeeperSSN SupervisorID

Supervisor SupervisorID SupervisorName SupervisorSSN

Floor FloorNo FloorName

Transaction FloorNo DutyDate HouseKeeperID WorkStatus

AlternateTransaction FloorNo DutyDate AlternateHID AlternateWorkSt

Select the option that correctly lists the composite primary keys for the various entities. Note that the entity names are given in bold.

Housekeeper – HousekeeperSSN Supervisor – SupervisorSSN Floor – FloorNo Transaction – FloorNo, DutyDate, AlternateHID AlternateTransaction – FloorNo, DutyDate, HouseKeeperID Housekeeper – HousekeeperID Supervisor – SupervisorID Floor – FloorNo Transaction – FloorNo, DutyDate, AlternateHID AlternateTransaction – FloorNo, DutyDate, HouseKeeperID Housekeeper – HousekeeperID Supervisor – SupervisorID Floor – FloorNo Transaction – FloorNo AlternateTransaction – FloorNo Transaction – FloorNo, DutyDate, AlternateHID AlternateTransaction – FloorNo, DutyDate, HouseKeeperID

Question Number 9

ABC Housekeeping Forces are responsible for maintaining a building that comprises of 100 floors. The maintenance company decides to use a database to schedule work for its employees and also check the status of the work. When an assigned housekeeper does not report for work, an alternate resource is allotted to complete the job.

The Housekeeping database in its current form is given below:

Housekeeper HouseKeeperID HouseKeeperName HouseKeeperSSN SupervisorID

Supervisor SupervisorID SupervisorName SupervisorSSN

Floor FloorNo FloorName

Transaction FloorNo DutyDate HouseKeeperID WorkStatus

AlternateTransaction FloorNo DutyDate AlternateHID AlternateWorkSt

Select the option that correctly lists the unique keys for the various entities. Note that the entity names are given in bold and the options join multiple unique keys with the "/" symbol.

Housekeeper – HousekeeperID / HousekeeperSSN Supervisor – SupervisorID / SupervisorSSN Floor – FloorNo or FloorName Housekeeper – HousekeeperID Supervisor – SupervisorID Floor – FloorNo Transaction – FloorNo AlternateTransaction – FloorNo Housekeeper – HousekeeperID / HousekeeperSSN Supervisor – SupervisorID / SupervisorSSN Floor – FloorNo or FloorName Transaction – FloorNo AlternateTransaction – FloorNo Housekeeper – HousekeeperSSN Supervisor – SupervisorSSN Transaction – FloorNo AlternateTransaction – FloorNo

Question Number 10

Select the option that represents the definition of network database model.

Organizes the data in the form of a tree of records, with each record having one parent record and many children records. Allows each record to have multiple parent and child records, thereby forming a lattice structure. Represents the entire information content of the database in only one way. Attempts to bring closer interactivity between database administrators and application programmers. When Will I Receive My Scores?

You will receive an email with information about your scores on: Dec 6, 2010

Discuss Your Experience

 How would you rate this exercise? Easy (1) through Extremely Difficult (5)

1

2

3

4

5

 How well do you think you performed? Poorly (1) through Extremely Well (5)

1

2

3

4

5

可再次测验: 04 2 月 Dog Communication

Dogs, like humans, have a complex communication system that features gestures and actions that have several meanings depending on the context of the behavior. Therefore the study of ethology, or the science of animal behavior, is not an exact science but rather one of common generalities. Just as humans may smile or hug or stand in certain ways for various reasons, so too dogs and other animals use gestures for many different reasons.

One of the primary means through which dogs express their emotions is the movement of their tails. Different breeds tend to carry their tails at different heights, but one can determine a dog's mood by how high or low they are carrying their tail at a particular moment. A tail held high shows that the dog is alert, while a tail between the dog's legs signals a feeling of fear. Fur bristled on the tail indicates that the dog is ready to defend itself , while slow, small wags may mean that the dog is questioning something. Fast tail wagging typically indicates that the dog is excited or happy. Tail wags that include the movement of the dog's hips is a sign of submission to a human or another dog that is viewed as the pack leader. In cases where a dog has lost all or part of its tail, they may compensate for their loss by wagging their entire rear end.

Another significant method through which dogs communicate is the showing of their teeth. Dogs can show their teeth as a means of expressing submission or aggression. Snarling and showing both the back and front teeth is generally a sign of aggression. It is a signal not to come further or the dog will attack in order to defend itself. A "smiling" dog will typically show only their front teeth.

This article, as modified and translated by PAC, is licensed under the GNU Free Documentation License and is governed exclusively by the rights and terms of this license. This article uses material from the Wikipedia article Dog communication," (http://en.wikipedia.org/wiki/Dog_communication)