Function Programming In C -Job Interview Frequently Asked Question and Answer Collection

Collection of most Frequently Asked Placement questions and Answers for Function and Pointer in C Programing in Practical viva in Engineering or Job interview for Hardware Programmer.

Variable Function Structure Pointer in C
Programming - C Viva Questions
Function  in Embedded C

1. How to declare a pointer to a function?

a) Int *(fp)()
b) Int (*fp)()
c) Int * (fp)()
d) None
ANSWER: B

2. What is the difference between “extern int function_name();” and “int function_name();”

a) First is to access other function which is outside of the scope of program & second is to access the simple function.
b) First is to access the simple function & second is to access other function which is outside of the scope of program.
c) Both are same.
d) None.
ANSWER: B

3. How to declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

a) Char *(*(*a[N])))
b) Char (*(*(*a[N])))
c) Char (*(*a[N]))
d) None
ANSWER: A

4. Can we declare a function that can return a pointer to a function of the same type?

a) Yes
b) No, we cannot do it directly
ANSWER: B

5. Function vprintf() uses the functionality of which header file?

a) Stadgs.h
b) Stdarg.h
c) Stdio.h
d) None
ANSWER: B

6. What does the error, invalid redeclaration of a function mean?

a) There is no declaration in scope,
b) There are multiple declarations
c) Function is invalid
d) None
ANSWER: A


7. Will C allow passing more or less arguments than required to a function?

a) If the prototype is not there then it will show “Too many or Too less arguments”.
b) If the prototype is around then it will show “Too many or Too less arguments”.
c) Sows simply compilation error
d) None
ANSWER: B

8. What is short-circuiting in C expressions?

a) If the left hand side is true for || or false for &&, the right hand side is not evaluated.
b) If the left hand side is true for + or false for &, the right hand side is not evaluated.
c) When two expressions in the syntax are same.
d) None.
ANSWER: A

9. What error would the following function give on compilation?

f( int a, int b)
{
Int a;
a=20;
return a;
}

a) Missing Parentheses in return statement
b) The function should be defined as int f(int a, int b)
c) Redecleration of a.
d) None.
ANSWER: C

10. How many times the following program would print ‘dododash’.

main()
{
printf(“\n dododash”);
main();
}

a) Infinite no of times
b) 32767 times
c) 65535 times
d) None
ANSWER: D

11. What are the correct syntaxes to send an array as a parameter to function?

a) func(array[size]);
b) func(*array);
c) func(&array);
d) func(array);
ANSWER: C & D

12. Mark the correct option.
#include<stdio.h>
Int main()
{
printf(“%p\n”, main());
return 0;
}

a) Print error
b) Print garbage value
c) Error :- main cannot called inside printf
d) Print nothing but runs infinitely.
ANSWER: D

13. How can one convert numbers to strings?

a) Using atoi()
b) Using printf()
c) Using sprint()
d) Using nsprintf()
ANSWER: C

14. What will be the output of the following code

main()
{
static int var = 5;
printf(“%d”, var- -);
if(var)
main();
}

a) Compilation error.
b) 55555
c) 54321
d) Infinite loop
ANSWER: C

15. Recursive functions are executed in which order

a) Parallel order
b) Iterative order
c) Last in first out
d) Random order
ANSWER: C

16. In recursive call of the function where the automatic variables are stored?

a) Stack
b) Queue
c) Array
d) Register
ANSWER: A

17. Will the following function gives output?

f1(int a, int b)
{
return ( f2(20) );
}
f2 (int a)
{
return (a * a);
}

a) Yes
b) No
ANSWER: A

18. If there is any problem in this code then find out

main()
{
int b;
b=f(30);
printf(“%d”, b);
}
int f (int a)
{
a > 30 ? return(10) : return(30);
}

a) Problem with int f( int a)
b) Problem with return
c) Both
d) None
ANSWER: B

19. Usually the loop’s working is faster than recursion

a) Always true
b) Always false
c) Sometimes true
d) Sometimes false
ANSWER: A

20. If there is any mistake then add code and remove it

main()
{
int a;
a = f(20, 6.28);
printf(“%d”, a);
}
f(int aa, float bb)
{
return((float)aa+bb);
}

a) Add float f(int , float) before printf
b) Add float f(int , float) after printf
c) Add float f(int , float)
d) None
ANSWER: C

21. Can you use the fprintf() to display the output on the screen?

Yes
No
ANSWER: Yes

22. The function that calls itself for its processing is known as.

Inline Function
Nested Function
Overloaded Function
Recursive Function
ANSWER: Recursive Function

23. In C, if you pass an array as an argument to a function, what actually gets passed?

Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
ANSWER: Base address of the array

24. The library function used to find the last occurrence of a character in a string is

strnstr()
laststr()
strrchr()
strstr()
ANSWER: strrchr()

25. Who calls to the function main()

kernel
operating system
cpu
ALU
ANSWER: operating system

Related

Java Question Bank Objective Q&A

Here we have collected frequently asked question in job interviews.We have chosen Java as our readers choice.You will find these helpful.We encourage our Readers to send in their suggestion. If re...

Question Bank - C Programming

1. We can insert pre written code in a C program by using         #read         #get         #include         #put Answer: Option 3 2. Difference between calloc() and malloc()     calloc() ta...

Microsoft Visual Basic 2012 Programming for Industrial Applications-Basic Tutorial

The basics of the Visual Studio 2012 for Windows Desktop Integrated Development Environment (IDE) for writing, running and debugging your applications for different platforms. Visual Studio’s h...

Post a Comment

  1. Thanks for your appreciation.Our readers would b e benefited by information provided by you on your site.

    ReplyDelete

SPAMMING will not be Appreciated.

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

Hot in weekRecentComments

Hot in week

Recent

C Programming - Data Structure Interview Questions Answer

We have started series of C programming Q&A for job interview for freshers.Computer / IT Engineering Professionals and Students alike will be benefited.We recommend our user to go through pre...

C Programming Question Answer

We have started series of C programming Q&A for job interview candidates.Engineering Professionals and students alike will be benefited.We recommend our user to go through previous post to enha...

Java Objective Multiple Answer Questions Bank

We have chosen Java Oracle J2EE, J2SE, Net-beans, JVM ( Java Virtual Machine ) as our readers choice.We have created Objective Type Multiple Answer Question Collection that are frequent in job inte...

Java Question Bank Objective Q&A

Here we have collected frequently asked question in job interviews.We have chosen Java as our readers choice.You will find these helpful.We encourage our Readers to send in their suggestion. If re...

C Question Bank

We have started series of C programming Question bank for job interview candidates.Engineering Professionals and students alike will be benefited.We encourage our readers to provide feedback and as...

Comments

Anonymous:

Technology is always being the vital part of evolution either mobile phones or computer all are the part of it. Electronics have made things so easy and reliable for human being s. very few schools in...

Anonymous:

A detailed and complete knowledge guide for fresher's to crack their interviews in Embedded Programming. Looking for a job contact <a href="http:/celebratejobs.com/>celebratejobs</a&...

YouLoseBellyFat:

visual basic example codes

App Development Mumbai:

It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us.

Anonymous:

Thanks for Appreciations.We love to hear again from you.

Our Channel

Contact Us

Name

Email *

Message *

item