THROUGH ‘C’ LANGUAGE JULY 2017
Q.1. Multiple Choice of Answers.
1.1 Which one is incorrect statement for C Language?
A) C compiler supports octal integer constant.
B) C compiler supports hexadecimal integer constant.
C) C compiler supports binary integer constant.
D) C compiler supports decimal integer constant
1.2 What will be the output of the following code?
Int main()
{
Int x,y,z;
X=’1’-‘0’;
Y=’a’-‘b’;
Z=x+y;
Printf(“%d”,z);
}
A) 0
B) Error because of incorrect line-1 only.
C) Error because of incorrect line-1 and line-2.
D) Error because of incorrect line-2 only.
1.3 *ptr++ is equivalent to
A) ptr++
B) *ptr
C) ++ptr
D) ++*ptr
1.4 Which of the following is not a proper storage class
A) auto
B) dcc
C) static
D) extern
1.5 Which of the following cannot be used as identifiers?
A) spaces
B) digits
C) underscores
D) letters
1.6 How many times is a do.. while loop guaranteed to loop?
A) 0
B) Infinitely
C) 1
D) Variable
1.7 Precedence is used
A) To determine which operator evaluated first from left to right.
B) To determine the level of an operator in a program.
C) To determine how an expression involving more than one operator is evaluated.
D) To check the expression is valid or not.
1.8 Identify the correct sequence of steps to run a program
A) Link, Load, Code, Compile & Execute
B) Code, Compile, Link, Execute & Load
C) Code, Compile, Link, Load & Execute
D) Compile, Code, Link, Load & Execute
1.9 What will be the output of the following code?
Int main()
{
Int x=0,y=0;
If(x>0)
If(y>0)
Printf(“true”);
Else
Printf(“false”);
}
A) Blank screen
B) True
C) False
D) Error because of dangling else problem
1.10 What will be the output of the following code?
Int main()
{
Int i=2,*j;
J=&I;
Printf(“%d”,i**j*i+*j);
}
A) Syntax error due to Invalid expression in printf
B) Print junk value
C) 16
D) 10
Q.2. TRUE or FALSE.
2.1 Two pointer variables cannot be subtracted.
FALSE
FALSE
2.2 1.0 is an example of double constant and float constant.
FALSE
2.3 #define is used to define symbolic constant.
TRUE
2.4 const is a keyword that is used to define symbolic constant.
FALSE
2.5 Two dimensional array is stored in memory physically as one-dimensional array.
TRUE
2.6 size of a pointer, which points to a structure, depends on size of a structure.
TRUE
2.7 All the members of a union share the same memory location.
TRUE
2.8 break keyword is mandatory in switch case structure.
FALSE
2.9 Using fprintf function, we can print on the standard output device.
FALSE
2.10 It is better to use array than a linked list, when there is a fixed size list in a program. TRUE
Q.3. Match words and phrases
SR NO. | X | Y(Ans.) |
1 | It is an operator that calculates size of a structure variable | sizeof |
2 | Function that reverse a string | strrev |
3 | Constant value 32767L is an example of | long integer |
4 | Address of arguments is passed in this method of passing | pass by address |
5 | It is an unconditional jump statement | goto |
6 | Data type that can store only 0 and positive numbers | Unsigned integers |
7 | All the string constant must be covered between this symbo | Double quotation |
8 | It is a keyword used to assign alternative name to existing data type | typedef |
9 | Data type of 45.2f is | Float |
10 | Return type of printf function is | integer |
Q.4. Fill in the blank
4.1 ____asterisk____ symbol is used access the value pointed by a pointer.
4.2 When an array is declared, array name is defined as ___constant pointer_____ to first element.
4.3 M_PI is a constant that represents 22/7 ratio. It is declared in ____math.h____ header file.
4.4 ____ scanf( )____ function reads data from stdin stream.
4.5 Default return type of any user-defined function is __integer______.
4.6 in do while loop ____semicolon____ symbol is require after condition.
4.7 We must use __dot______ symbol to access structure members.
4.8 ___Linked list_____ data structure facilitates to insert and delete data during the program execution.
4.9 Global variable is initialized to ___zero_____ by default.
4.10 A pair of question mark and colon is known as ___conditional operator_____.
Options.
A. semicolon
B. conditional operator
C. asterisk
D. dot
E. math.h
F. scanf( )
G. Linked list
H. integer
I. zero
J. void
K. array
L. ctype.h
M. constant pointer
Long Questions
(Answer any four questions)
Q.5.
a) Write a program that accept an array of 10 integers and a number to be deleted from the array if found. Represent deleted element with -1 and display final array. If not found print appropriate message.
b) Explain the role of linker and loader in compilation.
c) Explain the relation of array and pointer with example.
(7+4+4)
Q.6.
a) Draw a flow chart to print the factorials of numbers from 1 to n where n is entered by user.
b) Write a function to display the multiplication table of the number.
c) Write a function which accepts an array of size n containing integer values and returns average of all values. Call the function from main program.
(5+5+5)
Q.7.
a) Write a program to print all the Krishnamurti number from 1 to n. Here, n is user dependent. A Krishnamurti number is a number whose sum of factorial of individual digits equals the number. For example, 145 = 1! + 4! + 5! = 1 + 24+ 120 = 145.
b) Define a structure Distance having two data members: cm and mm in integer. The program enters three variables and find which distance is the largest among them. (8+7)
Q.8.
a) Using a switch statement, write a function to count the number of vowels and number of blanks in a character array passed to it as an argument.
b) Which are the demerits of linked list data structure?
c) Explain working of bit-wise exclusive OR and shift left operators in C with example.
(7+4+4)
Q.9.
a) Write a program to find greatest number in an array?
b) Explain the concept of recursion with example.
c) Explain the difference between Test mode and Binary mode files.
(8+3+4)
Post a Comment
Leave a Reply