C C++ Errors Interview Preparation Guide
Download PDF
Add New Question

C C++ Errors frequently Asked Questions in various C C++ Errors job Interviews by interviewer. The set of C C++ Errors interview questions here ensures that you offer a perfect answer to the interview questions posed to you. Get preparation of C C++ Errors job interview

13 C C++ Errors Questions and Answers:

1 :: Explain difference between c/c++ programing language?
what is necessity of c++ when existing c programing language?

The main reason is lengthy C programs lose "Global View" and
become very difficult to visualize as a single concept.

C++ is an advance than C lang which has more features...

But comparing efficiency C is more efficient than C++

But C++ has more flexibility than C.

Also C++ is both combination of OOP and OBP concepts.

C++ has more features as

1.Object oriented
2.Information hiding
3.Standard Template Library
4.Inheritance
5.Constructors & Destructors
6.Exception Handling
7.Overloading
Post Your Answer

2 :: Can you explain exceptions?

An exception is an event, which occurs during the execution
of a program, that disrupts the normal flow of the program's
instructions.
Post Your Answer

3 :: When i use cout or cin call & then either << or >> .....it shows
declaration syntax error...what should i do?
cout<<"anything";
int a;
cin>>a;
return 0;?

If you are using Turbo C complier need to add #include<iostream.h> header file.

and If you are using Visual Studio then you need to add

#include<iostream>
using std namespace;

the above two statements.
Post Your Answer

4 :: char* f()
return "hello:";
void main()
{char *str=f();
}

str will be a pointer to "hello:"

so on printing str will output hello:
Post Your Answer

5 :: What is run time error?

An error that occurs during the execution of a program. In
contrast, compile-time errors occur while a program is
being compiled. Runtime errors indicate bugs in the program
or problems that the designers had anticipated but could do
nothing about. For example, running out of memory will
often cause a runtime error.
A runtime error is a computer error that appears in
the form of a message box consisting of a particular code
along with its corresponding definitions. Usually, a user
will notice that the computer becomes noticeably slow
before a runtime error appears.

After the runtime error message has been displayed and
closed, the software that shows this error would normally
close or freeze. In some cases, the operating system will
reboot.
Post Your Answer

6 :: void main()
{
int i=7;
printf("N= %*d",i,i);
}

Its output would be 7,

"%*d"

here * symbol doesn't affect of operation of %d.

so 7 is set to value in variable i.
Post Your Answer

7 :: void main()
{
int i=5,y=3,z=2,ans;
clrscr();
printf("%d",++i + --z + i++ + --i * ++y);
i=5,y=3,z=2;
ans=++i + --z + i++ + --i * ++y;
printf("\n%d",ans);
getch();
}

Its output is 37 and 31....
Please explain me why its different
How it works?

here in first statement

printf("%d",++i + --z + i++ + --i * ++y);

argument is : ++i + --z + i++ + --i * ++y.

first it will maintain stack operation like

++y (now fifth, it will execute and, y=4)(top 4)
--i (now fourth, it will execute and, i=6)
(because, last value of i were 7, once i++ were
executed, now --i will less one value in i)(top 3)
i++ (now third, it will execute and, i=6, it will
as it is, its value will for next stack value.)
(top 2)
--z (now second, it will execute and, z=1)(top 1)
++i (first it will execute and, i=6)(top 0)

now (++i + --z + i++ + --i * ++y)
(6+1+6+6*4)=(37)

it is output, say 37,for this printf("%d",++i + --z + i++
+ --i * ++y);

.................................................

Now Let me go with second statement, that is :

ans=++i + --z + i++ + --i * ++y;

here,
first of all ++y will contain the value of variable y=4
++y=4

after this, --i will less the value of variable i, say now
i = 4,
(--i=4),

after this, i++ will execute and, it will not increase the
value of variable i, right now, so value of i, say now i =
4, as it is.

after this, --z will less the value of variable z, say now
z = 1,
(--z=1)

now, ++i will increase the value of variable i.
Say i = 5.
.......................................................

now value of valiable i in memory is 5.
ans=5+1+5+5*4
ans=5+1+5+20
ans=31..........,
Post Your Answer

8 :: What is syntax error?

synatx error is a compile type error. it will occur when
the programmer doesnot follow the standard rules or
syntax of programming.
Post Your Answer

9 :: What is meant for variable not found?

when u have not declared variable in the main function or
any other function but used in the program.
example:
main()
{
int i,j;----------------> (iSum not declared)
printf("enter the value of i and j");
scanf("%d%d",&i,&j);
iSum = i + j;
printf("The Sum =",iSum);
getch();
}
In this case iSum will Show a compiler error "Variable not
found".
Post Your Answer

10 :: Errors are known as?

It's a human mistake associated with the program
Post Your Answer
Add New Question