BCC Assistant Programmer 2021 Full Question Solution - Exam Taker BUET

 Question Answer (i) 192.168.10.2/28, Find subnet mask. 255.255.255.240 (ii) 192.168.10.2/28, Find Network Address. 192.168.10.0 (iii) 192.168.10.2/28, Find IP Address of the first host? 192.168.10.1 (iv) 192.168.10.2/28, Find IP Address of the last host? 192.168.10.14 (v) 192.168.10.2/28, Find Broadcast Address. 192.168.10.15

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 etc. For example: Matrix Multiplication.

4.      Find the Output of following C Program:

#include<stdio.h>

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

int s = x[i];

if(i>0){

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

}

printf("%d", s);

return s;

}

int main() {

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

function(y,2);

return 0;

}

Output: 146

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

CREATE Table t(

val INT

);

INSERT INTO t(val)

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

SELECT count (*) val_count

From t;

SELECT count(Distinct val) val_count

From t;

Output:

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)]

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;

}

}

@override

public void display() {

super.display();

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

}

}

public class main{

public static void main(String[] args) {

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

g.display();

}

}

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?

Teacher(teacher_id, teacher_name, teacher

joindate)

Course(course_id, subject_name, credit)

Homework()

Courseoffering()

Attendance()

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?