Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Daffodil International University Teacher Initial:

Summer 2021 TNU


Department of Computer Science and Engineering
Final Open Book Examination Answer Script
Full Marks: 25 Allowed Time: 4hrs (from: 01:30 to 04:00)
Date: Sunday 4, July 2021

General Information (must be filled by the student)


COURSE CODE: SECTION: PROGRAM: DAY
CSE 423 PC-C
STUDENT ID: TIME STARTED: TIME ENDED:
181-15-1965 01:30 04:00

[Student must either TYPE or HAND WRITE the answers in this template; In case needed just
write your detail on the paper using hand]

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
Ans of 3

:
int s = 12;

int s1 = 1;

int t = 1;

void setup()

pinMode(11, OUTPUT);

pinMode(10, OUTPUT);

pinMode(9, OUTPUT);

pinMode(8, OUTPUT);

pinMode(7, OUTPUT);

pinMode(6, OUTPUT);

pinMode(5, OUTPUT);

pinMode(4, OUTPUT);

pinMode(3, OUTPUT);

pinMode(2, OUTPUT);
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
pinMode(s, INPUT); //switch 1

pinMode(s1, INPUT); //switch 2

Serial.begin(9600);

void loop()

digitalWrite(11, HIGH); // rule 1

delay(1000);

digitalWrite(11, LOW);

delay(1000);

digitalWrite(10, HIGH);

delay(1000);

digitalWrite(10, LOW);

delay(1000);

digitalWrite(9, HIGH);

delay(1000);

digitalWrite(9, LOW);

delay(1000);

digitalWrite(6, HIGH);

delay(1000);

digitalWrite(6, LOW);

delay(1000);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
digitalWrite(5, HIGH);

delay(1000);

digitalWrite(5, LOW);

delay(1000);

digitalWrite(3, HIGH);

delay(1000);

digitalWrite(3, LOW);

delay(1000);

digitalWrite(8, HIGH);

delay(1000);

digitalWrite(8, LOW);

delay(1000);

digitalWrite(7, HIGH);

delay(1000);

digitalWrite(7, LOW);

delay(1000);

digitalWrite(4, HIGH);

delay(1000);

digitalWrite(4, LOW);

delay(1000);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
digitalWrite(2, HIGH);

delay(1000);

digitalWrite(2, LOW);

delay(1000);

for(int i=0; i<=255; i=i+1){ //rule 2

analogWrite(11, i);

delay(1000);

analogWrite(11, i);

delay(1000);

analogWrite(10, i);

delay(1000);

analogWrite(10, i);

delay(1000);

analogWrite(9, i);

delay(1000);

analogWrite(9, i);

delay(1000);

analogWrite(6, i);

delay(1000);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
analogWrite(6, i);

delay(1000);

analogWrite(5, i);

delay(1000);

analogWrite(5, i);

delay(1000);

analogWrite(3, i);

delay(1000);

analogWrite(3, i);

delay(1000);

for(int j=0; j<=10; j=j+1){ //rule 3

int sv = digitalRead(s);

if(sv == 0) {

digitalWrite(11, HIGH);

delay(60);

digitalWrite(11, LOW);

delay(60);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
digitalWrite(10, HIGH);

delay(60);

digitalWrite(10, LOW);

delay(60);

digitalWrite(9, HIGH);

delay(60);

digitalWrite(9, LOW);

delay(60);

digitalWrite(6, HIGH);

delay(60);

digitalWrite(6, LOW);

delay(60);

digitalWrite(5, HIGH);

delay(60);

digitalWrite(5, LOW);

delay(60);

digitalWrite(3, HIGH);

delay(300);

digitalWrite(3, LOW);

delay(300);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
digitalWrite(8, HIGH);

delay(300);

digitalWrite(8, LOW);

delay(300);

digitalWrite(7, HIGH);

delay(300);

digitalWrite(7, LOW);

delay(300);

digitalWrite(4, HIGH);

delay(300);

digitalWrite(4, LOW);

delay(300);

digitalWrite(2, HIGH);

delay(300);

digitalWrite(2, LOW);

delay(300);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
}

int sv1 = digitalRead(s1); //rule 4

if(sv1 == 0) {

t++;

delay(10);

if(t%2==0){

digitalWrite(11, HIGH);

delay(1000);

digitalWrite(10, HIGH);

delay(1000);

digitalWrite(9, HIGH);

delay(1000);

digitalWrite(6, HIGH);

delay(1000);

digitalWrite(5, HIGH);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
delay(1000);

digitalWrite(3, LOW);

delay(300);

digitalWrite(8, LOW);

delay(300);

digitalWrite(7, LOW);

delay(300);

digitalWrite(4, LOW);

delay(300);

digitalWrite(2, LOW);

delay(300);

else{

digitalWrite(11, LOW);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
delay(1000);

digitalWrite(10, LOW);

delay(1000);

digitalWrite(9, LOW);

delay(1000);

digitalWrite(6, LOW);

delay(1000);

digitalWrite(5, LOW);

delay(1000);

digitalWrite(3, HIGH);

delay(300);

digitalWrite(8, HIGH);

delay(300);

digitalWrite(7, HIGH);

delay(300);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
digitalWrite(4, HIGH);

delay(300);

digitalWrite(2, HIGH);

delay(300);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
Ans of 4:

int L1 = 13;

int L2 = 12;

int F = 11;

int a = 0;

int a1 = 0;

void setup() {

pinMode(L1, OUTPUT);

pinMode(L2, OUTPUT);

pinMode(F, OUTPUT);

Serial.begin(9600);

void loop() {

int v; //rule 1

v = analogRead(a);

float mv = (v/1024.0)*5000;

float cel = mv/10;

float fh = (cel*9)/5+32;

Serial.println(fh);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
int v1;

v1 = analogRead(a1);

float mv1 = (v/1024.0)*5000;

float cel1 = mv/10;

float fh1 = (cel*9)/5+32;

Serial.println(fh1);

if(fh>30 && fh1>30){

digitalWrite(F,HIGH);

//delay(5000);

** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.

You might also like