Embedded C Programming Twenty Interview Questions Basics Viva Tutorials
http://ingenuitydias.blogspot.com/2015/06/embedded-c-programming-twenty-interview.html
1.) Trace the output of the code
#include
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf(""%d\n"", *p);
}
a.) 10
b.) Some garbage value
c.) Segmentation fault/Code crash
d.) Compile time error
ANSWER: c.) Segmentation fault/Code crash
2.) Trace the output of the code
#include
struct p
{
int x;
char y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 3);
if (x == sizeof(int) + sizeof(char))
printf(""%d\n"", ptr1->x);
else
printf(""falsen"");
}
a.) Compile time error
b.) 1
c.) Undefined Behaviour
d.) FALSE
ANSWER: d.) FALSE
Watchdog Timer Interview Questions
Structures Unions Enumeration - Flow-control in C
C Storage Classes
Variable Function And Structure
C Viva Questions for Freshers Basics
3.) Which of the following structure declaration doesn't require pass-by-reference?
a.) struct{int a;}s; main(){ }
b.) struct temp{int a;}; main() { struct temp s; }
c.) struct temp{int a;};
main(){}
struct temp s;
d.) None of the mentioned
ANSWER: d.) None of the mentioned
4.) Which of the following is correct statement?
a.) Variable name must start with underscore
b.) Variable name must have digit
c.) keyword can not be a variable name
d.) None of the mentioned
ANSWER: c.) keyword can not be a variable name
5.) In c programming a function can return ___________
a.) Single value
b.) Double value
c.) Many value
d.) all of the above
ANSWER: a.) Single value
6.) Array index always start from
a.) 0
b.) 1
c.) 2
d.) 3
ANSWER: a.) 0
7.) Which of the following is incorrect statement
a.) All array variable have same type
b.) An array is the collection of variable
c.) Array variable can be used individually
d.) None of the mentioned
ANSWER: d.) None of the mentioned
8.) While coding in c programming for "call by reference" we pass
a.) Address of variable
b.) Value of variable
c.) Either value or address
d.) Both value and address
ANSWER: a.) Address of variable
9.) An assembly language is a .......... programming language but BASIC is ....... programming language
a.) problem oriented.....low level
b.) problem oriented.........high level
c.) machine oriented......high level
d.) machine oriented......low level
ANSWER: c.) machine oriented......high level
10.) A utility programme that takes a procedure and searches a library to locate copies of any procedures called but not defined in the first procedure, is called
a.) Linker
b.) Re-locator
c.) Loader
d.) Text editor
ANSWER: a.) Linker
11.) What do the 'c' and 'v' in argv stands for?
a.) 'c' means argument control 'v' means argument vector
b.) 'c' means argument count 'v' means argument vertex
c.) 'c' means argument count 'v' means argument vector
d.) 'c' means argument configuration 'v' means argument visibility
ANSWER: c.) 'c' means argument count 'v' means argument vector
12.) Which of the following is TRUE about argv?
a.) It is an array of character pointers
b.) It is a pointer to an array of character pointers
c.) It is an array of strings
d.) None of above
ANSWER: a.) It is an array of character pointers
13.) Which of the following statements are FALSE about the below code?
Int main (int ac, char *av[]) { }
a.) ac contains count of arguments supplied at command-line
b.) av[] contains addresses of arguments supplied at a command line
c.) In place of ac and av, argc and argv should be used
d.) The variables ac and av are always local to main()
ANSWER: c.) In place of ac and av, argc and argv should be used
14.) Queue can be used to implement
a.) radix sort
b.) quick sort
c.) recursion
d.) depth first search
ANSWER: a.) radix sort
15.) The depth of a complete binary tree is given by
a.) Dn = n log2n
b.) Dn = n log2n+1
c.) Dn = log2n
d.) Dn = log2n+1
ANSWER: d.) Dn = log2n+1
#include
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf(""%d\n"", *p);
}
a.) 10
b.) Some garbage value
c.) Segmentation fault/Code crash
d.) Compile time error
ANSWER: c.) Segmentation fault/Code crash
2.) Trace the output of the code
#include
struct p
{
int x;
char y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 3);
if (x == sizeof(int) + sizeof(char))
printf(""%d\n"", ptr1->x);
else
printf(""falsen"");
}
a.) Compile time error
b.) 1
c.) Undefined Behaviour
d.) FALSE
ANSWER: d.) FALSE
Watchdog Timer Interview Questions
Structures Unions Enumeration - Flow-control in C
C Storage Classes
Variable Function And Structure
C Viva Questions for Freshers Basics
3.) Which of the following structure declaration doesn't require pass-by-reference?
a.) struct{int a;}s; main(){ }
b.) struct temp{int a;}; main() { struct temp s; }
c.) struct temp{int a;};
main(){}
struct temp s;
d.) None of the mentioned
ANSWER: d.) None of the mentioned
4.) Which of the following is correct statement?
a.) Variable name must start with underscore
b.) Variable name must have digit
c.) keyword can not be a variable name
d.) None of the mentioned
ANSWER: c.) keyword can not be a variable name
5.) In c programming a function can return ___________
a.) Single value
b.) Double value
c.) Many value
d.) all of the above
ANSWER: a.) Single value
6.) Array index always start from
a.) 0
b.) 1
c.) 2
d.) 3
ANSWER: a.) 0
7.) Which of the following is incorrect statement
a.) All array variable have same type
b.) An array is the collection of variable
c.) Array variable can be used individually
d.) None of the mentioned
ANSWER: d.) None of the mentioned
8.) While coding in c programming for "call by reference" we pass
a.) Address of variable
b.) Value of variable
c.) Either value or address
d.) Both value and address
ANSWER: a.) Address of variable
9.) An assembly language is a .......... programming language but BASIC is ....... programming language
a.) problem oriented.....low level
b.) problem oriented.........high level
c.) machine oriented......high level
d.) machine oriented......low level
ANSWER: c.) machine oriented......high level
10.) A utility programme that takes a procedure and searches a library to locate copies of any procedures called but not defined in the first procedure, is called
a.) Linker
b.) Re-locator
c.) Loader
d.) Text editor
ANSWER: a.) Linker
11.) What do the 'c' and 'v' in argv stands for?
a.) 'c' means argument control 'v' means argument vector
b.) 'c' means argument count 'v' means argument vertex
c.) 'c' means argument count 'v' means argument vector
d.) 'c' means argument configuration 'v' means argument visibility
ANSWER: c.) 'c' means argument count 'v' means argument vector
12.) Which of the following is TRUE about argv?
a.) It is an array of character pointers
b.) It is a pointer to an array of character pointers
c.) It is an array of strings
d.) None of above
ANSWER: a.) It is an array of character pointers
13.) Which of the following statements are FALSE about the below code?
Int main (int ac, char *av[]) { }
a.) ac contains count of arguments supplied at command-line
b.) av[] contains addresses of arguments supplied at a command line
c.) In place of ac and av, argc and argv should be used
d.) The variables ac and av are always local to main()
ANSWER: c.) In place of ac and av, argc and argv should be used
14.) Queue can be used to implement
a.) radix sort
b.) quick sort
c.) recursion
d.) depth first search
ANSWER: a.) radix sort
15.) The depth of a complete binary tree is given by
a.) Dn = n log2n
b.) Dn = n log2n+1
c.) Dn = log2n
d.) Dn = log2n+1
ANSWER: d.) Dn = log2n+1
16.) The maximum length of a variable in c is:
a.) 8
b.) 16
c.) 32
d.) 64
ANSWER: a.) 8
17.) A link is:
a.) a compiler
b.) an active debugger
c.) a c interpreter
d.) a analyzing tool in c
ANSWER: d.) a analyzing tool in c
18.) c is a __________ language:
a.) high level
b.) low level
c.) middle level
d.) machine level
ANSWER: c.) middle level
19.) The choices file options and so are called:
a.) items
b.) reserved words
c.) terms
d.) queries
ANSWER: a.) items
20.) what among the following is a unconditional control structure:
a.) do-while
b.) if-else
c.) goto
d.) for
View Answer / Hide Answer
ANSWER: c.) goto