C Prog. Question Paper
C Prog. Question Paper
Who is the father of C Language? Bjarne Stroustrup Dennis Ritchie James A. Gosling Dr. E.F. Codd Dennis Ritchie
AT & T's Bell Laboratories of AT & T's Bell Laboratories Cambridge University AT & T's Bell Laboratories of USA in
C Language developed at _____? Sun Microsystems in 1973
USA in 1972 of USA in 1970 in 1972 1972
For 16‐bit compiler allowable range for integer
‐3.4e38 to 3.4e38 ‐32767 to 32768 ‐32768 to 32767 ‐32668 to 32667 ‐32768 to 32767
constants is ______ ?
C programs are converted into machine language with
An Editor A compiler An operating system None of the above A compiler
the help of
A special symbol other than
A C variable cannot start with An alphabet A number both (b) and (c) both (b) and (c)
underscore
Which of the following is allowed in a C Arithmetic
[] {} () None of the above ()
instruction
Which of the following shows the correct hierarchy of
/+*‐ *‐/+ +‐/* */+‐ */+‐
arithmetic operations in C
An array is a collection of An array is a collection of An array is not a collection of
An array is a collection of variables that
What is an array? variables that are of the variables that are of the variables that are of the same None of the above.
are of the same data type.
dissimilar data type. same data type. data type.
int num[6] = { 2, 4, 12, 5, 45, int n{} = { 2, 4, 12, 5, 45, 5 int n(6) = { 2, 4, 12, 5,
What is right way to Initialize array? int n{6} = { 2, 4, 12 } ; int num[6] = { 2, 4, 12, 5, 45, 5 } ;
5}; }; 45, 5 } ;
An array elements are always stored in _________
Sequential Random Sequential and Random None of the above Sequential
memory locations.
printf("%d%d",
What is the right way to access value of structure printf("%d%d", book.price, printf("%d%d", price.book, printf("%d%d", price::book,
price‐>book, printf("%d%d", price.book, page.book);
variable book{ price, page }? book.page); page.book); page::book);
page‐>book);
prints the error message prints the garbage value prints the error message specified by
perror( ) function is used to ? Work same as printf() None of the above
specified by the compiler assigned by the compiler the compiler
Bitwise operators can operate upon? double and chars floats and doubles ints and floats ints and chars ints and chars
The basic element
The smallest individual unit The largest individual unit of
What is C Token? recognized by the A & B Both A & B Both
of c program program
compiler
Keyword have some
Keyword have some Keyword have some predefine
unknown meaning and Keyword have some predefine meaning
What is Keyword? predefined meaning and this meaning and these meaning None of the above
this meaning cannot be and these meaning cannot be changed.
meaning can be changed. cannot be changed.
changed.
Constant have fixed values Constant have fixed values Constant have unknown values Constant have fixed values that do not
What is constant? that do not change during that change during the that may be change during the None of the above change during the execution of a
the execution of a program execution of a program execution of a program program
Which is the right way to declare constant in C? int constant var =10; int const var = 10; const int var = 10; B & C Both B & C Both
Which operators are known as Ternary Operator? ::, ? ?, : ?, ;; None of the above ?, :
In switch statement, each case instance value must be
Constant Variable Special Symbol None of the above Constant
_______?
Question Option 1 option2 option3 option4 actual answer
Restart execution of
What is the work of break keyword? Halt execution of program Restart execution of program None of the above Restart execution of program
program
Function is the
Function is a block of fundamental modular unit. Function is a block of code that
What is function? statements that perform A function is usually performs a specific task. It has a All the above All the above
some specific task. designed to perform a name and it is reusable
specific task.
A keyword used to create A variable that stores A variable that stores address of A variable that stores address of other
A pointer is All of the above
variables address of an instruction other variable variable
The operator used to get value at address stored in a
* & && || *
pointer variable is
Which of the following function sets first n characters
strinit() strnset() strset() strcset() strnset()
of a string to a given character?
If the two strings are identical, then strcmp() function
-1 1 0 Yes 0
returns
How will you print \n on the screen? printf("\n"); echo "\\n"; printf('\n'); printf("\\n"); printf("\\n");
The library function used to find the last occurrence of
strnstr() laststr() strrchr() strstr() strrchr()
a character in a string is
When we mention the prototype of a function? Defining Declaring Prototyping Calling Declaring
Which of the following function is more appropriate
printf(); scanf(); gets(); puts(); gets();
for reading in a multi-word string?
Question Option 1 option2 option3 option4 actual answer
In a file contains the line "I am a boy\r\n" then on
reading this line into the array str using fgets(). What I am a boy\r\n\0 I am a boy\r\0 I am a boy\n\0 I am a boy I am a boy\n\0
will str contain?
What is the purpose of "rb" in fopen() function used open "source.txt" in binary
open "source.txt" in binary Create a new file "source.txt" open "source.txt" in binary mode for
below in the code? FILE *fp; mode for reading and None of above
mode for reading for reading and writing reading
fp = fopen("source.txt", "rb"); writing
standard error
What is stderr ? standard error standard error types standard error streams standard error streams
definitions
To print out a and b given below, which of the
printf("%f %lf", a, b); printf("%Lf %f", a, b); printf("%Lf %Lf", a, b); printf("%f %Lf", a, b); printf("%f %lf", a, b);
following printf() statement will you use?
Out of fgets() and gets() which function is safe to use? gets() fgets() fgets()