get the app get the app       get the app       get the app

c++ Language QUESTIONS

Exam Namec++ Language QUESTIONS
Descriptionc++ Language QUESTIONS and Answers exams contains the questions from various interview of IT industry.These questions are helpful to crack the IT interview.
Exam TypeMASTER EXAM
Authenticity9999
creatorAnirudh(39048)
Create QuestionPDF  

Back to Parent Category
Question: If the int variables int1 and int2 contain values 5 and 2 respectively, then the value of (double)(int1/int 2)

Answer:2


Question: What are the output of following code:
for(x=10;x<+ 50;x+=10) y= x/2; cout<< y ;


Answer:25


Question: The rand() built in library function ?

Answer:is a pseudo-random number generator


Question: What is the output of the following code?
x=15;y=0; if(x=10) y=7; else y=1; cout<< y;


Answer:1


Question: How do you print an address ?

Answer:Use %p


Question: 1. Which of the following declaration is illegal?
a) char *str = "Quhasa is the Best site for Competitive Exams";
b) char str[] = "Quhasa is the Best site for Competitive Exams";
c) char str[20] = "Quhasa is the Best site for Competitive Exams";
d) char[] str = "Quhasa is the Best site for Competitive Exams";


Answer:d


Question: Which keyword is used to prevent any changes in the variable within a C program?
a) immutable
b) mutable
c) const
d) volatile


Answer:c


Question: Which of the following is not a pointer declaration?
a) char a[10];
b) char a[] = {"1"², "2"², "3"², "4"²};
c) char *str;
d) char a;


Answer:d


Question: Which of the following mode declaration is used in C++ to open a file for input?

Answer:In:: ios


Question: The Default Parameter Passing Mechanism is called as

Answer:Call by Value


Question: The prototype declaration for a pointer to a function which returns a pointer to an integer is:

Answer:int * (*pfi)();


Question: main()
{
static int a[20];
int i=0;
a[i]=i++;
printf("%d%d%d", a[0],a[i],i );
}


Answer:0 0 1


Question: void f(int x,int &y)
{
x++;
y++;
}
Void main()
{
Int i=1,j=1;
F(I,j)
Cout<}


Answer:1 2


Question: void main(void)
{
FILE *p;
p=fopen("c:tctrial", "w");
if(!fp)
{
Exit(0);
}
Fclose(p);


Answer:path should be C:tctrial


Question: void main(void)
{
Int y=128;
Const int x=y;
Printf("%d",x);
}


Answer:128


Question: when do preprocessor directives get executed

Answer:before compilation


Question: which kind of function can access private data members

Answer:all


Question: which of the following will be automatically generated by the complier

Answer:B& C.


Question: difference b/w c++ struct and c++ class is

Answer:B & C.


Question: static member functions can access "this" pointer

Answer:false