0% found this document useful (0 votes)
11 views

C Prog. Question Paper

The document contains a series of questions and multiple-choice options related to the C programming language, covering topics such as C language history, data types, operators, functions, and memory management. Each question includes four options with one correct answer indicated. The content serves as a quiz or study guide for individuals learning or reviewing C programming concepts.

Uploaded by

iminfinity888
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

C Prog. Question Paper

The document contains a series of questions and multiple-choice options related to the C programming language, covering topics such as C language history, data types, operators, functions, and memory management. Each question includes four options with one correct answer indicated. The content serves as a quiz or study guide for individuals learning or reviewing C programming concepts.

Uploaded by

iminfinity888
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Question Option 1 option2 option3 option4 actual answer

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.

The body of a do ... while A for loop can never


The body of a while loop is The body of a do ... while loop is The body of a do ... while loop is
Which one of the following sentences is true ? loop is executed at least be used in place of a
executed at least once. executed zero or more times. executed at least once.
once. while loop.
External, Internal and
What are the types of linkages? Internal and External External and None Internal External, Internal and None
None
Which of the following special symbol allowed in a
* (asterisk) | (pipeline) (hyphen) _ (underscore) _ (underscore)
variable name?
How would you round off a value from 1.66 to 2.0? ceil(1.66) floor(1.66) roundup(1.66) roundto(1.66) ceil(1.66)
By default a real number is treated as a float double long double far double double
The keyword used to transfer control from a function
switch goto go back return return
back to the calling function is
Representation of NULL Representation of void
What is (void*)0? Error None of above Representation of void pointer
pointer pointer
In which header file is the NULL macro defined? stdio.h stddef.h stdio.h and stddef.h math.h stdio.h and stddef.h
If a variable is a pointer to a structure, then which of
the following operator is used to access data members .(dot) & * -> ->
of the structure through the pointer variable?

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()

In which numbering system can the binary


Decimal system Hexadecimal system Octal system No need to convert Hexadecimal system
number 1011011111000101 be easily converted to?
Which bitwise operator is suitable for turning off a
&& operator & operator || operator ! operator & operator
particular bit in a number?
Which bitwise operator is suitable for turning on a
&& operator & operator || operator | operator | operator
particular bit in a number?
Which bitwise operator is suitable for checking
&& operator & operator || operator ! operator ! operator
whether a particular bit is on or off?
Which standard library function will you use to find the
strnchar() strchar() strrchar() strrchr() strrchr()
last occurance of a character in a string in C?
Reposition the file
Reposition the file pointer to Reposition the file pointer Reposition the file pointer to Reposition the file pointer to begining
What will the function rewind() do? pointer to begining of
a character reverse. stream to end of file. begining of that line. of file.
file.
Input/output function prototypes and macros are
conio.h stdlib.h stdio.h dos.h stdio.h
defined in which header file?
Constant variables need not
const keyword is used Constant variables need not be defined
be defined as they are Global constant variables You cannot reassign a value to a
Which of the following statement is false? to define constant as they are declared and can be defined
declared and can be defined are initialized to zero constant variable
values later
later
calloc() returns a storage that is initialized to Zero Null Nothing One Zero
Which of the following is used during memory
remove(p) delete(p) free(p) terminate(p) free(p)
deallocation in C?
Which mathematical function among the following
div(x, y) srand(x) sqrt(x) all of the mentioned sqrt(x)
does NOT require int parameters
Which among the following mathematical function do both ceil(x); and
srand(x) ceil(x) floor(x) srand(x)
not have a “double” return‐type? floor(x)
What is an example of iteration in C? for while do-while all of the mentioned all of the mentioned
Which loop is most suitable to first perform the none of the
for loop while loop do-while loop do-while loop
operation and then test the condition? mentioned
Question Option 1 option2 option3 option4 actual answer
Which among the following is the odd one out? printf putchar fprintf scanf scanf
For a typical program, the input is taken using
scanf Files Command-line All of the mentioned All of the mentioned
_________
reading character
What is the default return-type of getchar()? char int char * doesn’t require a int
return-type
Strlen Function returns ____ Data type ? int char floot void int
Every C program starts from ____ Function strlen strcpy # include mainu mainu
C is the offspring of _____ Language BCBL ABCD BCPL None BCPL
In C Programming you can Defined your own function TRUE FALSE TRUE
If any function does not return anything then it is
main int void none void
noted by
Following Operator returns remainder when a number
strlen void % / %
is divided by another
In getch () function 'e' represent_____ edit echo eat none echo
Goto statement is Conditional transfer of control TRUE FALSE FALSE
If Statement can be Written without 'else' TRUE FALSE TRUE
From the Following which statement is used for
if switch if & switch do..while do..while
looping?
_____ Statement is used to the end of each case end Continue exit break break
backlash character
'in', 'it' are called______ Control character new line tab backlash character constants
constants
Backlash Character Constant has length
Two Three One four One
of___Characters
Which of the following is not a valid variable name
float PI = 3.14; double PI = 3.14; int PI = 3.14; #define PI 3.14 #define PI 3.14
declaration?
C Language is developed by ____________? Ken Thompson Martin Richards Bjarne Stroustrup Dennis Ritchie Dennis Ritchie
C is a case sensitive language state whether it is true or
TRUE FALSE TRUE
false?
Array is a single name given to a collection of different
TRUE FALSE FALSE
data types data state whether it is true or false

You might also like