BCC Assistant Programmer 2021 Full Question Solution - Exam Taker BUET

1.      Answer the following:



(i), Find subnet mask.

(ii), Find Network Address.

(iii), Find IP Address of the first host?

(iv), Find IP Address of the last host?

(v), Find Broadcast Address.


2.       In Linux, History is a very useful command to show you all of the last commands that have been recently used. Grep is a Linux command-line tool used to search for a string of characters in a specified file. Write grep and history command to find previous commands in Linux.


history | grep -i searchterm

3.      Both the algorithm the Divide and Conquer and Dynamic Programming solve a problem by breaking it  into smaller problem instances and by solving them. What are the difference between there two techniques?


Divide & Conquer Method

Divide & Conquer Method

It deals (involves) three steps at each level of recursion:

Divide the problem into a number

of subproblems.


Conquer the subproblems

by solving them recursively.


Combine the solution to the subproblems

into the solution

for original subproblems.

It involves the sequence of four steps:

Characterize the structure

of optimal solutions.


Recursively defines the values

of optimal solutions.


Recursively defines the values

of optimal solutions.


Compute the value of optimal

solutions in a Bottom-up minimum.

It is Recursive.

It is non Recursive.

It does more work on subproblems and hence

has more time consumption.

It solves subproblems only once and then

stores in the table.

It is a top-down approach.

It is a Bottom-up approach.

In this subproblems are independent of

each other.

In this subproblems are interdependent.

For example: Merge Sort & Binary Search


For example: Matrix Multiplication.



4.      Find the Output of following C Program:


int function (int x[], int i) {

int s = x[i];


s += function (x, i-1);


printf("%d", s);

return s;


int main() {

int y[] = {1,3,2,8};


return 0;


Output: 146


5.      What will be the output after running all the following queries?

CREATE Table t(

val INT



values (1), (2), (3), (null), (null), (4), (5);

SELECT count (*) val_count

From t;

SELECT count(Distinct val) val_count

From t;


Create table name "t" with one attribute name "val”, which type is integer.

Insert value into "val” attribute.

Total number of value: 6

val_count 5


6.      Write a function in Python programming language which takes a filename a parameter,

orders first 10 line in output.


with open ("datafile") as myfile:

head = [next(myfile) for x in xrange(10)]

print head


7.      Complete the following java program.

class A{

int alpha;

int beta;

public A (int alpha, int beta) {

this.alpha alpha;

this.beta beta;


public void display() {

System.out.println ("Alpha"+alpha+ "\nBeta"+beta);



class Gamma extends A{

int gamma;

public Gamma (int alpha, int beta, int gamma){

super (alpha, beta);

this.gamma = gamma;




public void display() {


System.out.println ("Gamma" + gamma);



public class main{

public static void main(String[] args) {

Gamma g = new Gamma (3,30,10);





8.      What is a weak entity for data modeling using the entity relationship model find out

any weak entity and its identify relationship for the school database?

Which of the following table?

Student(student_id, student_name, admission year)

Teacher(teacher_id, teacher_name, teacher


Course(course_id, subject_name, credit)





9.      You are giving to store a set of objects and you want to use a data structure.

Where the expected running time to search an item is 0(1).

Which data structure is suitable to serve your purpose?

Answer:  Try yourself

Previous Article Next Article