D Programming Language Interview Questions for freshers experienced :-
1. What is D programming language?
D programming language is an object oriented programming language.
It is created by Walter Bright of Digital Mars. It was released in 2001.
2. Who is the developer of D programming language?
D Language Foundation is the developer of D programming language.
3. What are the features of D programming language?
D programming language features are:
- Garbage collection
- First class arrays
- Open source
- Inner classes
- Closures
- Anonymous functions
- Lazy evaluation etc.
4. How can we write a simple program in D programming language?
We can write a simple program in D programming language by using following code:
import std.stdio;
void main(string[] args) {
writeln(“Hello World!”);
}
5. What are the compilers in D programming language?
The compilers of D programming language are:
- DMD
- GDC
- LDC
6. What are the two expressions in D programming language?
There are two expressions in D programming language:
- lvalue
- rvalue
7. What is Enum in D programming language?
Enum is a keyword that used to define named constant values.
Syntax:
enum enum_name {
enumeration list
}
8. What are the D programming Operators?
D programming operators are:
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Assignment Operators
- Misc Operators
9. What are the various functions in D programming language?
The functions of D programming Language are:
- Pure Functions
- Nothrow Functions
- Ref Functions
- Auto Functions
- Variadic Functions etc.
10. How can we read character in D programming language?
We can read character in D programming Language by using read Unicode character.
Example:
readf(” %s”, &letter);
11. What is the way to represents string in D programming language?
In D programming language, string is represented in two ways:
Character array
Core language string
12. How can we declare an array in D programming language?
In D programming language, we can declare an array by using given code.
type arrayName [ arraySize ];
13. What are the pointer operations in D programming language?
The pointer operations in D programming Language are:
- We can define pointer variables.
- We can assign the address of a variable to a pointer
- We can access the value of address in the pointer variable.
14. What is use of tuples?
Tuples is used to combine the multiple values as a single object. It contains a sequence of elements.
Example:
import std.stdio;
import std.typecons;
void main() {
auto myTuple = tuple(1, “Tuts”);
writeln(myTuple);
writeln(myTuple[0]);
writeln(myTuple[1]);
}
15. What are the various editors for D programming Language?
There are various editors for D programming language:
EMACS, VIM, EPSION and many more.
16. What is the extension of D programming?
The extension of D programming is ā.dā.
17. What are the types of D Compiler?
There are different types of D Compiler:
- DMD
- GDC
- LDC
18. Is D programming language case sensitive?
Yse, D programming language is case sensitive.
19. What are the data types used in D programming language?
There are following data types used in D programming language: char, int, float, double and void.
20. What is an enumeration?
An enumeration is used to define named constant value.
Syntax:
enum enum_name {
enumeration list
}
21. How can we read character in D?
We can read character in D by using readf.
Example:
readf(” %s”, &letter);
22. What is the techniques to represent string in D programming language?
In D programming language, there are two techniques to represents of string.
- Character array
- Core language string
23. What is the array properties in D programming language?
In D programming language, the array properties are given below:
- .init
- .sizeof
- .length
- .prt
- .dup
- .reverse
24. Does D programming language allow Multi Dimensional array?
Yes, D programming language allow Multi dimensional array.
Syntax:
type name[size1][size2]…[sizeN];
25. How can we define a union in D Programming language?
We can define a union in F programming language by using following code:
union [union tag] {
member definition;
member definition;
…
member definition;
} [one or more union variables];
26. Write the example of string mixins in D programming language?
In D programming language, the example of string mixins is given below:
import std.stdio;
void main() {
mixin(`writeln(“Hello World!”);`);
}
27. What are the variables that can never be mutated?
There are three variables that can never be mutated:
- enum constants
- immutable variables
- const variables
28. How to write a File in D programming language?
The following command is used to write a file in D programming language:
file.writeln(“hello”);
29. Which method is used to start a new thread?
Spawn() method is used to start a new thread .
30. What is the syntax to catch exception in D programming language?
The following syntax is used to catch exception in D programming language.
Syntax:
try {
// protected code
}
catch( ExceptionName e ) {
// code to handle ExceptionName exception
}