C-CAT Test Paper 2 (Section B)

Sr No Questions Answers
Sr No Questions Answers
01 In a'C' program constant is defined.
(a) before main
(b) after main
(c) anywhere
(d) none of the above
02 What does the term 'call-by-reference' refer to?.
(a) Passing a copy of a variable into a function.
(b) Passing a pointer to a variable into a function.
(c) Choosing a random value for a variable.
(d) A function that does not return any values.
03 Consider the following declaration ::- enum color {black=-1, blue, green }; This represents.
(a) black= -1,blue=2, green=3
(b) black= -1 ,blue = -2, green= -3
(c) black= -1 ,blue = 0, green= 1
(d) an illegal declaration
04 The macro FILE is defined in which of the following files.
(a) stdlib.h
(b) stdio.h
(c) io.h
(d) stdio.c
05 A function called total(), totals the sum of an integer array passed to it (as the first parameter) and returns the total of all the elements as an integer. Let the second parameter to the function be an integer which contains the number of elements of the array. The correct code is.
(a) int total( int numbers[], int elements ) {
(b) int total( int numbers[], int elements ) {
(c) int total( int numbers[], int elements ) {
(d) None of the above
06 What does the term call-by-value refer to?
(a) Passing a copy of a variable into a function
(b) Passing a pointer to a variable into a function
(c) Choosing a random value for a variable
(d) A function that does not return any values
07 Associativity of unary minus is.
(a) right to left
(b) left to right
(c) from center
(d) None
08 void main() { int I=0; for(;I= =2;) { printf("%d", I); I++; } }.
(a) 0
(b) 0 1 2
(c) 0 1
(d) No output
09 If ( ps->top=-1) return (true); else return (false); For this group of statements suggested shorter and more efficient method.
(a) return (1 (ps->top=+1) else return 0;
(b) return (ps->top==-1);
(c) return(top+1);
(d) it can not be made shorter
10 The fwrite() and fread() functions handle data in.
(a) text form
(b) binary form
(c) hexadecimal form
(d) octal form
11 When the language has the capability to produce new data type,it is called____.
(a) Extensible
(b) Encapsulation
(c) Overloading
(d) Overriding
12 ______ is the good example of a method that is shared by all instance of a class .
(a) Constructor
(b) Attribute
(c) Constructor and Attribute
(d) None of these options
13 Which of the following are class relationships?
(a) is-a relationship
(b) Part-of relationship
(c) Use-a relationship
(d) All of these options
14 Derived class inherits from base class.
(a) Data members
(b) Member function
(c) Constructor & destructor
(d) Both Data members and Member function
15 A contract is implemented through.
(a) Class
(b) Interface
(c) Abstract Class
(d) Interface and Abstract Class
16 Complex object composing of other object is called_____.
(a) Aggregation
(b) Assosiation
(c) Composition
(d) None of these options
17 A relationship that can be identified between two object entities (classes or individuals) is called a ___________.
(a) function
(b) association
(c) link
(d) activity
18 Which are the main three features of OOP language?
(a) Data Encapsulation, Inheritance & Exception handling
(b) Inheritance, Polymorphism & Exception handling
(c) Data Encapsulation, Inheritance & Polymorphism
(d) Overloading, Inheritance & Polymorphism
19 Cardinality can be represented as:
(a) 1?.n, where n represents an unlimited value.
(b) Only with a line between base class & derived classes
(c) A line with an arrow-head pointing in direction of parent or superclass.
(d) Cannot be represented in UML.
20 Method is another name of____:
(a) Function
(b) Attribute
(c) Behavior
(d) None of these options
21 Which of the following is the correct way of declaring a float pointer:
(a) float ptr;
(b) float *ptr;
(c) *float ptr;
(d) None of the above
22 Which of these are reasons for using pointers? 1.To manipulate parts of an array.
2.To refer to keywords such as for and if.
3.To return more than one value from a function.
4.To refer to particular programs more conveniently.

(a) 1 & 3
(b) Only 1
(c) Only 3
(d) All of the above
23 The purpose of declaring float (*x) (int(*a)[]); is to indicate :
(a) x is a pointer to a function that accepts an argument which is an array of pointers to integer quantities and returns a pointer to a floating point quantity.
(b) amibiguous declaration
(c) x is a pointer to a function that accepts an argument which is a pointer to an integer array and returns a floating point quantity.
(d) None of these options
24 void main() { int I,fun1(),fun2(),fun3(); int (*f[3])(); f[0]=fun1; f[1]=fun2; f[2]=fun3; for(I=0;I<3;I++) (*f[I])(); } fun1(){ printf("what");fun2();} fun2(){printf("happened");} fun3{printf("Tulika");} What is the output of this program?
(a) what happened Tulika
(b) what happened
(c) what happened happened Tulika
(d) Error:Invalid pointer assighnment
25 What is the output of the following code? #include
void main()
{
int arr[] = {10,20,30,40,50};
int *ptr = arr;
printf("\n %d\t %d\t",*++ptr, *ptr++);
}
(a) 30 20
(b) 30 10
(c) 20 30
(d) 30 30

26 The correct way for a structure in C to contain a pointer to itself is
(a) typedef struct { char *item; NODEPTR next; } *NODEPTR;
(b) struct node { char *item; struct node *next; }; typedef struct node *NODEPTR;
(c) Both are correct
(d) None of above

27 Individual structure member can be initialized in the structure itself
(a) True
(b) False
(c) Compiler dependent
(d) None of these options

28 Given the statements,
struct someone {
int age;
char *name;
} *person;
the C statement that will print out the name of the person is :
(a) printf("%s", person.name);
(b) printf("%c", person->name);
(c) printf("%s", someone.person->name);
(d) None of the above

29 The operation for adding an entry to a stack is traditionally called:
(a) Add
(b) Append
(c) Insert
(d) Push

30 Transform this expression to infix form? AB+C*DE--FG+$
(a) $+*ABC--FGDE$
(b) $+GF--ED*C+BA
(c) ((A+B)*C- (D-E))$(F+G)
(d) None of the above

31 Which data structure is needed to convert infix notation to postfix notation
(a) Linear list
(b) Queue
(c) Tree
(d) Stack

32 In the arrary representation of circular queue when can we say that the queue is full?
(a) Front=rear
(b) (rear+1)%max==front
(c) (rear-1)%max==front
(d) rear=front-1

33 For queue which of following are true
(a) It is an ordered list
(b) All the insertions are made at rear
(c) All the deletion are made from front
(d) All of the above

34 A linear list, in which elements can be added or removed at either end but not in the middle, is known as
(a) Queue
(b) Tree
(c) Stack
(d) Deque

35 What is the output of the following code? #include
void main()
{
int a = 0;
printf("\n %d\t", (a = 10/a));
}
(a) 0
(b) 1
(c) Compile Time error
(d) Runtime Error

36 Text file end with?
(a) `\n`
(b) Null value
(c) `\r`
(d) EOF

37 If you don`t initialize a static array, what will be the elements set to?
(a) 0
(b) an undetermined value
(c) a floating point number
(d) the character constant `\0`

38 12.34f is a ________ constant.
(a) string literal
(b) float literal
(c) double literal
(d) character literal

39 What is the output of the following code if user enters "This is a test"?
#include
void main()
{
char str[8];
scanf("%s",&str);
printf("\n%s",str);
}
(a) This is a test
(b) This is a
(c) This
(d) Error

40 What is the output of the following code? #include
void main()
{
/* this is /* an example */ of nested comment */
printf("\n123");
}
(a) 123
(b) Compile time error
(c) Run time Error
(d) None of these options

41 Encapsulation is
(a) Information hiding
(b) Data Binding
(c) Information hiding and Data Binding
(d) None of these options

42 Encapsulation prevents the program from becoming _______
(a) Lengthy
(b) Complicated
(c) Independent
(d) Interdependent

43 ______ is the property of an object that distinguishes it from all other object.
(a) Identity
(b) State
(c) Behaviour
(d) None of these options

44 What is the term used to describe the situation when a derived class provides a function already provided in the base class?
(a) Inheritance
(b) Polymorphism
(c) Overloading
(d) Both Inheritance & Overloading

45 Abstract class cannot have ________-.
(a) Zero instance
(b) Multiple instance
(c) Both Zero instance & Multiple instance
(d) None of these options

46 An object containing other object is called_____.
(a) Containing
(b) Composition
(c) Containing and Composition
(d) None of these options

47 What name is given to a collection of components or routines?
(a) Bank
(b) Namespace
(c) Library
(d) Schema

48 Which are the main three features of OOP language?
(a) Data Encapsulation, Inheritance & Exception handling
(b) Inheritance, Polymorphism & Exception handling
(c) Data Encapsulation, Inheritance & Polymorphism
(d) Overloading, Inheritance & Polymorphism

49 Peer-to-peer relationship is a type of
(a) Association
(b) Aggregation
(c) Link
(d) None of these options

50 The use of constructor is ______.
(a) to initialize the objects of it`s class.
(b) to allocate memory for the objects of it`s class only
(c) To initialize the objects of it`s class as well as to allocate memory for the objects of it`s class
(d) None of these options

2 comments:

  1. Yaar... the questions are very good but please try to give related answer to question...

    ReplyDelete