| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| How to set a variable in the environment list? | | 1 |
| what is the difference between #include<stdio.h> and
#include"stdio.h" ? | TCS | 5 |
| what is the output of following question?
void main()
{
int i=0,a[3];
a[i]=i++;
printf("%d",a[i]
} | | 2 |
| Write a C program that reads a series of strings and prints
only those ending in "ed" | | 2 |
| What will be result of the following program?
void myalloc(char *x, int n)
{
x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{
char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
| IBM | 3 |
| what will happen if you free a pointer twice after
allocating memory dynamically ? | Novell | 2 |
| 4.weight conversion:
Write a program that will read weight in pounds and convert
it into grams.print both the original weight and the
converted value.There are 454 grams in a pound.design and
carry out a test plan for this program.
| Wipro | 1 |
| int arr[] = {1,2,3,4}
int *ptr=arr;
*(arr+3) = *++ptr + *ptr++;
Final contents of arr[]
| Hughes | 4 |
| wap to print "hello world" without using the main function. | TCS | 14 |
| disadvantages of realloc ? | HCL | 1 |
| HOW DO YOU HANDLE EXCEPTIONS IN C?
| AppLabs | 2 |
| enum day = { jan = 1 ,feb=4, april, may}
what is the value of may?
a)4 b)5 c)6 d)11
e)none of the above
| HCL | 2 |
| Which of the following are valid "include" formats?
A)#include and #include[file.h]
B)#include (file.h) and #include
C)#include [file.h] and #include "file.h"
D)#include <file.h> and #include "file.h"
| Accenture | 14 |
| write a own function to compare two strings with out using
stringcomparition function? | LG-Soft | 3 |
| what is available in C language but not in C++? | | 1 |
| how to find out the reverse number of a digit if it is
input through the keyboard? | | 2 |
| While(1)
{
}
when this loop get terminate is it a infinite loop? | | 4 |
| which one is not preprocessor directive
a)#if b)#elif c)#undef d)#pragma
| Wipro | 13 |
| To what value are pointers initialized?
1) NULL
2) Newly allocated memory
3) No action is taken by the compiler to initialize
pointers.
| | 2 |
| C program to find frequency of each character in a text
file? | | 3 |
| |
| For more C Interview Questions Click Here |