The C compiler used for UNIX operating system is
1. cc
(Compiler used for UNIX is 'cc' their full form is C compiler. gcc is compiler for linux. Borland and vc++ is compiler for windows.)
Which keyword is used to transfer control from a function back to the calling function?
1. return
Which function finds the first occurrence of a substring in another string?
3. strstr()
What is the Format specifier used to print a String or Character array in C Printf or Scanf function.?
1) %c
2) %C
3) %s
4) %w
3) %s
Which operator can be used for accessing the value stored at address of a pointer variable?
2. *
The pointer operator is,
& (address operator) = It gives address of the variable
*(Value operator) = It gives value stored at particular addre
Which format specifier is used for printing double value?
3.%lf
Which statements are correct about an if-else statement in a C-program?
1. 1, 3 and 4
Which library function can change an unsigned long integer to a string?
3. ultoa()
The function ultoa() is used for converting an unsigned long integer to a string.
Which of the function is more appropriate for reading a multi-word string?
2. gets()
Are the expression ++*ptr and *ptr++ are same?
2. False
++*ptr increments the value pointed by ptr and*ptr++ increments the pointer not the value.
What are the various types of real data type in C language?
4. float, double, long double
Floating data type is known as real data type.
There are three types of floating data type:
Can we use switch statement to switch on strings in C?
2. No
In switch statemen,t the cases must be either constant expression or an integer constant.
Therefore it is not allowed to use switch statement to switch on strings in C programming.
What is passed when we pass an array as a function argument?
1. Base address of an array
On passing the name of array as function argument; the name contain the base address of an array and base address is updated inside a main function.
Which of the following statements are correct about string?
In a structure, if a variable works as a pointer then from the given below operators which operator is used for accessing data of the structure using the variable pointer?
2. ->
For a structure, Arrow ( ->) is used for access the data using pointer variable and Dot(.) operator can be used for accessing the data using normal structure variable.
Which is used in mode string for opening the file in binary mode?
3. b
For opening the file in binary mode the alphabet 'b' is used in mode string. To perform unformatted data I/O a file is opened in binary mode.
Which of the following statements are correct about for loop in C-program?
The options are given below:
4. 1, 2, 4
What is the purpose of using fflush() function?
4. Flushes all streams and specified buffer.
Using "flush()" function we can flush any buffered output associated with a filename, which is either a shell command for redirecting output or a file opened for writing.
Which of the following statement is correct?
What is the similarity between a structure, union and enumeration?
How would you round off a value from 1.66 to 2.0?
2. ceil(1.66)
The ceil(1.66) is used for round off a value from 1.66 to 2.0. The ceil() returns upper value of a fractional part and floor() returns lower value.
Which of the following statements are correct about array in C?
2. 2,3
For the below mention C statement, what is your comment?
signed int *p=(int*)malloc(sizeof(unsigned int));
4. No problem with the statement
The size of int and unsigned data type is same therefore there is no problem in a C statement:
signed int *p=(int*)malloc(sizeof(unsigned int));
What will be the output of the below program?
#include<stdio.h>
main()
{
struct { int y;} var = {4}, *a = &var;
printf("%d %d %d",var.y,a->y,(*a).y);
}
3. 4 4 4
The two possible methods of accessing structure elements using pointer is by using * or -> (arrow operator).
Therefore the output of a program is 4 4 4
Find out the error in the below program?
2. Error: in structure declaration
The structure employ contains a member 'e' of a same data type i.e. struct employ.
In this stage the compiler does not know the size of structure.
Therefore the compiler returns Error: in structure declaration.