100% found this document useful (1 vote)
157 views2 pages

CSE 331 Final

The document is the final exam for an advanced programming course. It contains 4 questions testing different concepts: 1. Handling exceptions in code and synchronizing thread access to shared resources. 2. Implementing a dynamic list using a deque collection, creating two threads with different priorities, and deque methods. 3. Applying user-defined exceptions, creating a Course class with properties, and filtering Courses by credit hours in an ArrayList. 4. Finding the most frequently occurring character in a string and writing user input to a text file.

Uploaded by

BD Entertainment
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
157 views2 pages

CSE 331 Final

The document is the final exam for an advanced programming course. It contains 4 questions testing different concepts: 1. Handling exceptions in code and synchronizing thread access to shared resources. 2. Implementing a dynamic list using a deque collection, creating two threads with different priorities, and deque methods. 3. Applying user-defined exceptions, creating a Course class with properties, and filtering Courses by credit hours in an ArrayList. 4. Finding the most frequently occurring character in a string and writing user input to a text file.

Uploaded by

BD Entertainment
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Bangladesh University of Business & Technology (BUBT)

Department of Computer Science and Engineering


Final-term Examination: Summer 2021
Course Code: CSE 331 │Course Title: Advanced Programming
Intake: 42nd | Section: All | Shift: Day
Marks – 40

CO’s No. Questions Marks

CO2 1. a) 5

For the code segment above, what type of exception will the code throw? How can
we handle the exception? Explain with necessary code.

b) Suppose two different threads are running in the background and are trying to 5
access a single resource at the same time. How can we synchronize the accessing?
Explain with necessary code.

CO3 2. a) Write a program to insert 5 float values in dynamic list. Now take user input for a 5

variable named “option”. If option is 1 then insert another value. If option is 2


delete the top value from the list. If option is 3 just output the top value. Apply
dequeue collection to implement the solution for the situation and use proper
dequeue methods.

b) Write a program to create two threads. The 1st thread will print only the odd 5
numbers and the 2 thread will print only the even numbers. Make sure that the 1
nd st

thread gets more priority than the 2nd one while running concurrently.

CO3 3. Imagine you have to write a program in JAVA. In that program you have to input 5
a)
a string. If the string length is less than 8 then you want to show your own error
saying “Too small”. Otherwise show an output saying “All Okay”. Apply the user
defined exception mechanism.

Page 1 of 2
b) Create a class named Course which has the property named course_name(String), 5
course_code(String), course_credit(double) etc. The value of course_name,
course_code and course_credit will be initialized when we create an object of that
class. Make 5 object of Course class and add them into an ArrayList. Those
courses whose credit is over 1.5 will be shown in output. Complete the following
Program.

CO4 4 We will find out the character that gets repeated maximum times in a string. For 5
a)
example, in string “apple”, ‘p’ repeats maximum times. Write a program in Java to
find out the maximum repeated character in a string.

b) Write a code in Java to save user’s data in a file. The program will take input a 5
sentence from user using console and store the sentence in a text file input.txt.

Page 2 of 2

You might also like