What does the following C-statement declare?
int (*f) (int *);
int (*f) (int*);
return type int, (*f) is a pointer to a function the argument is (int*) an integer pointer So, int (*f) (int*) means a pointer to a function that takes an integer pointer as an argument and returns an integer.
An Abstract Data Type (ADT) is
The abstract data type (ADT) refers to a programmer defined data type together with a set of operations that can be performed on that data so the choice (c) is correct.
A common property of logic programming languages and functional languages is
A common property of logic programming languages and functional languages is both are declarative because we declare any statement before we will use it.
Which of the following are essential features of an object-oriented programming languages?
1. Abstraction and encapsulation
3. Type-safe property coupled with sub-type rule
4. Polymorphism in the presence of inheritance
Object oriented programming language is Object based PL + Abstraction + Inheritance.
The last two (abstraction and inheritance) are must for any L to be OOPL.
Early binding refers to a binding performed at compile time and late binding refers to a binding performed at execution time. Consider the following statements:
(i) Static scope facilitates w1 bindings.
(ii) Dynamic scope requires w2 bindings.
(iii) Early bindings w3 execution efficiency.
(iv) Late bindings w4 execution efficiency.
The right choices of w1, w2, w3 and w4 (in that order) are
(i) Static scoping facilitate early binding because it is done at compile time.
(ii) Dynamic scoping require late binding because it is done at runt time.
(iii) Early binding increases execution efficiency because both necessary and uncessary things are load at compile time.
(iv) Late binding decrease execution efficiency because only necessary things are loaded when they are needed.
Match the programming paradigms and languages given in the following table:
Imperative: C, Fortran 77, Pascal
Object oriented : C + + , Smalltalk, Java
Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression?
a = (x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)
a = (x < y) ? ((x < z) ? x : z) : ((y > z) ? y: z)
In C “ ? is a ternary operator the syntax is (exp1 ? exp2 : exp3). it means if exp1 is true print exp2 else exp3.
Let x = 3, y = 4, z = 2.
⇒ a = (3 > 4) ? ((3 > 2) ? 3 : 2 ) : ((4 > 2) ? 4 : 2)
a = (3 > 4) ? 3 : 4
a = 4
What does the following program print?
In the given program it begin from main function, i and j are globally initialized by 0 and 1. So when we call function f(& i, & j) the address of i and j are passed.
when p = q and *p = 2 means
*q = 2, so value of *q is passed.
and value of *q return to j.
Value of i and j are 0 and 2 respected.
So print i (“ % d % d ”, i, j) gives output (0, 2).
What is the value printed by the following C program?
So f(a, 6) → first this call
Thus is the number stored in the array and we can access these by using
What does the following fragment of C program print?
P + P - P = 2000 + 69 - 65
⇒ 2011 string will be printed.
(From 2004 Address)
Consider the following program in C language:
Which one of the following statements is TRUE?
Consider the C function given below:
Which one of the following is TRUE?
f(50) goes into infinite loop by calling f(i) recursively for i = j = 50.
Consider the following C program segment:
What will be printed by the program?
Therefore the output is 1204
Which of the following comments are not true?
1. C provides no input-output features
2. C provides no file access features
3. C borrowed most of its ideas from BCPL
4. C provides no features to manipulate composite objects
BCPL: Basic Combined Programming Language primary used for system software and called simply B.
Which of the following are not keywords in C?
"if" is keyword in C not “IF”.