Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 24 pages
Exam (elaborations)

Computer Engineering 2

Document preview thumbnail
Preview 3 out of 24 pages

Computer Engineering 2

Content preview

1. The binary representation of the decimal number -6 in 8-bit two's complement is:

A. 11111010

B. 10000110

C. 11111001

D. 10000011

Answer: A) 11111010

Rationale: The two's complement of -6 in 8-bit binary is 11111010. First, write 6 in

binary (00000110), then invert the bits (11111001), and finally add 1 (11111010).




2. What is the largest number that can be represented by a 4-bit binary number?

A. 15

B. 16

C. 14

D. 17

Answer: A) 15

Rationale: A 4-bit binary number can represent values from 0000 (0 in decimal) to

1111 (15 in decimal). So, the largest value is 15.




3. What is the time complexity of bubble sort?

A. O(n)

,B. O(n^2)

C. O(log n)

D. O(n log n)

Answer: B) O(n^2)

Rationale: Bubble sort compares adjacent elements and swaps them if needed. This

process is repeated for each element, resulting in a time complexity of O(n^2).




4. Which data structure is best suited for implementing a priority queue?

A. Array

B. Stack

C. Heap

D. Queue

Answer: C) Heap

Rationale: A heap is an efficient data structure for implementing a priority queue

because it allows quick access to the highest (or lowest) priority element.




5. The worst-case time complexity of quicksort is:

A. O(n log n)

B. O(n^2)

C. O(n)

D. O(log n)

Answer: B) O(n^2)

, Rationale: In the worst case, when the pivot selection is poor, the quicksort algorithm

has a time complexity of O(n^2).




6. In binary arithmetic, what is the result of 1101 + 1011?

A. 11000

B. 11010

C. 10111

D. 10000

Answer: A) 11000

Rationale: The binary addition of 1101 and 1011 is as follows:

markdown

Copy

1101

+ 1011

-------

11000




7. The main function in C programming language is called:

A. void()

B. main()

C. start()

D. entry()

Document information

Uploaded on
March 16, 2025
Number of pages
24
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
CA$15.83

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
douglasmugwe82
5.0
(1)
Sold
2
Followers
0
Items
4239
Last sold
11 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions