NEC Tech Interview Questions coderinme

NEC Tech Interview Questions in AMU

It was AMU Aligarh Placement drive for B.Tech/M.Tech/M.C.A.After First round we went to next round which was held at NOIDA .
The interviewer was very cool person but ALL of them are very good in programming , algorithm logic you can’t manipulate them.

There were lots of question from my resume, projects.
Basic iteration and recursion,String, Linked list, Array
but some 0f these questions i want to mention here are following.
NEC Tech Interview Questions

Q 1Differentiate between Call by value, call by address, call by refrence.

int fun(int a,int b)
   // call by value
   here function argument is copied in temporary value a,b;
  // you cant swap original data or any operation on this data(a,b) will
  not be reflected to original  data 
int fun(int &a,int &b)
   //call by reference
   //here you are passing the variable directly with different name all changes
  on data a,b will be reflected back to main variable
int fun(int* p1,int *p2)
   //call by address
   here you are passing the address of location not the variable you can access
  the variable using *p1

Pass by value (Type cv name) makes a copy of the original object that exists until the function completes.

Pass by reference (Type cv & name) and pass by (address) pointer (Type cv * name) are often the same, aside from some differences in syntax. The biggest difference is one of convention, not strict enforcement by the language: passing by reference implies that the object being passed always exists, while passing by pointer suggests that it might be nullptr, and should be checked before being accessed. As an aside, this is something that Google’s widely disseminated style guide gets horribly, horribly wrong. The mandatory check on pointer parameters should apply to out and inout parameters, not just in.

Technically, pointers are passed by value, but the object they point to is being what other languages would call referenced. This also applies when an object is passed in a smart pointer (assuming the smart pointer is passed by value).

The fourth mode of passing (I mentioned a +1) is by rvalue reference (Type && name). This is an advanced feature of modern C++, and should not be used directly if you are just learning the language, but there are a number of detailed answers related to its use on Quora when you are ready.

Q2.Write program for maximum of 4 numbers in good readable, optimized code

there are various method we can do for that.
I Method

#include <stdio.h>

int main()
    int num, max, min;

    printf ("Enter four numbers: ");
    scanf ("%d", &num);
    max = min = num;

    for (int i = 0; i < 3; i++)
        scanf ("%d", &num);
        if (max < num)
            max = num;
        else if (min > num)
            min = num;

    printf ("The smallest and largest of given four numbers are %d and %d respectively.\n", min,  max);
    return 0;

II Method

int max(int a, int b, int c, int d) {
    if (a > b && a > c && a > d)
        return a;
    if (b > a && b > c && b > d)
        return b;
    if (c > a && c > b && c > d)
        return c;
    if (d > b && d > c && d > a)
        return d;

III method

return Math.max(Math.max(Math.max(a, b), c),d);

IV Method

int max(int a, int b, int c, int d) {

   int tmp1 = a > b ? a : b;
   int tmp2 = c > d ? c : d;

   return tmp1 > tmp2 ? tmp1 : tmp2;
V Method coolest method
#include <iostream>
#include <math.h>
using namespace std;
int main() {
	// your code goes here
	int a,b,c,d;
	int m=max(max(a,b),max(c,d));
	return 0;

NEC Tech Interview Questions

Q 3.Find missing number unsorted contiguous array

we have solved this question you can check here

Q4 reverse the Linked list

There are different ways to do this. Let’s first look at a recursive solution.

Node * reverse( Node * ptr , Node * previous)
    Node * temp;
    if(ptr->next == NULL) {
        ptr->next = previous;
        return ptr;
    } else {
        temp = reverse(ptr->next, ptr);
        ptr->next = previous;
        return temp;
reversedHead = reverse(head, NULL);

Now for a non-recursive solution.

Node * reverse( Node * ptr )
    Node * temp;
    Node * previous = NULL;
    while(ptr != NULL) {
        temp = ptr->next;
        ptr->next = previous;
        previous = ptr;
        ptr = temp;
    return previous;

I personally use non-recursive solution but we should know both of them
NEC Tech Interview Questions
Competitive questions
For other companies technical questionThoughtworks


All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the

We as Coder in Me appreciate the efforts to people who contribute their precious time for making this Community Contribution.We are open to guest Contribution, If you have interesting stuff to share please contact us

Leave a reply:

Your email address will not be published.