C OOPS Interview Question What is the difference

  • Slides: 6
Download presentation
C++ OOPS Interview Question

C++ OOPS Interview Question

What is the difference between null array and an empty array? • null array----when

What is the difference between null array and an empty array? • null array----when the size of array is not declared than the array is known as null array. EMPTY ARRAY-------if an array having the size but not values than it's known as empty array. EX = null array b[]; empty array b[size of array];

Can the size of an array be declared at runtime? • No. In an

Can the size of an array be declared at runtime? • No. In an array declaration, the size must be known at compile time. You can? t specify a size that? s known only at runtime. For example, if i is a variable, you can? t write code like this: char array[i]; /* not valid C */

What is File Mode? . Types Of file mode? . What is Pointer? .

What is File Mode? . Types Of file mode? . What is Pointer? . which one is most useful in Structure or Unoin? . • the meaning of file mode means in which mode we want to open the file. types of modes are read mode, write mode. pointer is the variable which holds the address of another variable. union r useful bcoz of memory no wastage but structures r frequently used than unions.

What is the benefit of using an enum rather than a #define constant? •

What is the benefit of using an enum rather than a #define constant? • The use of an enumeration constant (enum) has many advantages over using the traditional symbolic constant style of #define. These advantages include a lower maintenance requirement, improved program readability, and better debugging capability. The first advantage is that enumerated constants are generated automatically by the compiler. Conversely, symbolic constants must be manually assigned values by the programmer. For instance, if you had an enumerated constant type for error codes that could occur in your program.

What is the difference between NULL and NUL? • NULL is a macro defined

What is the difference between NULL and NUL? • NULL is a macro defined in <stddef. h> for the null pointer. NUL is the name of the first character in the ASCII character set. It corresponds to a zero value. There? s no standard macro NUL in C, but some people like to define it. The digit 0 corresponds to a value of 80, decimal. Don? t confuse the digit 0 with the value of ? ? (NUL)! NULL can be defined as ((void*)0), NUL as ? ? .