C Interview Questions
Questions Answers Views Company eMail

What is true about the following C Functions a.Need not return any value b.Should always return an integer c.Should always return a float d.Should always return more than one value.

TCS,

11 14485

Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program

CTS, HCL, TCS,

18 17422

Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global.

FCI, TCS,

6 10429




Write one statement equalent to the following two statements x=sqr(a); return(x); Choose from one of the alternatives a.return(sqr(a)); b.printf("sqr(a)"); c.return(a*a*a); d.printf("%d",sqr(a));

TCS,

6 6889

Which of the following about the C comments is incorrect ? a.commentscan go over multiple lines b.comments can start any where in the line c.a line can contain comments with out any language statements d.comments can occur within comments

TCS,

6 9058

What is the value of y in the following code? x=7;y=0; if(x=6) y=7; else y=1;

TCS,

12 14944

Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... }

TCS,

7 13815

what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);}

TCS,

9 10049




how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y

TCS,

4 12529

read the folllowing code # define MAX 100 # define MIN 100 .... .... if(x>MAX) x=1; else if(x

TCS,

4 11636

a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21

TCS,

4 6322

given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the array which of the following is incorrect? a.*(a+5) b.a[5] c.pa[5] d.*(*pa + 5)

TCS, amu,

6 12787

consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value

TCS,

4 6396

identify the in correct expression a.a=b=3=4; b.a=b=c=d=0; float a=int b=3.5; d.int a; float b; a=b=3.5;

TCS,

8 8312

regarding the scope of the varibles;identify the incorrect statement: a.automatic variables are automatically initialised to 0 b.static variables are are automatically initialised to 0 c.the address of a register variable is not accessiable d.static variables cannot be initialised with any expression

TCS,

1 5166


Post New C Questions






Un-Answered Questions { C }

why we wont use '&' sing in aceesing the string using scanf

1032


Write a c program to demonstrate character and string constants?

932


what is the syallabus of computer science students in group- 1?

1071


hi, which software companys will take,if d candidate's % is jst 55%?

839


Simplify the program segment if X = B then C ← true else C ← false

1810






A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

726


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

2970


how to find binary of number?

1829


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

1948


how to find anagram without using string functions using only loops in c programming

1906


Between macros and functions,which is better to use and why?

817


what is the structure pointer?

924


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

1637


difference between native and cross compilers

865


Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop

927