Programming - C Viva Questions for Engineering Freshers Basics Tutorials
http://ingenuitydias.blogspot.com/2015/07/programming-c-viva-questions-for.html
1.) Which among the following is odd one out?
a.) printf
b.) fprintf
c.) putchar
d.) scanf
ANSWER: d.) scanf
2.) For a typical program, the input is taken using.
a.) scanf
b.) Files
c.) Command-line
d.) None of the mentioned
ANSWER: d.) None of the mentioned
Watchdog Timer Interview Questions
Structures Unions Enumeration - Flow-control in C
C Storage Classes
Variable Function And Structure
3.) What does the following command line signify? prog1I prog2
a.) It runs prog1 first, prog2 second
b.) It runs prog2 first, prog1 second
c.) It runs both the programs, pipes output of prog1 to input of prog2
d.) It runs both the programs, pipes output of prog2 to input of prog1
ANSWER: c.) It runs both the programs, pipes output of prog1 to input of prog2
4.) What is the default return-type of getchar()?
a.) char
b.) int
c.) char *
d.) Reading character doesn't require a return-type
ANSWER: b.) int
5.) The value of EOF is_____.
a.) -1
b.) 0
c.) 1
d.) 10
ANSWER: a.) -1
6.) What is the use of getchar()?
a.) The next input character each time it is called
b.) EOF when it encounters end of file
c.) Both a & b
d.) None of the mentioned
ANSWER: c.) Both a & b
7.) Which is true?
a.) The symbolic constant EOF is defined in
b.) The value is typically -1,
c.) Both a & b
d.) Either a or b
ANSWER: c.) Both a & b
8.) What is the use of putchar()?
a.)The character written
b.) EOF is an error occurs
c.) Nothing
d.) Both a & b
ANSWER: d.) Both a & b
9.) The size of string variable is:
a.) 1 byte
b.) 8 byte
c.) 16 bytes
d.) none of the above
ANSWER: d.) none of the above
10.) The continue command cannot be used with:
a.) for
b.) switch
c.) do
d.) while
ANSWER: b.) switch
11.) By default a real number is treated as a
a.) float
b.) double
c.) long double
d.) far double
ANSWER: a.) float
12.) Is the following statement a declaration or definition?
extern int i;
a.) Declaration
b.) Definition
c.) Function
d.) Error
ANSWER: a.) Declaration
13.) Identify which of the following are declarations
a.) extern int x;
b.) float square ( float x ) { ... }
c.) double pow(double, double);
d.) None of these
ANSWER: c.) double pow(double, double);
14.) When we mention the prototype of a function?
a.) Defining
b.) Declaring
c.) Prototyping
d.) Calling
ANSWER: b.) Declaring
15.) Which of the declaration is correct?
a.) int length
b.) char int
c.) int long
d.) float double
ANSWER: a.) int length
16.) Which of the following operations are INCORRECT?
a.) int i = 35; i = i%5
b.) short int j = 255; j = j
c.) long int k = 365L; k = k
d.) float a = 3.14; a = a%3
ANSWER: d.) float a = 3.14; a = a%3
17.) Which of the following correctly represents a long double constant?
a.) 6.68
b.) 6.68L
c.) 6.68f
d.) 6.68LF
ANSWER: b.) 6.68L
18.) What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
a.) The element will be set to 0.
b.) The compiler would report an error.
c.) The program may crash if some important data gets overwritten
d.) The array size would appropriately grow.
ANSWER: c.) The program may crash if some important data gets overwritten
19.) What does the following declaration mean?
int (*ptr)[10];
a.) ptr is array of pointers to 10 integers
b.) ptr is a pointer to an array of 10 integers
c.) ptr is an array of 10 integers
d.) ptr is an pointer to array
ANSWER: b.) ptr is a pointer to an array of 10 integers
20.) In C, if you pass an array as an argument to a function, what actually gets passed?
a.) Value of elements in array
b.) First element of the array
c.) Base address of the array
d.) Address of the last element of array
ANSWER: c.) Base address of the array
a.) printf
b.) fprintf
c.) putchar
d.) scanf
ANSWER: d.) scanf
2.) For a typical program, the input is taken using.
a.) scanf
b.) Files
c.) Command-line
d.) None of the mentioned
ANSWER: d.) None of the mentioned
Watchdog Timer Interview Questions
Structures Unions Enumeration - Flow-control in C
C Storage Classes
Variable Function And Structure
3.) What does the following command line signify? prog1I prog2
a.) It runs prog1 first, prog2 second
b.) It runs prog2 first, prog1 second
c.) It runs both the programs, pipes output of prog1 to input of prog2
d.) It runs both the programs, pipes output of prog2 to input of prog1
ANSWER: c.) It runs both the programs, pipes output of prog1 to input of prog2
4.) What is the default return-type of getchar()?
a.) char
b.) int
c.) char *
d.) Reading character doesn't require a return-type
ANSWER: b.) int
5.) The value of EOF is_____.
a.) -1
b.) 0
c.) 1
d.) 10
ANSWER: a.) -1
6.) What is the use of getchar()?
a.) The next input character each time it is called
b.) EOF when it encounters end of file
c.) Both a & b
d.) None of the mentioned
ANSWER: c.) Both a & b
7.) Which is true?
a.) The symbolic constant EOF is defined in
b.) The value is typically -1,
c.) Both a & b
d.) Either a or b
ANSWER: c.) Both a & b
8.) What is the use of putchar()?
a.)The character written
b.) EOF is an error occurs
c.) Nothing
d.) Both a & b
ANSWER: d.) Both a & b
9.) The size of string variable is:
a.) 1 byte
b.) 8 byte
c.) 16 bytes
d.) none of the above
ANSWER: d.) none of the above
10.) The continue command cannot be used with:
a.) for
b.) switch
c.) do
d.) while
ANSWER: b.) switch
11.) By default a real number is treated as a
a.) float
b.) double
c.) long double
d.) far double
ANSWER: a.) float
12.) Is the following statement a declaration or definition?
extern int i;
a.) Declaration
b.) Definition
c.) Function
d.) Error
ANSWER: a.) Declaration
13.) Identify which of the following are declarations
a.) extern int x;
b.) float square ( float x ) { ... }
c.) double pow(double, double);
d.) None of these
ANSWER: c.) double pow(double, double);
14.) When we mention the prototype of a function?
a.) Defining
b.) Declaring
c.) Prototyping
d.) Calling
ANSWER: b.) Declaring
15.) Which of the declaration is correct?
a.) int length
b.) char int
c.) int long
d.) float double
ANSWER: a.) int length
16.) Which of the following operations are INCORRECT?
a.) int i = 35; i = i%5
b.) short int j = 255; j = j
c.) long int k = 365L; k = k
d.) float a = 3.14; a = a%3
ANSWER: d.) float a = 3.14; a = a%3
17.) Which of the following correctly represents a long double constant?
a.) 6.68
b.) 6.68L
c.) 6.68f
d.) 6.68LF
ANSWER: b.) 6.68L
18.) What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
a.) The element will be set to 0.
b.) The compiler would report an error.
c.) The program may crash if some important data gets overwritten
d.) The array size would appropriately grow.
ANSWER: c.) The program may crash if some important data gets overwritten
19.) What does the following declaration mean?
int (*ptr)[10];
a.) ptr is array of pointers to 10 integers
b.) ptr is a pointer to an array of 10 integers
c.) ptr is an array of 10 integers
d.) ptr is an pointer to array
ANSWER: b.) ptr is a pointer to an array of 10 integers
20.) In C, if you pass an array as an argument to a function, what actually gets passed?
a.) Value of elements in array
b.) First element of the array
c.) Base address of the array
d.) Address of the last element of array
ANSWER: c.) Base address of the array
I had done C long long back...!! I don't remember codes now!! but looking at this it made me feel that its quite informative!!!
ReplyDelete