C C++ Errors

  Home  Technology Errors  C C++ Errors


“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

 174 views

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.

 151 views

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.

 192 views

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 differentHow 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..........,

 157 views

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.

 154 views

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".

 154 views

12⟩ Display this kind of output on screen. 1 0 11 0 13. Display this kind of output on screen.11 01 0 14. Display this kind of output on screen. 1 1 0 1 0 15.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10

void main()

{

int i,j;

for(i=0;i<=2;i++)

{

for(j=2;j>i;j--)

printf(" ");

for(j=1;j<(i+1);j++)

{

printf("%d",mod(j-i));

}

printf("/n");

}

getch();

}

------------------------------void main()

{

int i,j;

for(i=0;i<=2;i++)

{

// for(j=2;j>i;j--)

// printf(" ");

for(j=1;j<(i+1);j++)

{

printf("%d",mod(i-j));

}

printf("/n");

}

getch();

}

--------------------------------

void main()

{

int i,j;

for(i=0;i<=2;i++)

{

//for(j=2;j>i;j--)

// printf(" ");

for(j=1;j<(i+1);j++)

{

printf("%d",mod(j-i));

}

printf("/n");

}

getch();

}

-------------------------

void main()

{

int i,j,k=1;

for(i=0;i<=3;i++)

{

for(j=3;j>i;j--)

printf(" ");

for(j=1;j<(i+1);j++)

{

k=k+1;

printf("%d",k);

}

printf("/n");

}

getch();

}

 164 views

13⟩ Explain what is macro in c?Difference between single linked list & double linked list what is fifo & lifo?what is stack & queue?

Macros are preprocessor directives that are defined using #define directive. Macros consist of two parts Macro_Name, & Macro_Substitution_Text.

Before the source code gets complied, the preprocessor will check for the presence of macros. & wherever it found that macro simply replaces that macros with substitution text.

Macros are not Type Safe.

 194 views