Top Interview Questions & Answers | Learn Now

Dart Programming Interview Questions and Answers | Basic and Advanced

Written by Mohammed | May 18, 2018 11:49:31 AM

Q1. What Is Dart?

Ans: Dart is an application programming language. It is used to build web, server and mobile applications.

Q2. Use of Dart.

Ans: Dart is mainly used to build structured modern web apps.

Q3. What are the Characteristics / Features of Dart?

Ans: Dart follows C Style Syntax and is Class-Based, Object Oriented Language which supports single inheritance.

  • It also supports lexical scoping, closures, and optional static typing.
  • It comes with Dart Editor and SDK to provide an integrated experience, features like refactoring, break points, virtual machine are supported with Dart.
  • Dart can be converted to javascript with the help of dart2js tool,  which is highly useful hence it can work on all modern browsers with minimal code and it can run on servers via Virtual Machine which is provided with SDK.

Q4. How Google Dart will get Popular?

Ans: Google is doing its hard work to get Dart accepted by web developers and community and arranging support, tools and execution environment for Google Dart.

  • Google will provide support of Dart in Google Chrome by integrating native virtual Machine and it will encourage to Microsoft and Mozilla to do the same.
  • Google will provide a Cross Compiler which will convert Dart toECMAScript 3so that it can run on NonDart Browser. This will be the major step in getting Dart Virtual Machine integrated on all popular browser might take some time.

Q5. How to create a simple program?

Ans: The following code for simple program:

main() {
   print("Hello World!");
}

Q5. What are the ways to execute Dart Program?

There are two ways to execute Dart program:

  • Via the terminal.
  • Via the WebStrom IDE.

Q6.  Is Dirt is case sensitive programming language?

Ans: Yes, Dirt is case sensitive programming language.

Q7.  What are the data types in Dart language?

Ans: There are following data types in Dart language:

  • Numbers
  • Strings
  • Booleans
  • Lists
  • Maps

 

Q8. What is rune in Dart?

Ans: In Dart, rune is an integer representing Unicode code point.

Q9.  Does Dart has a syntax for declaring interfaces?

Ans: No, Dart has not syntax for declaring interface.

Q10. What is Lambda Function?

Ans: A Lambda function is a concise mechanism to represent functions. These functions are known as Arrow functions.

Example:
void main() {
printMsg();
print(test());
}
printMsg()= >
print("hello");
int test()= 123;
// returning function

Q11. What is the use of this keyword in Dart?

Ans: In Dart, this keyword refers to the current instance of the class.

void main() {
Car c1 = new Car('E1001');
}
class Car {
String engine;
Car(String engine) {
this.engine = engine;
print("The engine is : ");
}
}

Q12.  What are Getters and Setters?

Ans: Getters and Setters allow the program to initialize and retrieve the value of class fields. It is also known as accessors and mutators.

Q13. What is type-checking in Dart?

Ans: In Dart, type-checking is used to check that a variable hold only specific to a data type.

String name = 'Smith';
int num = 10;
void main() {
String name = 1; // variable Not Match
}

Q14.  What are various string functions in Dart?

Ans: There are given various string functions:

String Methods Description
toLowerCase() It converts all string characters in to lower case.
toUpperCase() It converts all string characters in this to upper case.
trim() It returns the string without any whitespace.
compareTo() It compares this object to another.


Q16.  What are the types of list in Dirt?

Ans: There are two types of list in Dirt that are given below:

  1. Fixed Length List : (length fixed)
  2. Growable List: (Length can change at runtime.

Q17. What Is Method Overriding In Dart?

Ans: In Dart, Method Overriding is a technique that child class redefines a method in its parent class.

Example:
void main() {
Child c = new Child();
c.m1(12);
}
class Parent {
void m1(int a){ print("value of a ");}
}
class Child extends Parent {
@override
void m1(int b) {
print("value of b ");
}
}

Q18. Which editor is used to enables breakpoint and step by step debugging?

Ans: WebStorm editor is used to enables breakpoint and step by step debugging.

Q19. What is typedef in Dart?

Ans: In Dart, A typedef (Or function types alias) helps to define pointer to execute code within memory.

Syntax:

typedef function_name(parameters)

Q20. What is the file extension of Dart?

Ans: The file extension of Dart is .Dart.

Q21. What are the various methods to manipulate strings?

Ans: There are various methods to manipulate string that are given in table:

String Methods Description
toLowerCase() It converts all the string character into lower case.
toUpperCase() It converts all the string character into upper case.
trim() It returns the string without any leading and trailing whitespace.
compareTo() It compare objects to another objects.

Q22. Does Dart have syntax to declare interface?

Ans: No, Class declarations are themselves interfaces in Dart.

Q23. What is pub in Dart?

Ans:In Dart, pub is a tool for manage Dart packages.