Q 1. The National college of Journalism is offering courses in three different categories of journalism, which are the print, the web and the broadcasting media.

A student is eligible to apply if he/she satisfies any one of the following conditions:

  • The student is a graduate in any discipline with an aggregate percentage of 75 or above and with a record of literary skills.

OR

  • The student is a graduate in Mass Communication with an aggregate percentage of 75 or above.

The inputs are:

  1. Graduate in any discipline.
  2. Graduate in Mass Communication.
  3. Aggregate percentage of 75 and above.
  4. Record of Literary skills.

Output:

R-Denotes eligible to apply[1 indicates Yes and 0 indicates No in all cases]

 Draw the truth tables for the inputs and outputs given above and write the expression with the  conjunctive operator for the terms which have 1 in the result column.  

Q 2. A coin is tossed two times. A win is said to occur, if each toss result in ‘HEAD’ otherwise in all other cases it is a loss. Using the following as:

A=1, if the first toss result in ‘HEAD’.

A=0, if the first toss result in ‘TAIL’.

B=1, if the second toss result in ‘HEAD’.

B=0, if the first toss result in ‘TAIL’.

S=1, if Win occurs.

S=0, if the win does not occurs.

  1. Draw a truth table to determine all the possible values of S, depending in the values taken by A and B.        
  2. The rule of winning in above problem is modified as follows,                                       

A win is said to occur if at least one toss result is HEAD, otherwise a loss occurs. Construct a truth table for the revised winning rule and write the terms using conjunction operator for the true result columns(1’s).

Q 3.

a) The following function is a part of some class. It returns the value 1 when the number is an Armstrong number, otherwise it returns 0.

class Armstrong

{

/* An armstrong number is a number which is equal to the sum of the cube of its individual digits*/

int arms(int n)

{

int digit=0, sum=0; int rem=n; while(?1?)

{

digit=?2?; sum=sum+?3?; rem=?4?;

}

if(?5?)

 return 1;

else return 0;

}     }

i)            What is the expression / value at ?1?

ii)           What is the expression / value at ?2?

iii)          What is the expression / value at ?3?

iv)          What is the expression / value at ?4?

v)           What is the expression / value at ?5?

Q 4 The following function trial() perform are a part of some class. Answer the following parts given below. Show dry run/working.

int trial(int n)

{

            if(n==1)

            return 2;

            else if(n==2)

            return 3;

            return trial(n-2)+trial(n-1);

}

What will the function trial() return when the value of n is 6.                                             

Q 5. The following is a part of some class. What will be the output of the function   mymethod( )

when the value of counter is equal to 3? Show the dry run/ working.

void mymethod(int counter)

{

 if(counter= =0) System.out.println(“ “);

else

{

System.out.println(“Hello “+ counter);

mymethod(- -counter);

System.out.println(“  “+ counter);

}      }        

Q 6.

The following function Check() is a part of some class.  What will the function Check()      

return when the values of both ‘m’ and ‘n’ are equal to 5?  Show the dry run I working.

int Check (int m, int n)

{      

 if (n = = 1)

return   – m – -;

else

          return  + + m + Check (m, – -n)

}

LEAVE A REPLY

Please enter your comment!
Please enter your name here