Thursday, July 29, 2010
C Question Set 1-7
Question 1
'C' is a
machine language
low level language
middle level language
high level language
Question 2
What is the error in the program?
char count;
main()
{
int count = 70;
{
extern int count;
printf("\n %d ", count);
}
}
Error: Type mismatch in redeclaration of ' nn'
Error: Multiple declaration for 'nn'
Error: Storage class 'extern' is not allowed here
Linker Error: Undefined symbol 'nn'
Question 3
What is the output of the program?
void main()
{
int val = (5, val = 5)/++val;
printf("\n %d ", val);
}
5
1
6
0
Question 4
Which of the following statements is used to return more than one value from a function?
return 1,2,3 ;
return (1,2,3) ;
return ((1), (2), (3));
None of the above
Question 5
Which of the following is wrong with respect to structures?
Having the same name for a structure and its variable
It has functions as its data members
It has a data member, which is of the same structure kind
Both B and C
Question 6
What is the error in the code shown below?
union
{
int val1 : 5;
char val2;
};
Declaration of variables is not possible due to the absence of tag name
Arrays of this union cannot be created
Cannot be used in file handling
All the three B, C and D
Question 7
What is an '&' operator?
logical
unary
bitwise
ternary
Question 8
What is the difference between malloc and calloc?
in allocation of memory
in return types
number of arguments
None of the above
Question 9
What is the default promotion for 'float' in va_arg?
double
int
long int
char
Question 10
What is the error in the program?
main()
{
int a = 12;
int *ptr = &a;
printf( " %d %d ", *ptr /*ptr, *ptr**ptr);
}
No error, output is 1 144
No error, output is 144 144
Unexpected end of file found
Error: illegal pointer operation
Question 11
What is the significance of the function realloc()?
realloc() adjusts the size of the allocated block to specified size
realloc() allocates memory on far heap
It is used to allocate more than 64k bytes
realloc() allocates the specified number of bytes in registers
Question 12
What is the error in the program?
main()
{
typedef struct personal
{
int name[25]:15;
}
personal; personal person;
}
Error: Bit fields must be signed or unsigned int
Error: Multiple declaration for 'personal'
Error: Undefined symbol 'personal'
Error: Size of the type is unknown or zero
Question 13
What is the return type of fflush()?
void
FILE*
char*
int
Question 14
What is the error in the program?
void myprintf()
{
printf("\n %d ", printf("Genesis"));
}
main() {
printf("\n %d ", myprintf());
}
Error: Type mismatch in 'printf'
The return type of a function must be an integer
Error: printf cannot return anything
Cannot convert from 'void' to '...'
Question 15
What is the meaning of a static function?
It is local to a file in which it is declared
It is local to main()
The set of variables used in the function is 'static'
All the linked files can access it
Question 16
What is the output of the program?
# include <stdio.h>
void main()
{
int main = 90;
top : printf("Label1");
if(main)
goto top;
}
Infinite
Label1
No output
label top is invalid
Question 17
How many times is the 'for' loop/statement is executed in the following code.
main()
{
unsigned char ch;
for(ch = 0; ch <= 255; ch++);
}
Infinite
255
256
127
Question 18
What is maximum number of 'case' values in a switch statement?
255
127
No specific limit
128
Question 19
What is the output of the program?
void main()
{
int x = (90, x = 90)+++x;
printf("\n %d ", x);
}
90
1
181
91
Question 20
Where do we use a 'continue' statement?
In 'if' statement
In 'switch' statement
In 'goto' labels
None of the above
Answers
Answer 1 - C
Answer 2 - A
Answer 3 - B
Answer 4 - D
Answer 5 - D
Answer 6 - D
Answer 7 - C
Answer 8 - C
Answer 9 - A
Answer 10 - C
Answer 11 - A
Answer 12 - A
Answer 13 - D
Answer 14 - D
Answer 15 - A
Answer 16 - A
Answer 17 - A
Answer 18 - C
Answer 19 - C
Answer 20 - D
C Question Set 1-6
Question 1
What is the output of the program?
#include <stdio.h>
// Assume size of integer as 4 bytes
void main()
{
char (*p)[3];
printf("\n %d %d", sizeof(*p), sizeof(p));
}
12 4
3 4
1 3
4 12
Question 2
What is the output of the program?
#include <stdio.h>
void main()
{
const char* ptr = "Genesis";
printf(" %c ", (*++ptr)++);
}
No error, output is e
No error, output is n
No error, output is G
l-value specifies const object
Question 3
The functionality of "ferror(FILE *)" is
ferror is a macro that tests the given stream for a read error only
ferror is a macro that tests the given stream for a file open error
ferror is a macro that tests the given stream for a read or write error
ferror is a macro that tests the given stream for a file close error
Question 4
Which of the following function does not return an integer value?
printf
scanf
strcpy
strlen
Question 5
What is the output of the program?
#include <stdio.h>
main()
{
static char Arr[8] = "Genesis";
char* ptr = &Arr[6] - 3;
printf("\n %s", ptr);
}
e
sis
esis
n
Question 6
Which of the following functions support dynamic memory allocation?
malloc
realloc
calloc
All the three A, B and C
Question 7
What is the significance of putw() function?
writes only character data to the file in text mode
writes only integer data to the file in binary mode
writes integer data to the file in text mode
writes character data to the file in binary mode
Question 8
What is the output of the program?
#include <stdio.h>
main()
{
for( ; ; )
main();
}
Error: syntax error at or before;
Executes once
It will result in infinite loop until stack overflow occurs
Error: illegal call to function main()
Question 9
What is the output of the program?
#include <stdio.h>
// Assume integer is 4 bytes
struct {
char *p;
int (*fun)();
} a;
void main()
{
printf("\n %d %d %d ", sizeof(a), sizeof(a.p), sizeof(a.fun));
}
8 4 4
5 1 4
6 2 4
Error: pointer to functions is not allowed in structures
Question 10
What is the output of the program?
#include <stdio.h>
void main()
{
int Var = 90;
if(Var += Var == ++Var == 89)
printf(" %d ",Var);
}
180
91
90
182
Question 11
Which of the functions always write the output to Video Display Unit?
puts
putc
putch
fputs
Question 12
Which of the declarations cannot be performed above main()?
variables of auto storage class
enum declaration
variables of extern storage class
static union declaration
Question 13
What is the output of the program if the input is 103?
main()
{
int p = 234;
printf(" %d ", printf("%d", p), scanf("%d", &p));
}
3 103
103
103 3
103 2
Question 14
What is the difference between scanf() and gets() while scanning a bunch of characters??
scanf() takes input from stdin, but gets() gets input from console
scanf() put a null at the end of the string, but gets() does not
gets() can scan even the spaces, but scanf() cannot
None of the above
Question 15
Which of the functions compares two strings ignoring the case?
strcmp
strncmp
stricmp
strcpy
Question 16
What is the output of the program?
int fun(int num)
{
return printf(" %d ", num);
}
void main()
{
printf(" Genesis ", fun(123), " & Genesis");
}
123 Genesis
Genesis 123
3 Genesis
None of the above
Question 17
What is the output of the program?
void print(char *s)
{
if(*s)
print(++s);
printf("%c", *s);
}
main()
{
char str[] = "Genesis";
print(str);
}
genesis
sisene
siseneg
None of the above
Question 18
Where will the output of the program be printed?
main()
{
fprintf(stdprn, "Genesis InSoft Limited") ;
}
Standard output device
Standard error output device
Standard auxiliary device
Standard printer
Question 19
What is the output of the program?
const int MAX = 15;
void main()
{
enum e{a, b, MAX};
printf("%d %d %d", a, b, MAX);
}
0 1 2
1 2 3
1 2 15
0 1 15
Question 20
What is the purpose of the fcloseall() function?
closes all the streams including standard streams
closes all the streams other than standard streams
closes all the input streams
closes all the output streams
Answers
Answer 1 - B
Answer 2 - D
Answer 3 - C
Answer 4 - C
Answer 5 - C
Answer 6 - D
Answer 7 - B
Answer 8 - C
Answer 9 - A
Answer 10 - B
Answer 11 - C
Answer 12 - A
Answer 13 - C
Answer 14 - D
Answer 15 - C
Answer 16 - A
Answer 17 - B
Answer 18 - D
Answer 19 - A
Answer 20 - B
C Question Set 1-4
Question1
Reusability of code in C is supported by
Functions
Macros
Pointers
Files
Question 2
The entry point of the 'C' program is with
#include
main(int argc, char * argv)
c_main
MAIN()
Question 3
When a const variable is declared, it is stored
in RAM
in ROM
on heap
in CPU registers
Question 4
What is the output of the program?
#include <stdio.h>
int main(int argc, char *argv[])
{
printf(" %d", printf("Hello Genesis"));
return 0;
}
Hello Genesis
13 Hello Genesis
Hello Genesis 13
None of the above
Question 5
What is the output of the program?
#include <stdio.h>
void main()
{
printf("\n Hi" " %s ", "Genesis"" InSoft");
}
Hi %s Genesis InSoft
Hi Genesis
Hi Genesis InSoft
Hi %s Genesis InSoft
Question 6
What is the output of the program?
#include <stdio.h>
main()
{
switch (5)
{
case 5: printf(" 5 ");
default: printf(" 10 ");
case 6: printf(" 6 ");
}
}
5
5 10
5 10 6
5 6
Question 7
What is the output of the program?
#include <stdio.h>
void main()
{
int x = 9;
Continue: printf("\n Continue ");
if(!x)
goto gen;
gen: printf(" Genesis ");
}
Genesis
Continue Genesis
Continue
None of the above
Question 8
Which argument of function 'strncmp()' specifies number of characters to be compared?
first
second
third
fourth
Question 9
Which of the following is not a storage class in C?
Static
Register
Extern
Stack
Question 10
Which of the following 'return' statement is correct?
return, return;
return(1, 2, 3);
return(return 4);
(return 5, return 6);
Question 11
The second argument to fopen() function is?
char
const char *
int *
FILE *
Question 12
What is the data type of FILE?
integer
union
pointer
structure
Question 13
The first argument of fwrite function is typecast to
char *
FILE *
int *
void *
Question 14
Which of the following storage class variables cannot be used with pointers?
extern
static
register
Both A and C
Question 15
What is the output of the program?
#include <stdio.h>
void main()
{
int (*myprintf)(const char*, ...) = printf;
myprintf("Genesis InSoft Limited");
}
Genesis InSoft Limited
No output
Undefined symbol myprintf
Prototype mismatch
Question 16
What is the output of the program?
#include <stdio.h>
void main()
{
char buffer[10] = {"Genesis"};
printf(" %d ", &buffer[4]- (buffer));
}
3
4
0
Illegal pointer subtraction
Question 17
If "arr" is an array of 5 x 5 dimension, arr[2][4] is same as
**(a+3+4)
*(a+3)+*(a+4)
**(a+3)+4
*(*(a+2)+4)
Question 18
What is the significance of the free() function?
It erases the contents of any type and cleans the pointer
It places the memory address with the pointer in free store
It assigns the pointer a NULL value
It disables the memory address with the pointer
Question 19
The following statement is used in C for
char *ptr = (char*) malloc(Length);
For faster execution of programs
For reducing the code
For conservation of memory
Both A and B
Question 20
What is the output of the program?
#include <stdio.h>
#define sq(a) a * a
void main()
{
printf("%d", sq(3 + 2));
}
25
11
10
Compilation error
Answers
Answer 1 - A
Answer 2 - B
Answer 3 - B
Answer 4 - C
Answer 5 - C
Answer 6 - C
Answer 7 - B
Answer 8 - C
Answer 9 - D
Answer 10 - B
Answer 11 - B
Answer 12 - D
Answer 13 - D
Answer 14 - C
Answer 15 - A
Answer 16 - B
Answer 17 - D
Answer 18 - B
Answer 19 - C
Answer 20 - B
C Question Set 1-5
Question 1
The number of components in a doubly linked list is
1
2
3
4
Question 2
What is the output of the program?
#include <stdio.h>
void main()
{
unsigned short a = -4; // Assume short is 2 bytes
printf("\n %u", a);
}
Error: Variable of type unsigned char cannot store negative values
4
-4
65532
Question 3
Which of the following is a non-linear data structure?
Stack
Queue
Linked List
Tree
Question 4
Function time (time_t*) is used to get the
current system time
time taken for the program to execute
file updation time
file creation time
Question 5
Macros
Expands the code size
Perform dumb substitution
Reduce the speed of program execution
Both A and B
Question 6
Which of the options helps the programmer in debugging a program?
Watch
Building a project
Conditional compilation
Both A and C
Question 7
How can you correct improper naming of function?
By type defining the function
By declaring pointer to functions
By # defining the name
By redefining the function
Question 8
Memory conservation is possible using
Unions
Static variables
Arrays
Bit fields
Question 9
What is the output of the program?
#include <stdio.h>
#define MAX 20
void main()
{
printf("%d", ++MAX));
}
No error, output is 20
No error, output is 21
Error: Define directive needs an identifier
Error: Lvalue required
Question 10
What is the output of the program?
#include <stdio.h>
#define SQ(a) a*a
void main()
{
printf("%d", SQ(2+3));
}
11
25
Error in compilation
13
Question 11
'C' language was developed to achieve
Portability
Modularity
Platform independence
Reusability
Question 12
How many bytes are allocated for "int" declaration?
minimum 2
only 2
minimum 4
only 4
Question 13
Which of the following data types has the same size irrespective of the operating system?
char*
int
float
char
Question 14
What is the output of the program?
#include <stdio.h>
void main()
{
int m = (m = 1, m++, --m);
printf("\n %d ", m);
}
Error: undefined symbol 'm'
2
1
3
Question 15
What is the output of the program?
#include <stdio.h>
void main()
{
printf("%d", sizeof(int) ? 1 ? 2 : 3 ? 4 : 5);
}
Error: Lvalue required
syntax error: missing : before )
2
3
Question 16
A switch statement is similar to
while
do - while
multiple if - else if - else
for
Question 17
Which of the following function returns an integer data type?
strncpy
strcmp
strstr
strcat
Question 18
Which of the following statements is correct?
when a pointer is incremented by 1 the address contained in the pointer is incremented by 1
when a pointer is incremented by 1 the address contained in the pointer is incremented by size of integer
when a pointer is incremented by 1 the address contained in the pointer is incremented according to the type of pointer
when a pointer is incremented by 1 the address contained in the pointer is incremented according to the type it is pointing to
Question 19
What is the output of the program?
#include <stdio.h>
void main()
{
static int a[] = {5, 10, 15, 20};
int* ptr = a;
int** ptr_ptr = &ptr;
printf("\n %d",**ptr_ptr++);
}
5
10
15
20
Question 20
The compiler evaluates the operator '*' as either a pointer indirection or multiplication based on
the operator precedence
the number of operands
the type of operands
its location in the source code
Answers
Answer 1 - C
Answer 2 - D
Answer 3 - D
Answer 4 - A
Answer 5 - D
Answer 6 - D
Answer 7 - B
Answer 8 - D
Answer 9 - D
Answer 10 - A
Answer 11 - A
Answer 12 - A
Answer 13 - D
Answer 14 - C
Answer 15 - B
Answer 16 - C
Answer 17 - B
Answer 18 - C
Answer 19 - A
Answer 20 - B
C Question Set 1-3
Question 1
What restrictions apply to reference variables?
You cannot reference a reference variable (i.e. you cannot take its address)
You cannot create arrays of references
References are not allowed on bit fields
All of the above
Question 2
What is the output of the program?
#include <iostream.h>
struct Emp
{
int id;
float basic;
float cal_salary();
void show_emp();
};
void main()
{
Emp e1;
e1.basic = 5000.5;
cout << e1.basic <<endl;
}
5000
5000.5
Error - as private data cannot be accessed
None of the above
Question 3
What is the output of the program?
#include <iostream.h>
class test
{
test()
{
cout << "constructor called" ;
}
};
void main()
{
test a();
}
constructor called
Error - constructor cannot be private
no output is displayed
None of the above
Question 4
What is the output of the program?
#include <iostream.h>
class test
{
int x;
public:
test(int y)
{
x = y;
}
int getX()
{
int x = 40;
return this->x;
}
};
void main()
{
test a(10);
cout << a.getX();
}
Compilation error
10
40
None of the above
Question 5
What is the prototype of pre increment operator in class test?
void operator ++ ();
test operator ++ (int);
void operator ++ (int);
test operator ++ ();
Question 6
What restrictions apply to extern "C"?
You can specify extern "C" for only one instance of an overloaded function; all other instances of an overloaded function have C++ linkage
You can only declare C functions as 'extern "C"
You cannot declare a member function with extern "C"
Both A and C
Question 7
What is the output of the program?
#include <iostream.h>
void fun(int & a, int b)
{
a += 20;
b += 30;
}
void main()
{
int x = 10, y = 50;
fun(x, y);
cout << x << " " << y ;
}
30 80
10 50
30 50
10 80
Question 8
What is the output of the following?
#include <iostream.h>
class test
{
char x;
static char c;
};
void main()
{
test a;
cout << sizeof(a);
}
1
2
4
None of the above
Question 9
What is the signature of the output operator for class test?
friend ostream & operator << (test &);
ostream & operator << (test &);
ostream & operator << (ostream &, test &);
friend ostream & operator << (ostream &, test &);
Question 10
What is the member function called in the statement "test b = a" shown below?
void main()
{
test a(10);
test b = a;
}
Assignment operator
Constructor
Copy constructor
None of the above
Question 11
A variable that is part of a class, yet is not part of an object of that class, is called a?
Static member
Friend member
Constant member
Non-static member
Question 12
The only member functions that could be called for const objects would be?
Constructors
Destructor
Const member functions
All of the above
Question 13
Which of the following type conversions is automatic?
Conversion from built-in type to class type
Conversion from class type to built-in type
Conversion from one class type to another class type
None of the above
Question 14
Which keyword do we use if the data members of the class are to be modified even when it belongs to a constant object?
mutable
static
const
friend
Question 15
Which condition should the conversion function from class type to built-in type satisfy?
It must be a class member
It must not specify a return type
It must not have any arguments
All of the above
Question 16
We prefer initialization to assignment for the following reason?
Const members can only be initialized
Reference members can only be initialized
To improve the efficiency, when a class contains a data member which is an object of another class
All of the above
Question 17
Which keyword specifies that those members are accessible only from member functions and friends of the class and its derived classes?
private
public
protected
All of the above
Question 18
Which of the following statements is correct?
When preceding the name of a base class, the protected keyword specifies that the public and protected members of the base class are protected members of the derived class
Default access of a base class is private for classes
Default access of a base class is public for structures
All of the above
Question 19
What is the output of the program?
# include <iostream.h>
union test {
int x;
};
class uc : public test
{
int y;
};
main()
{
uc u;
cout << sizeof(u);
}
8
4
union cannot be used as base class
None of the above
Question 20
Which of the following statements are true about static member functions?
Cannot make use of this pointer
Cannot access any non-static data
Cannot be declared const
All of the above
Answers
Answer 1 - D
Answer 2 - B
Answer 3 - C
Answer 4 - B
Answer 5 - D
Answer 6 - D
Answer 7 - C
Answer 8 - A
Answer 9 - D
Answer 10 - C
Answer 11 - A
Answer 12 - D
Answer 13 - D
Answer 14 - A
Answer 15 - D
Answer 16 - D
Answer 17 - C
Answer 18 - D
Answer 19 - C
Answer 20 - D
C Question Set 1-2
Question 1
What does an empty class contain?
Default constructor
Copy constructor
Address of operator
All of the above
Question 2
In protected derivation
Protected and public members of base class become protected
Private, protected and public members of base class become protected
Private, protected and public members of base class become private
Protected and public members of base class become private
Question 3
What is the output of the program?
#include <iostream.h>
void main()
{
int j = 20, k = 30;
int & m = j;
int * n = &j;
cout << j << " " << k << " " << m << " ++ " ;
m = k;
cout << j << " " << k << " " << m << " ++ ";
n = &k; // n now points to k
cout << j << " " << k << " " << m << " " << *n << endl;
}
20 30 20 ++ 20 30 30 ++ 30 30 30 30
20 30 20 ++ 30 30 30 ++ 20 30 30 30
20 30 20 ++ 20 30 30 ++ 20 30 30 30
20 30 20 ++ 30 30 30 ++ 30 30 30 30
Question 4
Class istream in iostream.h is defined as
Class istream : public ios
Class istream : public virtual ios
Class istream : public iostream
Class istream : public virtual iostream
Question 5
Interface contains
At least one pure virtual function
No pure virtual function
All pure virtual functions
None of the above
Question 6
What is the size of empty class?
0 bytes
2 bytes
1 byte
4 bytes
Question 7
The advantage of defining a pure virtual member function in a class is
Derived class may implement the pure virtual function
Derived class must implement the pure virtual function
Derive class is abstract class if it does not implement the pure virtual function
Both B and C
Question 8
What is the output of the following?
#include
void main()
{
int x, y;
x=(3, 4, 5);
y=3, 4, 5;
cout << endl << x <<" "<< y;
}
Compilation Error
3 5
3 3
5 3
Question 9
What is the output of the following?
#include <iostream.h>
void main ()
{
{
for(int x=1; x <= 5; x++, x+=5);
}
cout << endl << " value of x = " << x;
}
6
7
compilation error
2
Question 10
What is the output of the following?
#include <iostream.h>
void main ()
{
cout << (cout<<" Hello ") << " world ";
}
No output is displayed
Hello some_address_value world
Hello world
compilation error
Question 11
The class fstreambuf serves as base class for
ifstream, ofstream, fstream
ifstream, ofstream
ostream
ifstream
Question 12
The scope resolution operator permits
Access to an identifier in the global scope that has been hidden by another identifier with the same name in the local scope
Access to an identifier in the global space
Access to an identifier in the local scope
Access to an identifier in the local scope and global scope
Question 13
The declaration
void func_name( )
accepts
Any no of arguments
Only one argument
No Arguments
None of the above
Question 14
The technique of allocating memory during runtime on demand is known as
Dynamic binding
Dynamic memory allocation
Late binding
Template
Question 15
What is the output of the following?
#include
void main()
{
enum col {red, blue, yellow};
col c = blue << 1;
cout << c;
}
1
2
3
4
Question 16
The advantage of defining a pure virtual member function in a class is
Derived class may implement the pure virtual function
Derived class must implement the pure virtual function
Derive class is abstract class if it does not implement the pure virtual function
Both B and C
Question 17
Input and output operators are known as
extraction and insertion
get from and put to
Both A and B
None of the above
Question 18
A file can be tied to your program by defining an instance of
fstream
ifstream
ofstream
All of the above
Question 19
Which of the following is not true about constructor
constructor can be overloaded
constructor return type is int
constructor has the same name as the class in which it is defined
constructor are used for initializing data members
Question 20
What is the output of the program?
#include <iostream.h>
char *buf1 = "Genesis", *buf2 = "InSoft";
void main()
{
const char *p = buf1;
p = buf2;
*p = 'g';
cout << *p;
}
What is the output of the program?
g
genesis
No ouput is displayed
l-value specifies constant object
Answers
Answer 1 - D
Answer 2 - A
Answer 3 - D
Answer 4 - B
Answer 5 - C
Answer 6 - C
Answer 7 - D
Answer 8 - D
Answer 9 - C
Answer 10 - B
Answer 11 - A
Answer 12 - A
Answer 13 - C
Answer 14 - C
Answer 15 - B
Answer 16 - D
Answer 17 - C
Answer 18 - D
Answer 19 - B
Answer 20 - D
======================================================================
C++ Question Bank 03 / FAQs [20 QUESTIONS]
Question 1
Which of the following statements is true?
A constant member function does allow changes to any data members in the class
A static member functions allows access to non-static data
The size of the object is the sum of size of all non-static data
The size of a struct variable is the sum of size of all static and all non-static data
Question 2
What is the output of the following?
#include
void main()
{
int x = 20;
int &t = x;
x = 50;
cout << x << " " << t;
}
20 50
50 20
50 50
None of the above
Question 3
Friend function adds flexibility to the language, but they are controversial
Because it goes against the rule of data encapsulation
Because it can access a class's private data
Both A and B
None of the above
Question 4
Which of the following is true about a destructor?
Destructor like a constructor can accept arguments
Destructor can be overloaded
Destructor function is the same name as a class which is preceded by the tilde character
Destructor return type is void
Question 5
The prototype of output operator in the class "test" is as follows
friend ostream & operator << (ostream &, test &)
ostream & operator << (ostream &, test &)
friend ostream & operator << (test &)
friend ostream & operator << (ostream &)
Question 6
Which of the following statements is false?
Friend functions take one argument more than a member function
Operator overloading allows us to create new operators
Static member functions can access only static data
A constant cannot be changed
Question 7
Which of the following statements is true?
We cannot overload operator new and operator delete
Each instance of a class has a different copy of static data
We need to define in every class a constructor and destructor
class istream extends class ios
Question 8
What is the output of the following?
#include <iostream.h>
int add(int, int = 5, int = 10);
void main() {
cout << add(10) << " " << add(10, 20) << " " << add(10, 20, 30);
}
int add(int a, int b, int c)
{
return a + b + c;
}
compilation error
25 40 60
15 30 60
20 40 60
Question 9
To turn overloading off, which of the statements is used?
extern "C"
static "C"
Register "C"
off "C"
Question 10
The keywords related to exception handling are?
test, catch
try, throw, catch
namespace, catch
try, finally
Question 11
Genericity is a technique to
Defining software components that have more than one interpretation depending on the data type of parameter.
Which allows the extension of the functionality of the existing software components.
To derive a class from more than one base class.
Of creating new data types that are well suited to an application.
Question 12
Comments are
Integral part of the program and they do nothing
Integral part of the program and they help in coding and maintenance
Are not part of the program
Are not part of the program and they slow down the execution speed
Question 13
C++ does not support the following feature?
Multiple inheritance
Polymorphism
Operator overloading
Automatic memory management
Question 14
What is the output of the program?
#include <iostream.h>
char *buf1 = "Genesis", *buf2 = "InSoft";
void main()
{
char* const q=buf1;
*q='x';
cout << *q;
}
x
xenesis
l-value specifies constant object
None of the above
Question 15
What happens when new operator is called?
It invokes operator new, then invokes the constructor and then does type casting
It invokes the constructor, calls operator new and then does type casting
It invokes operator new and then invokes the constructor
It invokes the constructor and then does type casting
Question 16
Which keyword violates data encapsulation?
Public
Virtual
Friend
Protected
Question 17
Which of the following is not true about destructor?
Destructor can be overloaded
A destructor class member function is typically used to return dynamically allocated memory
A destructor function has the same name as the class in which it is defined preceded by the tilde character
A destructor does not have any return type
Question 18
What is the output of the program?
#include <iostream.h>
void main()
{
int val = 5;
int &val1 = val;
int &val2;
cout << val1;
}
5
val2 - references must be initialized
Address of variable val is printed
None of the above
Question 19
What happens when delete operator is called?
It invokes operator delete and then invokes the destructor if any
It invokes the destructor if any and then calls operator delete
It invokes operator delete
It invokes the destructor if any
Question 20
Which of the following are true about default arguments?
Default arguments must be the last argument
A default argument cannot be redefined in later declarations even if the redefinition is identical to the original
Additional default arguments can be added by later declarations
All of the above
Answers
Answer 1 - C
Answer 2 - C
Answer 3 - C
Answer 4 - C
Answer 5 - A
Answer 6 - B
Answer 7 - D
Answer 8 - B
Answer 9 - A
Answer 10 - B
Answer 11 - A
Answer 12 - B
Answer 13 - D
Answer 14 - A
Answer 15 - A
Answer 16 - C
Answer 17 - A
Answer 18 - B
Answer 19 - A
Answer 20 - D
C Question Set 1-1
The phenomenon where the object outlives the program execution time and exists between executions of a program is known as.
Global Object
Persistent Object
Genericity
Delegation
Question 2
Object-Based Programming Language supports
Inheritance
Polymorphism
Encapsulation
All of the above
Question 3
Abstraction is crucial to understanding
Class
Application
Object
Control flow
Question 4
Object oriented design decomposes a system into
Classes
Objects
Structures
Methods
Question 5
If a class member function is declared a const, the function
Does not change the value of any data member of that class
Does not change the value of any data member of implied object
Does not change the value of any data member of that class
All of the above
Question 6
What is the output of the program?
#include <stdio.h>
float cal (float value)
{
return (3 * value);
}
void main()
{
int a = 10;
float b = cal ("123");
}
369
123
Compilation error - Cannot convert from char to float
None of the above
Question 7
The act of grouping into a single object, both data and the operation that affect that data is known as
Encapsulation
Inheritance
Abstraction
None of the above
Question 8
What is a class?
It is a region of storage.
It defines a data type.
It is exactly same as a struct in c.
All of the above.
Question 9
What is the output of the program?
#include <iostream.h>
void main ()
{
for(int j = 1, sum = 0; j < 5; j++)
sum += j;
sum = j;
cout << sum;
}
5
10
Compilation error. Undefined variable sum and j
6
Question 10
Which one supports unknown data types in a single framework?
Inheritance
Virtual functions
Templates
Abstract Base Class
Question 11
Inheritance is expressed by the following statement?
class car : public vehicle
class car extends vehicle
public class car extends vehicle
class car inherits vehicle
Question 12
Object oriented design decomposes a system into
Classes
Objects
Structures
Methods
Question 13
Which of the following statements is not correct?
You can create new operators like $ or @
You cannot change an operator's template
Operators can only be overloaded when used with abstract data class
Unary operators overloaded by means of a member functions takes no explicit arguments and return no explicit values
Question 14
Which of the following is false about struct and class in C++?
The members and base classes of a struct are public by default, while in class, they are private by default
Struct and class are otherwise functionally equivalent
A class supports all the access specifiers like private, protected and public
A struct cannot have protected access specifier
Question 15
Protected keyword is frequently used
For function overloading
For protecting data
For inheritance
For security purpose
Question 16
Abstract base class is one, which has
All pure virtual functions
At least one pure virtual function
Functions with abstract keyword
No pure virtual functions
Question 17
What is exception handling?
Errors which occur at runtime
When abnormal situation arises at compile time
When errors occur at link time
None of the above
Question 18
What is the output of the program?
#include <iostream.h>
inline int max(int x, int y)
{
return(x > y ? x : y);
}
void main()
{
int(* max_func)(int,int)=max;
cout << max_func(75,33);
}
75
Error - Undefined symbol max_func
33
None of the above
Question 19
Which keyword is used to decide on the choice of function or method at runtime?
Abstract
Virtual
Protected
Static
Question 20
Which of the following is a correct statement?
Abstract class object can be created
Pointer to abstract class can be created
Reference to abstract class can be created
Both B and C
Answers
Answer 1 - B
Answer 2 - C
Answer 3 - C
Answer 4 - B
Answer 5 - B
Answer 6 - C
Answer 7 - A
Answer 8 - B
Answer 9 - A
Answer 10 - C
Answer 11 - A
Answer 12 - B
Answer 13 - A
Answer 14 - D
Answer 15 - C
Answer 16 - B
Answer 17 - A
Answer 18 - A
Answer 19 - B
Answer 20 - D
100 C Questions
- What does static variable mean?
- What is a pointer?
- What is a structure?
- What are the differences between structures and arrays?
- In header files whether functions are declared or defined?
- What are the differences between malloc() and calloc()?
- What are macros? what are its advantages and disadvantages?
- Difference between pass by reference and pass by value?
- What is static identifier?
- Where are the auto variables stored?
- Where does global, static, local, register variables, free memory and C Program instructions get stored?
- Difference between arrays and linked list?
- What are enumerations?
- Describe about storage allocation and scope of global, extern, static, local and register variables?
- What are register variables? What are the advantage of using register variables?
- What is the use of typedef?
- Can we specify variable field width in a scanf() format string? If possible how?
- Out of fgets() and gets() which function is safe to use and why?
- Difference between strdup and strcpy?
- What is recursion?
- Differentiate between a for loop and a while loop? What are it uses?
- What are the different storage classes in C?
- Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
- What is difference between Structure and Unions?
- What the advantages of using Unions?
- What are the advantages of using pointers in a program?
- What is the difference between Strings and Arrays?
- In a header file whether functions are declared or defined?
- What is a far pointer? where we use it?
- How will you declare an array of three function pointers where each function receives two ints and returns a float?
- what is a NULL Pointer? Whether it is same as an uninitialized pointer?
- What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
- What does the error 'Null Pointer Assignment' mean and what causes this error?
- What is near, far and huge pointers? How many bytes are occupied by them?
- How would you obtain segment and offset addresses from a far address of a memory location?
- Are the expressions arr and &arr same for an array of integers?
- Does mentioning the array name gives the base address in all the contexts?
- Explain one method to process an entire string as one unit?
- What is the similarity between a Structure, Union and enumeration?
- Can a Structure contain a Pointer to itself?
- How can we check whether the contents of two structure variables are same or not?
- How are Structure passing and returning implemented by the complier?
- How can we read/write Structures from/to data files?
- What is the difference between an enumeration and a set of pre-processor # defines?
- what do the 'c' and 'v' in argc and argv stand for?
- Are the variables argc and argv are local to main?
- What is the maximum combined length of command line arguments including the space between adjacent arguments?
- If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
- Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
- What are bit fields? What is the use of bit fields in a Structure declaration?
- To which numbering system can the binary number 1101100100111100 be easily converted to?
- Which bit wise operator is suitable for checking whether a particular bit is on or off?
- Which bit wise operator is suitable for turning off a particular bit in a number?
- Which bit wise operator is suitable for putting on a particular bit in a number?
- Which bit wise operator is suitable for checking whether a particular bit is on or off?
- which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?
- Write a program to compare two strings without using the strcmp() function.
- Write a program to concatenate two strings.
- Write a program to interchange 2 variables without using the third one.
- Write programs for String Reversal & Palindrome check
- Write a program to find the Factorial of a number
- Write a program to generate the Fibinocci Series
- Write a program which employs Recursion
- Write a program which uses Command Line Arguments
- Write a program which uses functions like strcmp(), strcpy()? etc
- What are the advantages of using typedef in a program?
- How would you dynamically allocate a one-dimensional and two-dimensional array of integers?
- How can you increase the size of a dynamically allocated array?
- How can you increase the size of a statically allocated array?
- When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
- Which function should be used to free the memory allocated by calloc()?
- How much maximum can you allocate in a single call to malloc()?
- Can you dynamically allocate arrays in expanded memory?
- What is object file? How can you access object file?
- Which header file should you include if you are to develop a function which can accept variable number of arguments?
- Can you write a function similar to printf()?
- How can a called function determine the number of arguments that have been passed to it?
- Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
- How do you declare the following:
- An array of three pointers to chars
- An array of three char pointers
- A pointer to array of three chars
- A pointer to function which receives an int pointer and returns a float pointer
- A pointer to a function which receives nothing and returns nothing
- What do the functions atoi(), itoa() and gcvt() do?
- Does there exist any other function which can be used to convert an integer or a float to a string?
- How would you use qsort() function to sort an array of structures?
- How would you use qsort() function to sort the name stored in an array of pointers to string?
- How would you use bsearch() function to search a name stored in array of pointers to string?
- How would you use the functions sin(), pow(), sqrt()?
- How would you use the functions memcpy(), memset(), memmove()?
- How would you use the functions fseek(), freed(), fwrite() and ftell()?
- How would you obtain the current time and difference between two times?
- How would you use the functions randomize() and random()?
- How would you implement a substr() function that extracts a sub string from a given string?
- What is the difference between the functions rand(), random(), srand() and randomize()?
- What is the difference between the functions memmove() and memcpy()?
- How do you print a string on the printer?
- Can you use the function fprintf() to display the output on the screen?
General C Questions
- What is the output of printf("%d")
- What will happen if I say delete this
- Difference between "C structure" and "C++ structure".
- Difference between a "assignment operator" and a "copy constructor"
- What is the difference between "overloading" and "overridding"?
- Explain the need for "Virtual Destructor".
- Can we have "Virtual Constructors"?
- What are the different types of polymorphism?
- What are Virtual Functions? How to implement virtual functions in "C"
- What are the different types of Storage classes?
- What is Namespace?
- What are the types of STL containers?.
- Difference between "vector" and "array"?
- How to write a program such that it will delete itself after exectution?
- Can we generate a C++ source code from the binary file?
- What are inline functions?
- What is "strstream" ?
- Explain "passing by value", "passing by pointer" and "passing by reference"
- Have you heard of "mutable" keyword?
- What is a "RTTI"?
- Is there something that I can do in C and not in C++?
- What is the difference between "calloc" and "malloc"?
- What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?
- Difference between "printf" and "sprintf".
- What is "map" in STL?
- When shall I use Multiple Inheritance?
- Explain working of printf.
- Talk sometiming about profiling?
- How many lines of code you have written for a single program?
- How to write Multithreaded applications using C++?
- Write any small program that will compile in "C" but not in "C++"
- What is Memory Alignment?
- Why preincrement operator is faster than postincrement?
- What are the techniques you use for debugging?
- How to reduce a final size of executable?
- Give 2 examples of a code optimization.
CTS - Walkin - Chennai
- Java, J2EE, Struts, Spring, Hibernate, EJB, Swing, Core Java, JSF, JSP, Design patterns Java, J2EE, Struts, Spring, Hibernate, EJB, Swing, Core Java / Design patterns : 2.6 – 7 years
- Oracle DBA Wcf,wpf,Silverlight Back end SQl/oracle : 3 – 7 years
- SQL DBA Cobol, JCL, DB2, CICS: 3 – 7 years
- Linux Admin Informatica, Datastage, Teradata ,Abinitio and Microstrategy: 3 – 5 years
- VMWare Unix, PHP, Tuxedo,Lawson, Pega PRPC, Guidewire: 3 – 7 years
- Asp.net(2.0/3.0/3.5,4.0),SQl / Wcf,wpf,Silverlight Back end SQl/oracle .Net with SQL Server / Oracle . DB is mandatory : 3 – 8 years
- Mainframe Core DBA experience. Experience in High Availability Log Shipping, Replication, Clustering & Mirroring. SQL 2005 upgrade experience: 2 – 5 years
- AS/400 Core oracle DBA. Oracle 10g. Experience in RAC and RMAN is mandatory: 2 – 5 years
- DW - Informatica, Teradata, Abinitio, Microstrategy, Datastage SOA -Fusion/BPEL: 3 – 6 years
Walk-in to the below venue on July 31st from 9:00 to 12:00 noon
5/535, Old Mahabalipuram Road,
Okkiam Thoraipakkam,
Chennai - 600096
Wednesday, July 28, 2010
Brainmagic Infotech Private Limited
We specialize in the development of website design, ecommerce, sms solutions ,custom software applications and offshore software outsourcing services. Specifically, our company carries out custom programming, web applications, database design, client-server and internet/intranet software application development.
Custom software development and design
Programming services outsourcing
1. .Net Programmers
Skills required:
= Fresher s / 0 - 1year of experience
= Any Graduate/B.E/B.Tech/MCA/BCA/
= Immediate Joining
= Programming knowledge in .Net.
= Good Communication and interpersonal skills
= Knowledge of HTML, VB
= Willing to join within 5 days
- Work with BRAINMAGIC staff (e.g, senior programmers, support staff, product manager) to plan program code enhancements and changes.
- Create, test and maintain BRAINMAGIC program code.
- Create labels and reports using Crystal Reports
- Provide assistance to BRAINMAGIC technical support staff when they are unable to resolve a program, SQL database, or IT issue by themselves.
- Occassionally contact customers as may be needed to clarify the intent of a new feature or resolve a problem.
- Provide general programming assistance to other BRAINMAGIC programmers/projects as may be needed.
- Visual Basic .NET, ASP.Net and Visual Basic 6, including the use of program “classes” and creation of DLL’s
- SQL Server databases, SQL, ADO.NET
- Windows 2000/NT Server and Windows XP/2000/98
- ASP.NET
- MS Word, MS Excel
- HTML
- Enjoy working with others in a team atmosphere.
- Prefer a small-business, fast paced working environment.
- Enjoy maintaining/enhancing code to meet changing customer/industry needs
- Have a “customer-service” orientation
Venue: Given Below
3/2,J.K Towers, Zackaria Colony,
IInd cross street, Kodambakkam
Chennai - 600 024
India.
*****************************
Please send feedback directly to the manager Kumaravel.R by sending mail to prbabu@brainmagic.info
Tuesday, July 27, 2010
Adboe - Hiring Freshers

- B.Tech / M.Tech in Computer Science & Engineering from a premier institute.
- Proficient in C/C++ assembly/ Java, data structure and algorithm.
- Good understanding of object oriented design and knowledge of product life cycles and associated issues.
- Knowledge of application development on multiple platforms including various flavors of Windows and Macintosh.
- Should have excellent computer science fundamentals and a good understanding of architecture, design and performance.
Responsibilities:
- He/ she would contribute extensively in analysis, design and programming for major and dot software releases.
- He/ she would be from time to time required to interface with product marketing to evaluate and determine new features to be added.
- Should be a proactive self starter who can develop methods, techniques and evaluation criterion for obtaining results.
- He/ she would be expected to provide leadership within the respective division and act as a mentor to engineers.
- He/ she would be an expert on one or more platforms and knowledgeable of cross-platform issues, competitive products, and customer requirements. He would contribute significantly towards the development and application of advanced concepts, technologies and expertise within the team.
- He/ she would be required to address broad architecture and design issues of future products or technologies and provide strategic direction in evaluating new technologies in his/her area of expertise.
Infosys - Openings
To apply you should be a BE/MCA/MSc. degree with a consistent excellent acedemic record through standards 10 and 12. Engineering / Graduation and Post Graduation. Exposure to formal quality processes and a strong foundation in SDLC concepts are necessary.
- Web Technologies: Java, EJB, J2EE, WebLogic, Websphere Commerce Server, Websphere Portal Server
- Microsoft Technologies: VB.Net, ASP.Net, C#, , MOSS
- Datawarehousing/Business Intelligence: BO, INFA, Cognos, Data Modelling, Datastage, Teradata, Ab Initio, SAS, Essbase, Hyperion, Microstretegy
- Mainframe: COBOL, CICS, JCL, DB2
- Open Systems: C, C++, Unix
- Others: ATG Commerce, Marklogic, Facets, Actimize, NORKOM, Murex, Smallworld, GIS, Tandem, Documentum, Guidewire
Do also mention your date of birth, Contact numbers and personal email ID in the resume.
Also looking for BCA/B.Sc. (Computer Science/Electronics/Mathematics/Statistics/Physics) raduates with excellent academic credential and less than 24 months experience for the role of Operations Executive / Testing Executive. Intrested candidates can e-mail their resume to graduates@infosys.com
TCS - Experienced Walk-in
![]() |
BI BI SQL (3-8 years of experience)
IBM Mainframe (MF) Mainframe
IT IS Linux/ Solaris System Admim (Experience 4-7 years)
Service Capacity Analyst (Experience 4-7 years)
Windows Admin
Windows Admin
Windows Admin
Windows Admin
Network Admin (Experience 3-6 years)
Unix Admin (Experience 3-6 years)
Storage Admin & Architect (Experience 3-6 years)
Service Desk (Experience 3-5 years)
Application Packaging (Experience 3-5 years)
MS Technologies Moss/ Sharepoint ( Experience 3-8 years)
SDET ( Experience 3-8 years)
ASP.Net+ SQL( Experience 3-8 years)
SQL Testing
Java J2EE Java J2EE(Struts, JSP, Servlets, Hibernate)
|
![]() |
1. Full Time Graduates / Post Graduates in:
Special consideration will be given to B.Sc. / BCA / Diploma holders with 3 years of relevant functional / technical experience, subject to minimum reduction in experience, as per current TCS policy. 2. Consistent academic records from Class X onwards (Minimum 50%) 3. Candidates interviewed by us in the last 6 months are not eligible 4. Candidates with more than 2 years break in their academic / professional career will not be considered |
![]() |
|
Venue : Tata Consultancy Services Ltd., Kohinoor Park, Plot No.1, Jubilee Gardens, Cyberabad, Hyderabad 500 081 Registration Time: 09:30 AM to 12:30 PM Date:31st July, 2010 (Saturday) For more details: Click Here |
Logical Questions
Answer The following questions on the basis of the information given below:
K,L,M,N,O,P,Q,R,S,U and W are only ten members in a department. There is a proposal to form a team from with in the members of the department, subject to the following conditions.
· A team must include exactly one among P,Q and S
· A team must include either M or Q , but not both
· If a team includes K, then it must also include L, and vice versa.
· If a team includes on among S,U and W, then it must also include the other two
· L and N cannot be members of the same team
· L and U cannot be members of the same team
The size of the team defined as the number of members in the team.
Questions:
Q1) who cannot be member of a team size 3 ?
(1) L (2) M (3) N (4) P (5) Q
Q2) who can be a member of a team size 5 ?
(1) K (2) L (3) M (4) P (5) R
Q3) what would be the size of the largest possible team ?
(1) 8 (2) 7 (3) 6 (4) 5 (5) Can not be determined
Q4) what would be the size of a team includes K ?
(1) 2 or 3
(2) 2 or 4
(3)3 or 4
(4) only 2
(5) Only 4
Q5) In how many ways a team can be constituted so that the team includes N?
(1) 2 (2) 3 (3) 4 (4) 5 (5) 6
Answers & Explanation:
1) Ans – 1
Explanation: If L is in the team K will also be in the same Team. Exactly one among the P,R and S and exactly one among the M and Q are included in the team. hence when L is in the team , the team strength will be atleast four. Hence L cannot be in the team of three.
Options (2) ,(3) and (4) : M,P and N is a Possible Team
Options (5) : P,Q and N is a possible team.
2) Ans – 3
Explanation: Options (1) and (2) : If K is in the team , then L is laso included and vice versa.
ð Neither U nor N is included.
When U is not included neither S nor W is included.
From (ii) , only one among M and Q is included.
From (i) Only one among P and R is included.
Hence , the team can be K L M P or K L M R or K L Q P or K L Q R
Option (3) :If M is included , then q cannot be included. If S is included then both U and W are included.
Hence , the team is M , S , U , W and N.
Option (4) and (5) : If any one of P or R is included then S cannot be included.
ð U and W are also not included.
Only one among M and Q is included.
If K is included , then L is also included.
ð N cannot be included.
ð Hence , the team can be (P,M or Q) , (K,L or R) ( K,L and M or Q)
3) Ans – 4
Explanation: To have the largest possible team we should include S , U and W.
ð Neither P nor R is included.
Only one among M and Q is included.
Both K and L can included.
Since , L is included neither N nor U can be included.
Hence , the maximum possible strength of the team is 5.
4) Ans – 5
If K is included , then L is also included.
ð Both N and U are not included.
Since U is not included neither of s and W is included.
ð The term consists of only four members.
5) Ans – 5
If N is included , then L is not included.
ð K is not included.
But U may or may not be included.
Case (i): U is included.
ð S and W are also included.
ð Neither P nor R is included.
One among N nor R is included.
Hence , the possible teams are N , U , S , W and P or N , U , S , W and Q.
Case (iI): U is Not included.
ð S and W is included.
ð Exactly One Among P and R is included.
Exactly One among M and Q is included.
Hence , the possible teams are (N , P and M ) or ( N, P and Q ) or ( N ,R and M) or ( N , R and Q )
Hence the teams can be formed six different ways.