Posts

Showing posts with the label interview

U.S. Visa B1/B2 Interview Experience

FingerPrint: July 28 2016 Hyderabad Reach there before half an hour . Items to Take: DS160 Confirmation Page Appointment Letter Passport You cannot carry mobile phone and purse as well Once you reach there, you have to stand in a queue. At the starting of the queue, a person will be verifying the name and passport number on your DS-160 Form as well as on the passport. Once matched, they will allow you inside. After going inside, there will be a security Check. And you have to go to the counter where they will again verify your documents and attach a sticker to the passport. They will give you a token number and allow you to go inside the other room. Check the television to find out your counter. Once you reach your counter, the person will ask you for your documents. Then ask for the purpose of the visit, and then ask you to read a paragraph present on the right side. After reading, they will take your photograph and then the fingerprints and then give ...

MultiThreading (pthread) Interview Question -2

#include <pthread.h> #include <stdio.h> #include <stdlib.h> int glob = 0; void *threadFunc(void *arg) {     int j;     int loops = *((int *) arg);     printf("\n %s: \n",__func__);     for (j = 0; j < loops; j++)     { glob++;     }     return NULL; } int main() {     pthread_t t1, t2;     int loops=1000000, ret;     ret = pthread_create(&t1, NULL, threadFunc, &loops);     if (ret != 0)         perror("Pthread Create :   ");     ret = pthread_create(&t2, NULL, threadFunc, &loops);     if (ret != 0) perror("Pthread Create:    ");     ret = pthread_join(t1, NULL);     if (ret != 0) perror("Pthread Join:     ");     ret = pthread_join(t2, NULL);     if (ret != 0) perror("Pthread Join :    "...

Multithreading (pthread) Interview Question -1

Write a C Program to print even numbers in one thread and odd numbers in another thread? #include <stdio.h> #include <pthread.h> #include <semaphore.h> pthread_t oddThread,evenThread; sem_t semEven,semOdd; int counter = -1; void *oddFn(void *arg) { while (counter < 15) { sem_wait(&semOdd); printf("Counter:%d\n",++counter); sem_post(&semEven); } pthread_exit(NULL); } void *evenFn(void *arg) { while (counter < 15) { sem_wait(&semEven); printf("Counter:%d\n",++counter); sem_post(&semOdd); } pthread_exit(NULL); } int main(int argc, char *argv[]) { int ret; sem_init(&semEven, 0, 1); sem_init(&semOdd, 0, 0); ret = pthread_create(&evenThread, NULL, evenFn, NULL); if (ret != 0) { perror("Error in creating Thread\n"); exit(1); } ret = pthread_create(&oddThread, NULL, oddFn, NULL); if (ret != 0) { perror("Error in creatin...

C program to allocate a 2-D array using malloc ( C Interview question - 5)

The question is to allocate a 2 dimensional array using malloc. It should be accesible similar to arrays as a[i][j] Before going to the code I will just remind the notation of a[i][j]= *(*(a + i) + j) #include <stdio.h> int main() {      int r = 3, c= 3;      int **arr=(int **)malloc(sizeof(int)*r);  //allocate memory for rows      int i = 0, j =0;      for ( i = 0; i < r; i++)      {              arr[i] = (int *)malloc(sizeof(int)*c); //allocate memory for columns       }       //store values       for (i = 0; i < r; i++)       {              for(j = 0; j<c;j++)             {                 arr[i][j]=i;              }   ...

Difference between dangling pointer and memory leak ( C Interview Question -4)

What is memory leak in C? Memory leak occurs when you allocated memory using malloc or calloc, but forget to free the allocated memory i.e., forget to call free() This will cause a serious issue in programs like daemons or servers which will be running for a long amount of time. Example: #include<stdio.h> void function() {     int *ptr = (int *)malloc(1000);     /* Perform Some work*/     /* Returned without calling free*/ } int main() {          while(1)          {                func();          }          return 0; } In order to avoid memory rule, you have to free the allocated memory after you complete your work of using it. In order to find out if there is any memory leak occurring in the program, you can use tools like valgrind. What is a dangling pointer? Dangling pointers ...

C program to print 1 to 100 without using any loop or conditional operator ( C Interview question - 3)

Write a C program to print numbers from 1 to 100? Conditions : 1 . You cannot use loops(for, while)                      2.  You cannot use conditional operator                      3.  No goto statement Solution : #include <stdio.h> void print() {       static int num = 0;       num++;       printf("%d\n", num);      if ( num < 100)         print(); } int main() {        print();        return 0; }

Storage Classes in C (C Interview Question - 2)

What is Storage Class: Storage class determines the scope and lifetime of the variable What is Scope? Scope or visibility tells you about the part of the program that can access the variable. What is lifetime? Each variable in C is assigned some physical location where it can store some value. The lifetime defines how long the value will be present in that particular location. A variable may have local lifetime or global lifetime. A variable that has global lifetime,its value will be persisted throughout the program, whereas a variable with local lifetime,value will persist in the block which it is defined. There are four storage classes in C 1. auto 2. register 3. static 4. extern 1. auto: Default storage class. If we don't specify any storage class  while defining the variable then by default storage class will be taken as auto Scope: Auto can only be used within functions. If you try to specify a global variable with auto storage class then you will get ...

Confusing Pointer Operations : *++ptr, ++*ptr, *ptr++ ( c Interview question - 1)

Important Points: 1. Postfix operation has more precedence than dereference operator.         *p++ means it will be *(p++).. * will be applied to the result of p++. 2. Prefix Operation has the same precedence with the dereference operator.When there is same precedence we have to take associativity into picture, The associativity is right-left . In ++*ptr , first it will dereference and then increment , whereas in *++ptr it will increment the value and dereference. To easily understand this we will take an example of a C program. #include <stdio.h> int main() {        char ptr[]="Hello World";        printf("Value :%s\n", ptr);        ++*ptr;        printf("Value :%s\n", ptr);        return 0; } In the above example you can see that we are having prefix operator and dereference operator.We know that both are having the same precedence, the...

Tata Elixsi Interview Experience

1. Tell me about yourself 2. Questions about project 3. Write a C program to check whether a particular character exists in a string?also testcases to be written 4. Write a code to check the endianess of the microcontroller 5. Write a macro to find the square of a number 6. What is ISR and how interrupt latency is reduced

Mirafra Technologies Interview Experience

1.Tell me about yourself 2.Rate yourself in C on a factor of 1 3.What is void pointer 4.volatile keyword in C 5.Storage classes in C 6.Static keyword in C 7.const keyword in C 8.Which DeviceDrivers u have worked on 9.Explain about I2C.Start and stop condition 10.Synchronization Mechanisms 11.Difference between semaphore and mutex 12.use of spinlock 13.What is system call and what happens internally 14.Between ISR and process which we wil use semaphore or spinlock 15.Interrupt Mechanism in linux 16.Top Half and Bottom Half 17.WorkQueues 18.What are the Debugging mechanisms used ?

Honeywell Interview Experience

1. Tell Me Yourself? 2. Explain about your project? 3. Why you have choosen MSP430F series? What is the speciality about MSP430F series? 4. Write steps to configure an ADC? Use any microcontroller? Is timer required for ADC? 5.Tell some of the interrupts? 6.Process of creating a socket?Is the file created in the file system will have an address(Major and Minor Number) 7.What is the structure used for filling IP Address and Port(struct sockaddr) 8.TCP Header size.What are the fields present in the TCP header. 9.Read System Call. 10.Synchronization Mechanisms. 11.What is a semaphore(API's)? How many types of semaphore are there? 12.What is the difference between semaphore and mutex? 13.What is context switch?How internally the operations happens? 14.How an interrupt is requested in Linux ?request-irq()?What are the arguments? 15.What is the necessaryof probe and init?Why can't we have only probe? 16.Do you know USB drivers? 17.Do you know multithreading? 18....

Hughes Systique (HSC) Interview experience

First Round (Telephonic Round) Networking Questions: 1. What is used to translate domain name to IP Address? (DNS) 2. How to get the local address of the device ? (ARP) Linux Command Questons ; 1. Command to write in a file as well as display ( tee) 2.Command to setup a firewall ..(i said i dont know,,answer:iptables) 3.Command to add route (route command) C Language Questions: 1. How to get the  number of elements in an array( i said sizeof() operator) 2. How can you write ++ * ptr in another way?(i said ++(*ptr)) 3. How to write a function pointer that takes a char *  and integer as an argument and returns an int (int (*func)(char *, int) Second Round(Telephonic) 1. Tell me about yourself 2. main(){ char *ptr = "worlds"; strcpy(p, "hello"); } o/p of this program 3. Difference between call by value and call by reference 4. Difference between structure and union 5. Storage classes in C 6. Can we use both extern and static 7. What hap...

Robert bosch interview questions for Device Driver

What is the need for device tree? Booting process from u-boot to kernel start? More questions on System.map?Whether the address are correct? What happens if we remove system.map ? where it is located? Where is MMU turned ON either at bootloader or kernel? What is readback cache or writeback cache?

C-language 63 programming Questions

C-language 63 programming Questions 1. What are storage classes in 'C' language? a)auto keyword b)static keyword c)register keyword d)extern keyword e)automatic f)static 2. What are the storage class specifiers in c language? 3. How many variables scopes are there in c language? 4. main() { int i; for(i=0;i<5;i++) { static int a=0; int b=0; a++; b++; printf("\na=%d",a); printf("b=%d",b); } } 5. main() { static int s; ++s; printf("\n%d",s); if(s<=3) main(); printf("\n%d",s); } 6. extern int a; main() { printf("\na=%d",a); return 0; } 7. int a; main() { printf("\na=%d",a); return 0; } 8. extern int a; main() { printf("\na=%d",a); return 0; }int a; 9. extern int a; main() { printf("\na=%d",a); return 0; ...

c-language 97 programming questions

c-language 97 programming questions 1. #include<stdio.h> void main() { printf("%d%d%d\n",50,100); } 2. void main(){ a=3.5; printf("%d",a); } 3. void main(){ printf(%d%d",100,200,300); } 4. void main(){ printf(2+3=%d",2+3); } 5. void main(){ int a; a=3+5*5+3; printf(%d,a); } 6. void main(){ int a; a=printf("sumit%d",printf("sumit)); printf("%d",a); } 7. void main(){ printf("%d",%d",47%5,47%-5); printf("%d%d%d",-47%5,-47%-5,5%7); } 8. void main(){ int a; float f; a=12/5; f=12/5; printf("%d%f",a,f); } 9. void main(){ int a,b; a=b=100; scanf("%d%d",a,&b); //enterde value are 40,85 printf("%d%d",a,b); } 10. ...

C-language 56 programming Questions

C-language 56 programming Questions 1. #include<stdio.h> void main() { int arr[]; arr[1]=10; printf("%d",arr[0]); } 2. #include<stdio.h> void main() { int arr[2]={10,20,30,40}; printf("%d",*(arr+2)); } 3. #include<stdio.h> void main() { int arr[2]={10,20}; arr[2]=30; arr[3]3=40; printf("%d",*(arr+3)); } 4. #include<stdio.h> void main() { int arr[2]={10,20}; *arr=30; *(arr+1)=40; printf("%d%d",arr[0],1[arr]); } 5. #include<stdio.h> void main() { int a=1; void xyz(int,int); xyz(++a,a++); xyz(a++,++a); printf("\n%d",a); } void xyz(int x,int y) { printf("\n%d%d",x,y); } 6. #include<stdio.h> void abc() { ++a; } void main() { int a=1; abc(); printf("...

RTOS interview questions

RTOS INTERVIEW QUESTIONS These are some of the interview questions which may be asked on RTOS..... 1.       What is the difference between OS,RTOS,EMBEDDED OS 2.       Scheduling algorithms used in RTOS,OS,EMBEDDED OS 3.       Unilateral Rendezvous,Bilateral Rendezvous,Event Flags,Message Queues,Mailboxes,Shared Memory,Barriers 4.       How do you perform porting? 5.       Difference between embedded C and normal C 6.       Significance of Volatile. 7.       How do we write portable code in embedded systems?

os interview questions

OS INTERVIEW QUESTIONS These are some of the basic interview questions asked on operating system 1.      What is the difference between multitasking,multiprocessing,batch processing ,multiuser? 2.      What is the difference between monolithic and micro kernel? 3.      How to create Dynamic and static library? 4.      How to create a process in linux? 5.      Difference between pipes and named pipes? 6.      All POSIX API for  example what are the API of semaphores? 7.      What are the different types of mutex? 8.      What is conditional variables? 9.      What are barriers? 10.                         What are read write locks? 11.      ...

networking and wireless interview questions

1.        How do we create sockets in Linux ,Types of sockets used in Linux 2.        Sockets API’s of server and client 3.        Can we use bind in client side 4.        What are the different types of Bluetooth sockets? 5.        Bluetooth stack 6.        What is piconet 7.        What is scatterenet 8.        What are the different links supported by Bluetooth 9.        Hidden Node problem 10.    Exposed station problem 11.    Why CSMA/CA is used in wifi and why not CSMA/CD? 12.    RTS/CTSS

AVR interview questiions

AVR INTERVIEW QUESTIONS 1.RISC,CISC,VON NEUMANN,HARVARD,MODIFIED HARVARD ARCHITECTURE EXPLAIN 2.Pipelining 3.Pipelining Hazards 4.How do we interface LCD to AVR 5.How do we interface external SRAM to AVR 6. Timing diagram for I2C,SPI 7.Interfacing CAN,Ethernet,USB 8.Interfacing Switches 9. Real time clock(RTC).