MAD (NEP & CBCS) Questions with Answers

2 Marks (Important)

1. What is Flutter?

Flutter is an open-source UI software development toolkit (SDK) created by Google. It is used to develop a cross platform applications for mobile (Android & iOS).

2. What is Dart?
Dart is an open-source, general-purpose programming language developed by Google. It is primarily used for building web, server, and mobile applications.
3. List Flutter features?
  • Hot Reload
  • Widgets
  • Cross-platform
  • Rich motion APIs
  • Expressive and flexible UI
  • Performance
  • Access to native features
  • Community and tooling
  • Smooth Animations
4. Differentiate Flutter Advantages and Dis-Advantages?
AdvantagesDisadvantages
Single Codebase for Multiple PlatformsLarge App Size
Fast Development with Hot ReloadLimited Third-Party Libraries
High PerformanceLearning Curve & Large file Size
Rich and Customizable UILimited Native UI Components
Strong Community and EcosystemLimited Integration with Some Platforms
Access to Native FeaturesDependency on Flutter Ecosystem
Open SourceLimited Libraries 
5. How variables are declared and initialized in Dart?

In Dart, Variables can be declare using ‘var’, ‘final’, & ‘const’.  Variables can also be explicitly typed. 

or
Declare a variable & Initializing;
datatype variable_name = value;

int number =42;

number is a variable of type ‘int’ with the value 42. 

6. Differentiate var, constant and final values in Dart?

var keyword:

  • Used to declare properties within a class.
  • mutable: The value can be changed after initial assignment.

ex:

class myclass
{
var $myvar="Hello";
}

final keyword:

  • Used to prevent a class from being extended.
  • mutability is not applicable.

ex:

class myclass
{
final public function myMethod()
{
//Method Content
}
}

const keyword:

  • Used to declare immutable class constants.
  • Mutability: The value can’t be changed once assigned.

ex:

const double pi = 3.14;
7. Mention various Data Types in Dart with Example?

Dart is a statically-typed language, meaning variables are explicitly assigned data types when declared. Some common data types in Dart include:

1. int: Used for integer values.
ex:

int score = 42;

2. double: Represents floating-point numbers.
ex:

double piValue = 3.14;

3. String: Represents a sequence of characters.
ex:

String name = 'Alice';

4. boolean: Represents a boolean value (`true` or `false`).
ex:

bool isFlutterAwesome = true;

5. List: Represents an ordered collection of objects.
ex:

List<int> numbers = [1, 2, 3, 4, 5];

6. Map: Represents a collection of key-value pairs.
ex:

Map<String, dynamic> person = {
'name': 'Bob',
'age': 30,
};

7. dynamic: Represents a type that can change at runtime.
ex:

dynamic value = 'hello';
value = 42;

8. var: A type inference keyword that deduces the type from the assigned value at compile-time.
ex:

var item = 'Dart';
8. Why loops are used in Dart, Mention its types?

Loops in Dart are used to repeatedly execute a block of code based on specific conditions, helping to automate repetitive tasks, iterate over data collections, and manage control flow efficiently.

  1. for loop
  2. for-in loop
  3. while loop
  4. do-while loop 
  5. forEach loop:
9. Create a class named Person with attributes name and age in Dart?
class Person 
{
String name;
int age;

Person(this.name, this.age);

void display()
{
print('Name: $name, Age: $age');
}
}

void main()
{
Person person = Person('Alice', 30);
person.display();
}
// Output: Name: Alice, Age: 30
10. Give example for Named Parameter in Dart.
void greet({String name, String greeting}) 
{
print('$greeting, $name!');
}

void main()
{
greet(name: 'Alice', greeting: 'Hello');
}
11. Give example for Arrow Functions in Dart?
int square(int num) 
{
return num * num;
}

int squareArrow(int num) => num * num;

void main()
{
print(square(5)); // Output: 25
print(squareArrow(5)); // Output: 25
}
or
int add(int a, int b) => a + b;
void main()
{
print(add(5, 3)); // Output: 8
}
12. What are widgets in Flutter?
In Flutter, widgets are the fundamental building blocks used to construct the user interface (UI) of an application. Such as Buttons, Text fields & Images.

Types:

  • Stateless Widgets
  • Stateful Widgets
13. What are Gestures in Flutter?
Gestures are used to interact with an application. It is generally used in touch-based devices to physically interact with the application.
or
In Flutter, gestures refer to user interactions with the touchscreen or mouse, such as tapping, swiping, or pinching. Flutter provides a rich set of gesture recognition capabilities to handle these interactions and respond appropriately within the app
14. Mention Platform specific widgets?
  • Buttons
  • Text Fields
  • Switch Widgets
  • Date Pickers
  • Time Pickers
  • Alert Dialogs
  • Navigation Bars
  • AppBar
  • Recycler View
  • FloatingActionButton
  • CupertinoButton
15. Describe are align and Center widget?

The “Align” widget in Flutter is used to align its child within itself and could be aligned using the alignment property. or Provides precise control over the alignment of a child widget within its parent.

ex:

Align(
alignment: Alignment.topRight,
child: Text('Top Right'),
)

The “Center” widget, on the other hand, is a convenience widget that centers its child within itself both vertically and horizontally. or A simpler way to center a child widget within its parent.

ex:

Center(
child: Text('Centered'),
)
16. Mention the properties of Material App?

 The MaterialApp widget in Flutter is a fundamental building block for Flutter applications, providing the structure for the app’s layout and navigation.

  • Home
  • Title
  • Theme
  • Routes
  • InitialRoute
  • NavigatorKey Colour
  • ThemeMode
  • Colour
17. Mention the properties of Image Widget?
  • Image
  • Width
  • Height
  • Color
  • fit
  • Alignment
  • Repeat
18. What is Padding Widget?

The Padding widget is a powerful tool for creating spacing and defining the layout of UI components and is commonly used to provide appropriate spacing around various elements within a Flutter application.

or

The Padding widget in Flutter is used to create space around its child widget by adding padding, which is essentially empty space, inside the edges of its parent container. This widget is commonly used to control the spacing around a widget, making the UI layout more visually appealing and easier to manage.

19. Write as sample code to demonstrate tap gesture?
import 'package:flutter/material.dart';

void main() {
runApp(MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Tap Gesture Demo')),
body: GestureDetector(
onTap: ()
{
print('Single tap detected');
},
child: Center(
child: Text('Tap me!'),
),
),
),
));
}
20. Write as sample code to demonstrate double-tap gesture?
import 'package:flutter/material.dart';

void main() {
runApp(MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Double-Tap Gesture Demo')),
body: GestureDetector(
onDoubleTap: ()
{
print('Double tap detected');
},
child: Center(
child: Text('Double-tap me!'),
),
),
),
));
}
21. Write as sample code to demonstrate long-press gesture?
import 'package:flutter/material.dart';

void main() {
runApp(MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Long-Press Gesture Demo')),
body: GestureDetector(
onLongPress: ()
{
print('Long press detected');
},
child: Center(
child: Text('Long-press me!'),
),
),
),
));
}
22. Mention the use of following gestures: (Input, Checkbox, Radio, Date, Time Picker, ListView)
  1. Input Gesture: In Flutter, user input is commonly managed through text fields and form widgets. The GestureDetector widget can also be used to capture input gestures.

  2. Checkbox Gesture: Checkboxes are used for allowing users to select multiple options from a set. In Flutter, the Checkbox widget is used to represent this user interaction.

  3. Radio Gesture: Radio buttons are used when only one selection is allowed from a group of options. In Flutter, the Radio widget is employed to implement this functionality.

  4. Date Picker Gesture: Date pickers allow users to select dates conveniently. The showDatePicker function in Flutter can be used to display a date picker.

  5. Time Picker Gesture: Time pickers enable users to select a specific time. In Flutter, the showTimePicker function can be used to present a time picker to the user.

  6. ListView Gesture: The ListView widget is used to create a scrollable list of widgets. Users can interact with the list by scrolling and tapping on its items.

23. What is Ephemeral State?

Ephemeral State refers to a temporary state that is local to a specific part of the user interface and does not need to be preserved across different parts of the app or when the app is closed. This state is typically short-lived and only matters as long as the particular widget is alive.

24. What is Application State?

Application State refers to the state that needs to be shared across different parts of the app, or persisted even when the app is closed and reopened. This state is typically more long-lived and is important for the overall functionality of the application.

25. What is State Management in Flutter?
State Management in Flutter refers to the techniques and tools used to manage the state of an application. In Flutter, “state” represents the mutable data that affects how the UI is displayed. Proper state management is crucial for creating responsive and interactive applications.
26. What is navigation and routing in flutter?

Navigation and Routing in Flutter manage how users move between different screens (routes) in an app. It allows the creation of multi-screen apps with a structured navigation flow.

27. Give Examples for stateful widget.
  1. Checkbox Widget: The Checkbox widget maintains the state of whether it is checked or unchecked. When the state changes, the UI representation of the Checkbox widget also changes accordingly.

  2. TextField Widget: This widget manages the state of the text entered by the user. Any changes to the input are reflected in the UI dynamically as the user types.

  3. Slider Widget: The Slider widget keeps track of its own state representing the current value, which is reflected visually as the user interacts with it.

  4. ExpansionPanel Widget: This widget maintains the state of whether it is expanded or collapsed. When the user interacts with it.

28. What are packages?

Packages are collections of Dart code that can include libraries, tools, and assets. They encapsulate reusable functionality and can be shared among different applications or projects.

or

Packages in Flutter are reusable code modules that provide specific functionalities or UI components. They can be created by individuals or organizations and shared with the community through the pub.dev repository.

29. How to use packages in dart?

 To use packages in Dart, you can follow these general steps:

  1. Find and select a package.
  2. Add the package to pubspec.yaml.
  3. Run flutter get pub to fetch the package.
  4. Import the package into your Dart files.
  5. Use the package as per its documentation.
  6. Update the package if necessary.
30. Mention some packages and their uses in dart?
  1. http: This package provides functions for making HTTP requests. It is commonly used to interact with web servers, APIs, and to perform network operations in Dart and Flutter applications.

  2. shared_preferences: The shared_preferences package allows for persistent key-value storage. It is often used for storing simple data such as user preferences, settings, and small amounts of app data locally on the device.

  3. provider: The provider package is a popular state management solution for Flutter applications. It simplifies the process of managing state and sharing data between widgets without needing to use a StatefulWidget directly.

  4. intl: The intl package provides internationalization and localization support for Dart and Flutter applications. It allows for the easy formatting of dates, numbers, and currencies according to different locales and provides methods for handling translations.

  5. firebase_core and firebase_auth: These packages are part of the Firebase collection and are used to integrate Firebase services, including authentication, into Dart and Flutter applications.

  6. flutter_bloc: The flutter_bloc package offers an implementation of the BLoC (Business Logic Component) pattern, a popular way to manage application state in Flutter.

31. What are REST APIs?
REST APIs (Representational State Transfer Application Programming Interfaces) are a set of rules and conventions for building and interacting with web services. They allow different software systems to communicate over the internet in a stateless, standardized manner.
or
REST APIs (Representational State Transfer APIs) are a set of rules and standards for building web services that allow applications to communicate and exchange data over the internet.
32. Which library helps to access API's?
  1. http.
  2. Dio.
  3. retrofit.
  4. chopper.
33. What is SQLite?

SQLite is a lightweight relational database management system (RDBMS). SQLite is one of the most popular and easy-to-use relational database systems. It possesses many features over other relational databases.

or

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose.

SQLite is built into all mobile phones and most computers and comes bundled with countless other applications that people use every day.

34. Mention methods of SQLiteDbProvider.
  1. OpenDatabase: This method is used to open or create a database. It initializes the database and allows you to perform operations like inserting, updating, deleting, and querying data.

  2. insert: This method is used to insert data into a specified table in the SQLite database.

  3. update: The update method is used to modify existing data in the database based on certain conditions.

  4. delete: This method is used to delete data from a table based on specified criteria.

  5. query: The query method is used to retrieve data from the database based on specific conditions or filters.

35. What is Mobile App Development?

Mobile app development is the process of creating software applications that run on mobile devices like smart phones, tablets, and even smart watches. These apps can be downloaded from app stores (like Google Play Store or Apple App Store)

36. Name two primary programming languages used for Android native app development.
  • Java 
  • Kotlin
37. What is an online sandbox in the context of software development?

Online sandboxes are web-based development environments that allow you to write, run, and share code directly from your browser without needing to install any software on your local machine. They provide a quick and easy way to experiment with new technologies, prototype applications, and collaborate with others.

38. Mention two popular online sandboxes for Flutter application development.
  • Dart Pad 
  • Code Pen
39. What is FlutLab.io?

FlutLab.io is an online IDE and sandbox specifically designed for Flutter development. It allows developers to create, test, and debug Flutter applications directly in the browser

40. What is Front-End (User Interface)?

Front-End (User Interface): This is the part of the app users interact with directly. It includes the visual design, layout, buttons, menus, and everything on the screen.

41. What is Back - End?

Back-End: This is the behind-the-scenes engine that handles data processing, interacts with servers, and provides functionalities that the front- end relies on. APIs (Application Programming Interfaces) act as messengers between the front-end and back-end.

42. What is Flow Control Constructs?

Flow control constructs are fundamental elements in programming languages that manage the order in which statements, instructions, or function calls are executed or evaluated. They enable the programmer to dictate the sequence and conditions under which different parts of the code are executed, making the program dynamic and responsive to various inputs and conditions.

43. Define Looping Statements?

Looping statements are constructs in programming that allow a set of instructions to be executed repeatedly based on a condition or a set number of times. They are essential for tasks that require repetitive operations, such as iterating over elements in a collection, performing operations on data sets, and automating repetitive tasks.

44. Functions in Dart & Benefits?

Functions are self-contained blocks of code designed to perform a specific task. They allow for better organization, modularity, and reusability of code. By breaking down complex tasks into smaller, manageable pieces, functions make code easier to read, maintain, and debug.

Benefits:

  • Code Reusability
  • Modularity
  • Maintainability
  • Abstraction
45. What is Lists in Dart

A List in Dart is an ordered collection of items, where each item can be accessed by its index. Lists are similar to arrays in other programming languages.

46. Define Map in Dart.

A Map in Dart is an unordered collection of key-value pairs, where each key is unique and is used to access its corresponding value.

47. What is Object-Oriented Programming (OOP) in Dart?

Object-Oriented Programming (OOP) is a programming paradigm based on the concept of objects, which contain data and methods. Dart is an object-oriented language with classes and objects, supporting encapsulation, inheritance, and polymorphism.

48. How do you access an element by its index in a list?

In Dart, you can access an element by its index in a list using square brackets []. The index is zero-based, meaning the first element is at index 0, the second at index 1, and so on.

Example:

List<int> myList = [10, 20, 30, 40, 50];
int element = myList[2];
print(element);

//output is 30
49. What is the difference between a Map and a List data structure in Dart?
  Map  List 
Stores key-value pairs             Stores an ordered collection of elements  
Accessed via keys                         Accessed via index       
Iterates over key-value pairs          Iterates over elements by index     
Declared using curly braces `{}`        Declared using square brackets `[]`  
Duplicate Keys Not AllowedDuplicate Keys Allowed
Ex: `var myMap = {‘a’: 1, ‘b’: 2, ‘c’: 3};`    Ex: `var myList = [1, 2, 3, 4, 5];`    
50. What is the syntax for calling a method on an object instance in Dart?
objectInstance.methodName(arguments);

 

51. What does JSON stand for and what is its primary use?

JSON, stands for (JavaScript Object Notation), is a lightweight data-interchange format that is easy for humans to read and write, and easy for machines to parse and generate.

52. What does a Future represent in Dart?

In Dart, a Future represents a value or error that will be available at some point in the future. It is used to perform asynchronous operations such as fetching data from a network, reading files, or executing computations that may take time to complete.

53. What are the key features of SQLite?
  • SQLite is totally free
  • SQLite is serverless
  • SQLite is very flexible
  • Configuration Not Required
  • SQLite is a cross-platform DBMS
  • Storing data is easy
  • Variable length of columns
  • Provide large number of API’s

    2 Comments

    1. Dear [OurCreativeInfo Team],

      I hope this message finds you well.

      I wanted to take a moment to express my sincere gratitude for the valuable notes you provided on for all topics. The information was not only insightful but also incredibly helpful for my studies. Your dedication to sharing knowledge is truly appreciated.

      Thank you once again for your efforts in creating and sharing such important content.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    error: Content is protected !!