0% found this document useful (0 votes)
16 views7 pages

Lab 01

Uploaded by

vrund3626
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Lab 01

Uploaded by

vrund3626
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Laboratory Work

Subject: Smart Device Programming


Branch: B.Tech. (CE)
Semester: IV
Batch: ___B2_____

Student Roll Nos: _ CE106 ,_ CE122____


Student Names: ___Vrund Dobariya_, Manav Kalariya
Batch No.: B2
Group No.: 2_____
Lab No.: 1___

Department of Computer Engineering,


Faculty of Technology,
Dharmsinh Desai University, Nadiad – 387001.
Gujarat, INDIA.
LAB-1
Theory Questions:

1. Explain Cross Platform in detail.


Cross-platform typically refers to the ability of software, applications, or technologies to work
seamlessly across multiple computing platforms or operating systems. This capability is increasingly
important as users and developers seek flexibility and efficiency in their software solutions without
being tied to a single platform.
Each platform offers its own APIs for accessing hardware features, UI components, file systems, etc.
Cross-platform frameworks abstract these differences, providing a unified API layer that developers
can use, which is then translated or adapted to each specific platform at runtime.

2. Compare JIT and AOT.

Just-in-Time (JIT) Compilation:

Definition:

o JIT compilation refers to the process of translating and compiling code at


runtime, just before it is executed by the CPU.
o The compilation happens dynamically while the program is running, typically
in response to user actions or program flow.

Ahead-of-Time (AOT) Compilation:


1. Definition:
o AOT compilation involves translating and compiling code into machine code
or a lower-level intermediate language before the program is executed.
o The compilation occurs once, typically during the build process or installation,
and the compiled code is then executed directly by the CPU.
2. Usage:
o Commonly used in systems programming languages (like C, C++) and in
frameworks targeting performance-critical applications (like mobile apps,
embedded systems).
3. Advantages:
o Faster Startup: AOT-compiled code starts executing immediately without the
initial overhead of JIT compilation.
o Predictable Performance: AOT-compiled code is optimized at compile time,
leading to consistent performance characteristics.
4. Disadvantages:
o Slower Development Iteration: Changes in code require recompilation, which
can slow down development cycles compared to JIT-based environments.
o Increased Binary Size: AOT compilation often results in larger binaries
because the compiled code is included directly in the application package.
3. Compare Dart Flutter and React Native.

Flutter (Dart) offers high performance and custom UIs, but requires learning a new language.
React Native (JavaScript) is familiar and faster for basic apps, with a larger community. Both
are cross-platform, but Flutter has a steeper learning curve due to its unique codebase. Flutter
excels in consistent design, React Native for platform-specific UIs. Choose based on project
needs, developer experience, and desired performance.

Program Questions:

1. Create a "Hello World" Program.


main(List<String> arguments) {

print("Hello World!");

2. Find Factorial of a number. import 'dart:io';

int fact(int n) { if(n==1 ||

n==0) return 1; else

return n*fact(n-1);

main(List<String> arguments) { int? n =

int.parse(stdin.readLineSync()!);

stdout.write(fact(n));

}
3. Find a Prime number from the given range. (Static Input)
import 'dart:math'; import

'dart:io'; isPrime(int n) {

bool f=true; for(int

i=2;i<=sqrt(n);i++) {

if(n%i==0) { f=false;

break;

} }

if(f) {

print(n);

main(List<String> arguments) {

int l,r;

l=34; r=89;

for(int

i=l;i<=r;i++)

isPrime(i);

}
4. Find Armstrong Number from the given range. (Static input)

import 'dart:io'; import

'dart:math';

main(List<String> arguments) {

String s = stdin.readLineSync()!;

int l=s.length; int n =

int.parse(s); int k,amstr = 0,

m=n; while(m!=0) {

k=m%10;

amstr+=pow(k,l).toInt();

m~/=10;

print(amstr==n);
}

5. Draw Triangle pattern using '*'.


void main() {

int rows = 5;

for (int i = 1; i <= rows; i++) {

String space="";

String star="";

for (int j = 1; j <= rows - i; j++) {

space+=" ";

for (int k = 1; k <= 2 * i - 1; k++) {

star+="*";

print(space+star);

print('');

}
}

You might also like