July 5, 2021 in C and CPP, Learning
Is it legal to put a function declaration inside the body of another function? If yes, give an example.
Is it legal to put a function declaration inside the body of another function? If yes, give an
example.
July 5, 2021 in C and CPP, Learning
Is it legal to put a function declaration inside the body of another function? If yes, give an
example.
July 5, 2021 in C and CPP, Learning
Does the null statement have any uses besides indication that the body of a loop is empty?
Explain.
July 5, 2021 in C and CPP, Learning
a) Discuss with the help of examples the action of break statement and the continue statement.
July 5, 2021 in C and CPP, Learning
4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in
the list below. Enter your choice in the “tear-off” answer sheet attached to the
question paper, following instructions therein. (1 x 10)
A. Change B. trinary C. - operator
D. Automatic E. Variable F. “&” operator
G. Static H. Dynamically I. Externally
J. void K. A character L. An integer
M. EOF N. fclose O. True
4.1 printf( ) function uses _________ number of arguments.
4.2 ________ can be used as both binary and unary operators.
4.3 Link lists can be created _____________.
4.4 Loop invariants are assertions that remain _______ before and after execution of loops.
4.5 File descriptor is ______________.
4.6 Pointer arguments enable a function to access and _____ objects defined in the calling
routine.
4.7 The function getchar( ) returns _______ when there is no more input character.
4.8 Any pointer can be cast to __________ without loss of information.
4.9 To prevent the use of functions across different files, ____ storage class is used.
4.10 ? : is ________ operator.
July 5, 2021 in C and CPP, Learning
2. Each statement below is either TRUE or FALSE. Choose the most appropriate one
and ENTER in the “tear-off” sheet attached to the question paper, following
instructions therein. (1 x 10)
2.1 It is not possible to print the % character as the function printf treats % as the beginning
of a conversion specification.
2.2 A structure can include one or more pointers as members.
2.3 It is not possible to have formatted input / output in ‘C’.
2.4 It is not possible to have nested if – else statements in ‘C’.
2.5 The increment operator ++ does not work with float variable.
2.6 *a is the same as a[ ] in a parameter declaration.
2.7 In ‘C’ programming language, strings are represented using an array.
2.8 Relational operators have higher precedence than arithmetic operators.
2.9 A structure cannot be a member of a union.
2.10*p++ increments the content of the location pointed by p.
July 5, 2021 in C and CPP, Learning
1.10If a = 0´aa and b = a << 1 then which of the following is true
A) b = a
B) b = 2a
C) a = 2b
D) b = a – 1
July 5, 2021 in C and CPP, Learning
1.9 What will be the output of the following program?
main()
{
int a, *ptr, b, c;
a = 25;
ptr = &a;
b = a + 30;
c = *ptr;
printf(“%d %d %d”, a, b, c);
}
A) 25, 25, 25
B) 25, 55, 25
C) 25, 55, 25
D) None of the above
July 5, 2021 in C and CPP, Learning
1.8 Which one of the following describes correctly a static variable?
A) This cannot be initialized.
B) This is initialized once at the commencement of execution and cannot be changed at run
time.
C) This retains its value through the life of the program.
D) This is same as an automatic variable but is placed at the head of a program.
July 5, 2021 in C and CPP, Learning
1.7 If c is a variable initialized to 1, how many times will the following loop be executed?
while(( c > 0 && (c < 60))
{
c ++;
}
A) 61
B) 60
C) 59
D) 1
July 5, 2021 in C and CPP, Learning
1.6 If a = -11 and b = -3. What is the value of a % b?
A) – 3
B) – 2
C) 2
D) 3