C interview questions
Plz answer the following questions.....
TECHNICAL - C
/question number 1/
Code:
int z,x=5,y=-10,a=4,b=2;
z = x++ - --y * b / a;
What number will z in the sample code above contain?
a. 5
b. 6
c. 10
d. 11
e. 12
/question number 2/
With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?
a. unalloc()
b. dropmem()
c. dealloc()
d. release()
e. free()
/question number 3/
Code:
void *ptr;
myStruct myArray[10];
ptr = myArray;
Which of the following is the correct way to increment the variable "ptr"?
a. ptr = ptr + sizeof(myStruct); [Ans]
b. ++(int*)ptr;
c. ptr = ptr + sizeof(myArray);
d. increment(ptr);
e. ptr = ptr + sizeof(ptr);
/question number 4/
Code:
char* myFunc (char *ptr)
{
ptr += 3;
return (ptr);
}
int main()
{
char *x, *y;
x = "HELLO";
y = myFunc (x);
printf ("y = %s \n", y);
return 0;
}
What will print when the sample code above is executed?
a. y = HELLO
b. y = ELLO
c. y = LLO
d. y = LO
e. x = O
/question number 5/
Code:
struct node nPtr, *sPtr; / pointers for a linked list. */
for (nPtr=sPtr; nPtr; nPtr=nPtr->next)
{
free(nPtr);
}
The sample code above releases memory from a linked list. Which of the choices below accurately describes how it will work?
a. It will work correctly since the for loop covers the entire list.
b. It may fail since each node "nPtr" is freed before its next address can be accessed.
c. In the for loop, the assignment "nPtr=nPtr->next" should be changed to "nPtr=nPtr.next".
d. This is invalid syntax for freeing memory.
e. The loop will never end.
/question number 6/
What function will read a specified number of elements from a file?
a. fileread()
b. getline()
c. readfile()
d. fread()
e. gets()
/question number 7/
"My salary was increased by 15%!"
Select the statement which will EXACTLY reproduce the line of text above.
a. printf("\"My salary was increased by 15/%!\"\n");
b. printf("My salary was increased by 15%!\n");
c. printf("My salary was increased by 15'%'!\n");
d. printf("\"My salary was increased by 15%%!\"\n");
e. printf("\"My salary was increased by 15'%'!\"\n");
/question number 8/
What is a difference between a declaration and a definition of a variable?
a. Both can occur multiple times, but a declaration must occur first.
b. There is no difference between them.
c. A definition occurs once, but a declaration may occur many times.
d. A declaration occurs once, but a definition may occur many times.
e. Both can occur multiple times, but a definition must occur first.
/question number 9/
int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What value does testarray[2][1][0] in the sample code above contain?
a. 3
b. 5
c. 7
d. 9
e. 11
/question number 10/
Code:
int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);
what will be the output when following code is executed
a. 12,10,11,13
b. 22,10,11,13
c. 22,11,11,11
d. 12,11,11,11
e. 22,13,13,13
View Answers
May 30, 2011 at 4:00 PM
1) 5
2) free()
3) By providing function by user can increment that pointer.
4) y = LO
5) It may fail since each node "nPtr" is freed before its next address can be accessed.
6) fread()
7) printf("\"My salary was increased by 15%%!\"\n");
8) According to C++, Both can occur multiple times, but a declaration must occur first. According to C, A definition occurs once, but a declaration may occur many times.
9) 11
10) 22,13,14,14
Ads
Related Tutorials/Questions & Answers:
C interview questions
C interview questions Plz answer the following
questions.....
TECHNICAL -
C
/question number 1/
Code:
int z,x=5,y=-10,a=4,b=2...?
a. 5
b. 6
c. 10
d. 11
e. 12
/question number 2/
With every use of a memory
C interview questions
C interview questions Plz answer the following
questions.....
TECHNICAL -
C
/question number 1/
Code:
int z,x=5,y=-10,a=4,b=2...?
a. 5
b. 6
c. 10
d. 11
e. 12
/question number 2/
With every use of a memory
Advertisements
interview questions
interview questions
Tell us about a situation where you had to solve a difficult problem. What did you do?
What is your typical way of dealing with conflict? Give us an example.
Tell us about a problem that youâ??ve solved
interview questions
interview questions
Tell us about a situation where you had to solve a difficult problem. What did you do?
What is your typical way of dealing with conflict? Give us an example.
Tell us about a problem that you�ve solved
interview questions
interview questions
Tell us about a situation where you had to solve a difficult problem. What did you do?
What is your typical way of dealing with conflict? Give us an example.
Tell us about a problem that youâ??ve solved
interview questions
interview questions
Tell us about a situation where you had to solve a difficult problem. What did you do?
What is your typical way of dealing with conflict? Give us an example.
Tell us about a problem that youâ??ve solved
Java Interview Questions
Java
Interview Questions Hi,
Can anyone tell the urls of Java
Interview Questions on roseindia.net?
Thanks
Hibernate interview Questions
, but in that they have currently not updated
interview questions. They have explain so many new technology with pictorial example and sample programs but
interview question...Hibernate
interview Questions Pl share hibernate
interview
Interview Questions - What is JRE?
Interview Questions - What is JRE? Hi,
What is JRE?
Thanks
Hi,
JRE is known as Java Runtime Environment and its minimal components... and JVM?
View all
interview questions at Java
Interview Questions with Answers
Java interview questions
Java
interview questions Plz answer the following
questions... - 1
b. -231 to 231 - 1
c. -264 to 264
d. -232 to 232 - 1
Which of the following is not a hexadecimal number?
(A) 999
(B) (hex)23
(
C) 0x556
(D) 0x1F2
Interview Questions - What is JDK?
Interview Questions - What is JDK? Hi,
What is JDK?
Thanks
 ....
Check: Beginners Java Tutorials - Installing JDK.
View all
interview questions at Java
Interview Questions with Answers page.
Thanks
Video tutorial
Interview Questions - What is Java?
Interview Questions - What is Java? What is Java?
Hi,
Java is high level programming langue developed by James Gosling. Now Java....
Check in detail at: What is Java?
View all Java
Interview Questions
PHP MYSQL Interview Questions
PHP MYSQL
Interview Questions What kind of
questions can be asked in an PHP, MYSQL
interview? Can anyone post the PHP interviews
questions with well explained answers?
PHP, MYSQL
Interview Questions
Please tell me
Java interview questions and answers
Java
interview questions and answers
what is garbage collection? What is the process that is responsible for doing that in java?
Ans.Reclaiming the unused memory by the invalid objects. Garbage collector is responsible
Interview Questions - Where Java is used?
Interview Questions - Where Java is used? Hello,
Where Java is used?
Thanks
Hi,
Java is used for creating various types... being Used?.
View all
interview questions at Java
Interview Questions with Answers
basic c/c++ questions
basic
c/
c++ questions Are the Control statements like if(),while() in built functions?
if no, why not as they satisfy all the properties of a function
basic c/c++ questions
basic
c/
c++ questions Are the Control statements like if(),while() in built functions?
if no, why not as they satisfy all the properties of a function
C/C++ QUESTIONS
C/
C++ QUESTIONS â??Write a function for finding out the occurences of repeated word from a sentence. This
function would return an array of duplicate words.â
Interview Questions - How Java is Used?
Interview Questions - How Java is Used? Hi,
How Java is Used...
For Creating Applets
Check: Where is Java being Used?
View all
interview questions at Java
Interview Questions with Answers page.
Thanks
C/C++ QUESTIONS
C/
C++ QUESTIONS "Write a function for finding out highest and lowest marks obtained by a student from an
array contained student name and marks".
For Example :
GetHighestLowestMarks{Student{n}, Marks{n}} returns
jsp interview questions
jsp
interview questions what is difference betwen and ?
Difference between jsp:include and jsp:forward
jsp:include , includes the page inside the current page... so the included page will appear exactly where u
Core Java Interview questions and answers
Core Java
Interview questions and answers
 ....
So, we have tried to create most frequently asked Core Java
Interview Questions
and answers in one place.
These Core Java
Interview Questions are supported
Collection of Large Number of Java Interview Questions!
Interview Questions - Large Number of Java
Interview Questions
Here you will find Job
Interview Questions
for J2EE technologies. Before appearing... the
questions asked in the Job Interviews. We
have compiled many
Interview questions
JSF Interview Questions
JSF
Interview Questions
Who are the users of JSF technology?
JSF is that it has not only been designed for
coding experts but for others also