Redpine Infotech Papers: Sample Questions 8 - 9 of 19

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 8

» Languages » C & C Plus Plus

MCQ▾

Question

What is output for the following program?

  1. #include<stdio.h>
  2. main ()
  3. {
  4.     int a10b=5;
  5.     if(a=a&b)b=ab;
  6.     printf (“a=%db=%d” ab);
  7. }

Choices

Choice (4) Response

a.

a = 0, b = 0

b.

a = 10, b = 5

c.

a = 0, b = 5

d.

All of the above

Answer

c.

Explanation

Table shows the program

Table shows the program

#include < tdio. h >

Standard library function

main ()

Startup after initialization

int a = 10, b = 5;

Declare integer values a = 10 and b = 5

if (a = a&b) b=;

In if condition (a = a&b) b=, when given a = 10 (00001010), b = 5

(00000101)

(a = a&b) = 00000000. This is also false thus a = 0 and b = 5 (already given)

printf (“a=%d, b=%d” a, b);

Print a = 0 and b = 5

Question number: 9

» Basic CS » Networks

Essay Question▾

Describe in Detail

What is the mechanism used for error detection in Data Link Layer?

Explanation

Define Error detection

Define Error Detection

Define Error detection and its method

  • Error in the received frames is detected by Parity check and CRC (cyclic redundancy).

Parity check:

  • One extra bit is sent with the original bits to make number of 1s either even, in case of even parity or odd, in case of odd parity.

  • The sender while creating a frame counts the number of 1s in it.

  • For example, if even parity is used and number of 1s is even then one bit with value 0 is added.

  • This way numbers of 1s remain even.

  • The number of 1s is odd; to make it even a bit with value 1 is added.

The number of 1s is odd

The Number of 1s is Odd

The number of 1s is odd

  • The receiver simply counts the number of 1s in a frame.

  • If the count of 1s is even and even parity is used the frame is considered to be not-corrupted and is accepted.

  • If the count of 1s is odd and odd parity is used, the frame is still not corrupted.

CRC:

  • CRC is based on binary division.

  • A sequence of redundant bits called cyclic redundancy check bits are the end of data unit so the resulting data unit becomes exactly divisible by a second binary number.

  • The destination, the incoming data unit is divided by the same number.

  • If at this step there is no remainder, the data unit is assumed to be correct and is therefore accepted.

  • A remainder indicates that the data unit has been damaged in transit and therefore must be rejected.

    For example,

Image of the CRC divisor

Image of the CRC Divisor

Image of the CRC divisor

  • The receiver performs division operation on code words using the same CRC divisor.

  • Only if remainder contains all zeros the data bits are accepted.