Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Companies

  •  Accenture
  •  Adobe
  •  Alcatel-Lucent
  •  Alten Calsoft Lab
  •  Amazon
  •  Amdocs
  •  Aricent
  •  Arris
  •  Broadcom Ltd
  •  Brocade
  •  CA Technologies
  •  Capgemini
  •  Cavium Networks
  •  CenturyLink
  •  Ciena
  •  Cisco
  •  Citrix
  •  Cognizant
  •  Comcast
  •  CSC (DXC Technology)
  •  Dell EMC
  •  Deloitte
  •  EFI
  •  Ericsson
  •  Extreme Network
  •  Genpact
  •  Gigamon
  •  Global Edge
  •  GlobalLogic
  •  Goldman Sachs
  •  Happiest Minds
  •  HCL Technologies
  •  Hewlett Packard Enterprise
  •  IDS Infotech
  •  Incedo
  •  Infinite C S
  •  IpInfusion
  •  J.P. Morgan
  •  Juniper Network
  •  L&T Technology Services
  •  MindTree
  •  MosChip Semiconductor
  •  NEC Technologies
  •  NIIT Technologies
  •  OLA
  •  One Access
  •  PayPal
  •  Qualcomm
  •  Radisys
  •  Redeem Software
  •  Reliance Jio
  •  Rolta India Limited
  •  Samsung
  •  Sasken
  •  Siemens
  •  Synopsys
  •  Tavant Technologies
  •  TCS
  •  Tech Mahindra
  •  Wipro
  •  XiLinx

Interview Questions and Answers :: C

    Answer:
    5 5 5
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    0
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    16
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:

    4, 0, 1

    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    no
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:

    it will not give compilation error, the if condition is proper, 

    it will be executed as like value "0" will be assigned to a and then it will check the if condition. 

    basically when we put any condition in if condition it check 0/1 like if (p==5) if p value is 5 then for this condition it will be something like if(1) in other scenario like if p is not equal to 5 then statement will be like if(0). 

    Such thing is happening in the given partial code, the last statement will be like if (0), which is false and control will go to else part. so that answer will be a is zero. However if you put a=5 then it will print a i non zero.

    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    int n;
    int a=0;
    scanf("%d",&a);
    n=a;
    while (n>2)
    {
    if(n%2!=0)
    {
    n=n/2;
    if (n>=2)
    {
    printf("%d is prime number", a);
    break;
    }
    }
    else
    {
    printf("%d is not prime number", a);
    break;
    }

    }
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    int a[]= {2,3,4,7,9,3,8,9,6,8,7,9};
    int i=0;
    int j=0;
    int flag=0;
    int n=12;
    static int incr;
    for (i=0;i {
    for(j=0;j {
    if (a[i]==a[j])
    {
    incr++;
    if (incr>=2)
    flag=1;
    }
    }
    if (flag)
    printf("\n %d is repeated %d times in this array", a[i],incr);
    flag=0;
    incr=0;

    }
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    int a[]= {2,3,4,7,9,3,8,9,6,8,7,9};
    int i=0;
    int j=0;
    int n=12;
    int sum=12;
    for (i=0;i {
    for(j=++i;j {
    if ((a[i]+a[j]) == sum)
    {
    printf("\n %d + %d positions of sum %d", a[i], a[j], sum);
    continue;
    }
    }
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:

    8 in case of union it will be 4 

    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    #include

    unsigned int swapBitsInPair(unsigned int x)
    {
    /*
    extracts the high bit position and shifts it to the low bit position.
    similarly extracts the low bit from each pair and shifts it to the high bit position.
    The two parts are then combined using bitwise OR
    */
    return ((x & 0b10101010) >> 1) | ((x & 0b01010101) << 1);
    }

    int main()
    {
    unsigned int x = 156;
    printf("%d", swapBitsInPair(x));
    return 0;
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    The memcpy function is used to copy a block of data from a source address to a destination address. The prototype for memcpy is

    void * memcpy(void * destination, const void * source, size_t num);

    #include
    #include

    void myMemCpy(void *dest, void *src, size_t n)
    {
    // Typecast src and dest addresses to (char *)
    char *csrc = (char *)src;
    char *cdest = (char *)dest;

    // Copy contents of src[] to dest[]
    for (int i=0; i cdest[i] = csrc[i];
    }

    int main()
    {
    char csrc[] = "broadcom interview";
    char cdest[100];
    myMemCpy(cdest, csrc, strlen(csrc)+1);
    printf("Copied string is %s", cdest);
    return 0;
    }
    Please Login First :
    Tags:

    No Tags on this question yet!