Vous êtes sur la page 1sur 8

Choose the correct answer

{
~Casting refers to implicit type conversion.
=Coercion refers to implicit type conversion.
~Casting means coercion.
~Coercion refers to explicit type conversion.
}

printf (“%d”, printf (“tim”));


{
~results in a syntax error
=outputs tim3
~outputs garbage
~outputs tim and terminates abruptly
}

Consider the following line of code


float a = 0.5, b = 0.7;
if (b < 0.8)
if (a < 0.5) printf (“ABCD”);
else printf (“PQR”);
else printf (“JKLF);
The output is
{
~ABCD
=PQR
~None of these
~JKLF
}

The following program fragment


int *a;
*a = 7;
{
~assigns 7 to a
~assigns address of a as 7
~results in compilation error
=segmentation fault
}

The control automatically passes to the first statement after the loop in
{
~continue statement
=break statement
~switch statement
~if statement
}

Unsigned integer occupies


{
~Two bytes
=Four bytes
~One byte
~Eight bytes
}

Each C preprocessor directive begins with


{
=#
~include
~main()
~<
}

What is the output of the following program segment?


long i = 65536;
printf(“%d\n”, i);
{
=0
~65536
~-1
~65
}

The number of arguments supplied from the command line, by convention, is known as
{
=arg c
~arg v
~#define
~#include
}

What will be the output of the following program segment?


char *p = “ayqm”;
printf (“%c”, ++*(p++));
{
=b
~z
~q
~n
}

What will be the output of following program segment?


int x=15;
printf(“\n%d%d%d”, x!=15, x=20, x<30);
{
=0, 20, 1
~15, 20, 30
~0, 0, 0
~Error
}

If a = 5 and b = 7 then the statement p = (a > b) : a ? b


{
~assigns a value 5 to p
~assigns a value 7 to p
~assigns a value 8 to p
=gives an error message
}

To access a structure element using a pointer, ___________ operator is used


{
~dot (.)
~pointer (&)
~pointer (*)
=arrow ( → )
}
When a key is pressed on the keyboard, which standard is used for converting the
keystroke
into the corresponding bits
{
~ANSI
=ASCII
~EBCDIC
~ISO
}

Which of the following is not a programming language?


{
=UNIX
~LISP
~BASIC
~ADA
}

puts(argv[0]);
{
~prints the name of the source code file.
~prints argv.
~prints the number of command line arguments.
=prints the name of the executable code file.
}

The postfix form of the following infix notation is : ( A + B ) * ( C * D − E ) * F


{
=AB + CD * E − * F *
~AB + CD − EF + − * *
~AB + CDE + − * F *
~ABCDEF * − + * +
}

The number of nodes in a complete binary tree of depth d (with root at depth 0) is
{
~2d − 1 + 1
=2d + 1 − 1
~2d − 1 − 1
~2d + 1 + 1
}

Inorder to get the information stored in a BST in the descending order, one should
traverse it in which of the following order?
{
~left, root, right
~root, left, right
=right, root, left
~right, left, root
}

Every internal node in a B-tree of minimum degree 2 can have


{
~2, 3 or 4 children
=1, 2 or 3 children
~2, 4 or 6 children
~0, 2 or 4 children
}
The number of comparisons required to sort 5 numbers in ascending order using
bubble sort is
{
~7
~6
=10
~5
}

The complexity of adding two matrices of order m*n is


{
~m + n
=mn
~max(m, n)
~min(m, n)
}

In a binary tree, the number of terminal or leaf nodes is 10. The number of nodes
with two children is
{
=9
~11
~15
~20
}

How many distinct binary search trees can be formed which contains the integers 1,
2, 3?
{
~6
=5
~4
~3
}

The result of evaluating the following postfix expression is


5, 7, 9, *, +, 4, 9, 3, /, +, -
{
~50
~65
=61
~69
}

The data structure needed to convert a recursion to an iterative procedure is


{
~Queue.
~Graph.
~Tree.
=Stack.
}

A binary tree stored using linked representation can be converted to its mirror
image by traversing it in
{
~Inorder.
=Preorder.
~Postorder.
~Any order.
}

The prefix form of an infix expression A+B-C*D is


{
~+AB-*CD.
~-+A B C * D.
=-+A B * C D.
~- + *ABCD.
}

The number of edges in a simple, n-vertex, complete graph is


{
~n*(n-2).
~n*(n-1).
=n*(n-1)/2.
~n*(n-1)*(n-2)
}

The largest and the second largest number from a set of n distinct numbers can be
found in
{
=O(n).
~O(2n).
~O(nxn).
~O(logn).
}

Applications of Linked List are


{
~Simulation , event driven systems
~Postfix and prefix manipulations
~Dictionary systems, polynomial manipulations
=Fixed block storage allocation, garbage collection
}

The extra key inserted at the end of the array is called a


{
~End Key
~Stop Key
=Sentinel
~Transposition
}

Which of the following operations is performed more efficiently by doubly linked


list than by singly linked list
{
=Deleting a node whose location is given.
~Searching of an unsorted list for a given item.
~Inserting a new node after node whose location is given.
~Traversing the list to process each node.
}

One can determine whether a Binary tree is a Binary Search Tree by traversing it in
{
~Preorder
=(B) Inorder
~Postorder
~Any of the three orders
}
What is the output of the following code
char symbol[3]={‘a’,‘b’,‘c’};
for (int index=0; index<3; index++)
cout << symbol [index];
{
~a b c
~“abc”
=abc
~‘abc’
}

In C++, dynamic memory allocation is accomplished with the operator ____


{
=new
~this
~malloc( )
~delete
}

If we create a file by ‘ifstream’, then the default mode of the file is _________
{
~ios :: out
=ios :: in
~ios :: binary
~ios :: app
}

You can read input that consists of multiple lines of text using
{
~the normal cout << combination.
~the cin.get( ) function with one argument.
=the cin.get( ) function with two arguments.
~the cin.get( ) function with three arguments.
}

The keyword friend does not appear in


{
~the class allowing access to another class.
~the class desiring access to another class.
=the private section of a class.
~the public section of a class.
}

The operator that cannot be overloaded is


{
~++
=::
~( )
~--
}

A struct is the same as a class except that


{
~there are no member functions.
~all members are public .
=cannot be used in inheritance hierarchy.
~it does have a this pointer.
}
Pure virtual functions
{
=have to be redefined in the inherited class.
~cannot have public access specification.
~are mandatory for a virtual class.
~None of the above.
}

Use of virtual functions implies


{
~overloading.
~static binding.
~overriding.
=dynamic binding.
}

this pointer
{
~implicitly points to an object.
~can be explicitly used in a class.
~can be used to return an object.
=All of the above.
}

Data members which are static


{
~cannot be assigned a value
=can only be used in static functions
~cannot be defined in a Union
~can be accessed outside the class
}

Which of the following is false for cin?


{
~It represents standard input.
~It is an object of istream class.
=It is a class of which stream is an object.
~Using cin the data can be read from user’s terminal.
}

It is possible to declare as a friend


{
~a member function
~a class
~a global function
=all of the above
}

Consider the following statements


char *ptr;
ptr = “hello”;
cout << *ptr;
What will be printed?
{
=first letter
~it is a syntax error
~entire string
~last letter
}

Which of the following declarations are illegal?


{
~void *ptr;
~char *str = “hello”;
=char str = “hello”;
~const *int p1;
}

What will be the result of the expression 13 & 25?


{
~38
~25
=9
~12
}

Vous aimerez peut-être aussi