├── CD Lab ├── Simple parsers │ ├── inp.txt │ ├── out.txt │ ├── README.MD │ ├── include │ │ ├── common.h │ │ ├── lexer.h │ │ └── preprocessor.h │ ├── src │ │ └── test.c │ └── Makefile ├── Another Parser │ ├── temp.c │ ├── out.txt │ ├── include │ │ ├── common.h │ │ ├── lexer.h │ │ └── preprocessor.h │ ├── src │ │ └── test.c │ ├── Makefile │ └── README.MD ├── C like Parser 1 │ ├── temp.c │ ├── notclang │ ├── out.txt │ ├── include │ │ ├── common.h │ │ ├── lexer.h │ │ └── preprocessor.h │ ├── README.MD │ ├── src │ │ └── test.c │ └── Makefile ├── Simple LP │ └── input.c ├── C like Parser 2 │ ├── temp.c │ ├── include │ │ ├── common.h │ │ ├── lexer.h │ │ └── preprocessor.h │ ├── src │ │ └── test.c │ └── Makefile ├── Simple LP With Get Next Token │ └── input.c ├── lex │ ├── inf.c │ ├── out.c │ ├── count_lines.l │ ├── compound.l │ ├── vowel_consonants.l │ ├── replace.l │ ├── positive_negative.l │ └── words.l ├── C like Parser 3 │ ├── temp.c │ ├── include │ │ ├── common.h │ │ ├── lexer.h │ │ └── preprocessor.h │ ├── src │ │ └── test.c │ └── Makefile ├── README.MD ├── C like Parser 4 │ ├── temp.c │ ├── include │ │ ├── common.h │ │ ├── lexer.h │ │ └── preprocessor.h │ ├── out.txt │ ├── src │ │ └── test.c │ └── Makefile ├── File operations │ ├── filesize.c │ └── copyfile.c └── Scanning │ ├── discard_newlinetab.c │ └── discard_blanks.c ├── SCLD Lab ├── Lab 02 │ ├── untitled2.v │ ├── prog1.scf │ ├── prog2a.scf │ ├── prog2b.scf │ ├── prog2c.scf │ ├── prog1.v │ ├── prog2b.v │ ├── prog2c.v │ └── prog2a.v ├── Lab 01 │ ├── demo.scf │ ├── prog1.scf │ ├── prog1b.scf │ ├── prog2.scf │ ├── prog2b.scf │ ├── prog3.scf │ ├── demo.v │ ├── prog2b.v │ ├── prog1b.v │ ├── prog3.v │ ├── prog1.v │ └── prog2.v ├── Lab 03 │ ├── prog1.scf │ ├── prog2.scf │ ├── prog3.scf │ ├── prog4.scf │ ├── prog4.v │ ├── prog1.v │ ├── prog2.v │ └── prog3.v ├── Lab 04 │ ├── prog1.scf │ ├── prog2.scf │ ├── prog3.scf │ ├── prog4.scf │ ├── prog2.v │ ├── prog4.v │ ├── prog1.v │ └── prog3.v ├── Lab 05 │ ├── prog1.scf │ ├── prog1b.scf │ ├── prog2.scf │ ├── prog3.scf │ ├── prog4.scf │ ├── prog5.scf │ ├── prog1.v │ ├── prog1b.v │ ├── prog4.v │ ├── prog2.v │ └── prog3.v ├── Lab 06 │ ├── prog1.scf │ ├── prog2.scf │ ├── prog3.scf │ ├── prog4.scf │ ├── prog5.scf │ ├── prog4.v │ ├── prog3.v │ ├── prog1.v │ ├── prog5.v │ └── prog2.v ├── Lab 07 │ ├── prog1.scf │ ├── prog3.scf │ ├── prog4.scf │ ├── prog2_1.scf │ ├── prog2_2.scf │ ├── prog2_2.v │ ├── prog3.v │ ├── prog4.v │ └── prog2_1.v └── Lab 08 │ ├── prog1.scf │ ├── prog2.scf │ ├── prog3.scf │ ├── prog4.scf │ ├── prog2.v │ ├── prog3.v │ ├── prog1.v │ └── prog4.v ├── OOP Lab ├── Input Output │ ├── SortedMerge │ │ ├── 05.txt │ │ ├── 02.txt │ │ └── 04.txt │ ├── Copy2.java │ ├── Copy.java │ ├── Copy4.java │ └── Copy5.java ├── Basics │ ├── EmptyTemplate.java │ ├── Pyramid.java │ ├── Largest.java │ ├── SumDigits.java │ ├── PrimeGenerator.java │ └── Armstrong.java ├── Interfaces and Exception Handling │ ├── Stack │ │ ├── Stack.java │ │ ├── DynamicStack.java │ │ └── FixedStack.java │ ├── ByTwos │ │ ├── Series.java │ │ └── ByTwos.java │ └── Employee │ │ └── EmployeeTest.java ├── Inheritance and Packages │ ├── Building │ │ ├── School.java │ │ ├── Building.java │ │ └── House.java │ └── myPackages │ │ └── p1 │ │ └── Max.java ├── Generics │ └── Tree │ │ ├── Tree │ │ └── TNode.java │ │ └── BTTest │ │ └── BinaryTreeTest.java └── Constructors │ └── Counter.java ├── OS Lab ├── Shell Intro │ ├── listonechext │ ├── listallcfiles │ ├── date │ ├── usercount │ ├── list │ ├── filecount │ ├── lista │ ├── willcompile.c │ ├── multiple │ ├── subshell │ ├── wontcompile.c │ ├── compiletest │ └── grep.c ├── OS Lab By Week │ ├── lab2 │ │ ├── prog2input.txt │ │ ├── prog2output.txt │ │ ├── prog1.c │ │ ├── prog2.c │ │ └── scr1.sh │ ├── lab3 │ │ ├── usl2 │ │ ├── usl.sh │ │ ├── prog3.sh │ │ ├── prog1.sh │ │ ├── prog4.sh │ │ ├── add1.sh │ │ ├── add3.sh │ │ └── add2.sh │ ├── lab1 │ │ ├── .prog4.c.swp │ │ ├── prog1.c │ │ ├── prog2.c │ │ └── prog3.c │ ├── lab4 │ │ ├── prog1.c │ │ ├── prog4.c │ │ ├── prog6.c │ │ ├── prog2-3.c │ │ └── prog5.c │ ├── lab7 │ │ ├── prog2.c │ │ ├── prog3client.c │ │ ├── prog3server.c │ │ └── prog4.c │ ├── lab6 │ │ └── prog1.c │ └── lab11 │ │ └── prog1.c ├── Intro to Shell and C Programs │ ├── prog1.c │ ├── .prog4.c.swp │ ├── prog2.c │ └── prog3.c ├── System Calls │ ├── hellowait.c │ ├── fork.c │ ├── block.c │ ├── file.c │ ├── exeggute.c │ ├── wait.c │ ├── pids.c │ ├── copy.c │ ├── mfork.c │ ├── orphan.c │ └── zombie.c ├── Inter process communication │ ├── message queue │ │ ├── common.h │ │ ├── client_message_queue.c │ │ └── server_message_queue.c │ └── number_of_users.c ├── Shell Control Statements │ ├── fibonacci │ ├── numbertest │ ├── reverse │ ├── palindrome │ ├── gcd │ └── primesum └── Semaphores and Named Pipes │ └── prod cons fifo │ ├── common.h │ └── consumer.c ├── .gitignore ├── CN Lab ├── Concurrent Server │ ├── files │ │ ├── hello.txt │ │ ├── halfbp.txt │ │ ├── ib.txt │ │ ├── deadpool.txt │ │ ├── machine.txt │ │ └── common.h │ └── time │ │ └── common.h ├── App Layer │ └── 43_NW_7.pdf ├── TCP Client Server │ ├── temp │ │ └── a.c │ ├── dftp │ │ ├── files │ │ │ ├── helloworld.c │ │ │ ├── numbers.c │ │ │ └── fibonacci.c │ │ └── common.h │ ├── exeggute │ │ ├── a.c │ │ ├── b.c │ │ └── common.h │ ├── multiple │ │ └── common.h │ └── echo │ │ └── common.h ├── UDP Client Server │ ├── chat │ │ └── common.h │ └── echo │ │ └── common.h ├── README.MD └── Synchronous IO Multiplexing │ ├── echo │ └── common.h │ ├── time │ └── common.h │ ├── group chat │ └── common.h │ └── select demo │ └── select_demo.c ├── DBMS Lab ├── Constraints and Dates │ ├── lab4-11.sql │ ├── lab4-13.sql │ ├── lab4-6.sql │ ├── lab4-10.sql │ ├── lab4-14.sql │ ├── lab4-12.sql │ ├── lab4-15.sql │ ├── lab4-21.sql │ ├── lab4-23.sql │ ├── lab4-25.sql │ ├── lab4-3.sql │ ├── lab4-22.sql │ ├── lab4-24.sql │ ├── lab4-20.sql │ ├── lab4-7.sql │ ├── database.db │ ├── lab4-18.sql │ ├── lab4-19.sql │ ├── lab4-2.sql │ ├── lab4-17.sql │ ├── lab4-5.sql │ ├── lab4-1.sql │ ├── lab4-16.sql │ └── lab4-4.sql ├── Database │ ├── univ.db │ └── README.TXT ├── SQL Basics │ └── UniversitySchema.png ├── Lab 4 ER diagrams │ ├── ConferenceER.dia │ └── ShipOrderER.dia ├── ER Diagram to tables SQL │ ├── ER Diagram.jpg │ ├── Table Schema.jpg │ ├── lab5-1-5.sql │ └── lab5-11-15.sql ├── Triggers │ ├── 02.sql │ └── 05.sql ├── Functions and Procedures │ ├── 01.sql │ └── 05.sql ├── PL Basics │ ├── 07.sql │ ├── 03.sql │ ├── 01.sql │ ├── 04.sql │ ├── 06.sql │ ├── 02.sql │ ├── 05.sql │ └── 08.sql ├── PL Cursors And Exceptions │ ├── 05.sql │ ├── 04.sql │ ├── 01.sql │ └── 02.sql └── PL Cursors Advanced │ └── 03.sql ├── ALG Lab ├── GCD │ ├── Euclid │ │ ├── GCDEuclid.pdf │ │ └── inputfib.csv │ ├── Middle School │ │ └── GCDMiddleSchool.pdf │ ├── Conseq Integer │ │ └── GCDConseqInteger.pdf │ └── Generators │ │ ├── cpgen.c │ │ └── fibgen.c ├── Other │ ├── Tower of Hanoi │ │ ├── toh.pdf │ │ └── toh.csv │ └── Nth Fibonacci │ │ ├── fibonacci.pdf │ │ ├── fibonacci.csv │ │ └── nth_fibonacci.c ├── Greedy Approach │ ├── Floyd │ │ ├── floyd.pdf │ │ └── floyd.csv │ └── Warshall │ │ ├── warshall.pdf │ │ └── warshall.csv ├── Divide and Conquer │ ├── NodeCount │ │ ├── .~lock.number_of_nodes.csv# │ │ ├── number_of_nodes.pdf │ │ └── treegen.c │ ├── MergeSort │ │ ├── merge_sort.pdf │ │ └── numgen.c │ └── QuickSort │ │ ├── quick_sort.pdf │ │ └── numgen.c ├── Brute Forcing │ ├── Partition │ │ ├── partition.pdf │ │ └── partgen.c │ ├── Bubble Sort │ │ ├── bubblesort.pdf │ │ └── numgen.c │ ├── String Matching │ │ ├── stringmatch.pdf │ │ └── strgen.c │ └── Matrix Multiplication │ │ ├── matmult.pdf │ │ ├── matmult.csv │ │ └── gen.c └── Transform and Conquer │ ├── Heapsort │ ├── heapsort.pdf │ └── numgen.c │ ├── HeapDelete │ ├── heapdelete.pdf │ └── numgen.c │ └── Heap Creation │ ├── buildheap.pdf │ └── numgen.c ├── MP Lab ├── Number Manipulation │ ├── FIBN.PNG │ ├── UNPCK.PNG │ ├── EVENODD.PNG │ ├── HCFLCM.PNG │ ├── PCKBCD.PNG │ ├── UNPCK.ASM │ ├── PCKBCD.ASM │ ├── EVENODD.ASM │ └── FIBN.ASM ├── Introduction to MASM │ ├── DIV168.PNG │ ├── MUL88.PNG │ ├── Thumbs.db │ ├── DIV3216.PNG │ ├── MUL3216.PNG │ ├── MUL3232.PNG │ ├── DIV168.ASM │ ├── MUL1616.ASM │ ├── MUL88.ASM │ ├── DIV3216.ASM │ ├── MUL3216.ASM │ ├── MUL3232.ASM │ └── DIV32_8.ASM ├── Proceudres and Macros │ ├── EDIT.COM │ ├── FACT.ASM │ ├── SORT.ASM │ ├── BCD.ASM │ ├── MUL.ASM │ └── COPY.ASM ├── Strings │ ├── LEN.ASM │ └── Concatenate ├── Loope │ ├── INUSRT.ASM │ ├── DEUSRT.ASM │ ├── SORT.ASM │ ├── PRIME.ASM │ ├── SORT1.ASM │ ├── DESRT.ASM │ └── INSRT.ASM ├── Random Assembly │ └── asciimult.asm ├── Stepper Motors │ └── Interface2.ASM └── Files │ ├── DISP.ASM │ └── FCWRT.ASM ├── DS Lab ├── DS Lab programs by week │ ├── .SelSort.c.swp │ ├── .LabEvaluation.c.swp │ ├── Week 7 │ │ └── .stringsqueue.c.swp │ ├── Week 2 │ │ ├── Add Numbers Using Pointers.c │ │ ├── Question 2.c │ │ └── Traverse Array by Pointer.c │ ├── Week 1 │ │ ├── #AddEx1.c │ │ ├── SumOfNumbers.c │ │ ├── Week1Sub │ │ │ ├── SumOfNumbers.c │ │ │ ├── LinearSearch.c │ │ │ ├── Biggest.c │ │ │ ├── AddEx1.c │ │ │ └── BinarySearch.c │ │ ├── LinearSearch.c │ │ ├── Biggest.c │ │ ├── AddEx1.c │ │ ├── BinarySearch.c │ │ └── SelectionSort.c │ └── Week 3 │ │ ├── Decimal to Binary.c │ │ ├── Product of Natural Numbers.c │ │ ├── Factorial.c │ │ ├── Fibonacci.c │ │ ├── GCD.c │ │ ├── Sum of List.c │ │ └── Towers of Hanoi.c ├── Basic Programs │ ├── AddPtr.c │ ├── ArrayPrintPointer.c │ ├── SumArr.c │ └── NestStrUnion.c └── Basic Programs - Recursive │ ├── Product.c │ ├── Factorial.c │ ├── GCD.c │ ├── Decimal to Binary.c │ ├── SumList.c │ └── Fibonacci.c ├── PCAP Lab ├── OpenCL │ ├── swapping │ │ └── main.cl │ ├── vector_add │ │ └── main.cl │ ├── string reverse │ │ └── kernel.cl │ ├── string repeat │ │ └── kernel.cl │ ├── matrix transpose │ │ └── kernel.cl │ ├── matrix row power │ │ └── kernel.cl │ ├── octal │ │ └── main.cl │ ├── ones_comp │ │ └── main.cl │ ├── matrix repeat │ │ └── kernel.cl │ ├── string reverse each word │ │ └── kernel.cl │ ├── captalize vowels │ │ └── kernel.cl │ ├── matrix multiply │ │ └── kernel.cl │ └── matrix row col sum │ │ └── kernel.cl └── Message Passing Interface │ └── Basic programs │ └── helloworld.cpp └── Scripts ├── atom.sh └── sublime.sh /CD Lab/Simple parsers/inp.txt: -------------------------------------------------------------------------------- 1 | a -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/untitled2.v: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /OOP Lab/Input Output/SortedMerge/05.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OS Lab/Shell Intro/listonechext: -------------------------------------------------------------------------------- 1 | ls *.? 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /**/*.o 2 | /**/*.out 3 | /**/*.class -------------------------------------------------------------------------------- /CD Lab/Simple parsers/out.txt: -------------------------------------------------------------------------------- 1 | ( num num ( num num ) ) -------------------------------------------------------------------------------- /CN Lab/Concurrent Server/files/hello.txt: -------------------------------------------------------------------------------- 1 | Hello friend. -------------------------------------------------------------------------------- /OS Lab/Shell Intro/listallcfiles: -------------------------------------------------------------------------------- 1 | find . -name "*.c" 2 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-11.sql: -------------------------------------------------------------------------------- 1 | select lower(name) from instructor; -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-13.sql: -------------------------------------------------------------------------------- 1 | select upper(name) from instructor; -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-6.sql: -------------------------------------------------------------------------------- 1 | alter table Employee drop column dno; -------------------------------------------------------------------------------- /CD Lab/Another Parser/temp.c: -------------------------------------------------------------------------------- 1 | SUBSTRACT 100, 120, 140, nope FROM beats, balls, apple -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-10.sql: -------------------------------------------------------------------------------- 1 | select name, length(name) from student; -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-14.sql: -------------------------------------------------------------------------------- 1 | select nvl(semester, '1') from teaches; -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/temp.c: -------------------------------------------------------------------------------- 1 | main () { 2 | int a; 3 | char b, c; 4 | a = 10; 5 | } -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab2/prog2input.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 2 3 | 65 4 | 12 5 | 32 6 | 11 7 | 90 8 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab3/usl2: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | x=1 3 | x=`expr $x + 1` 4 | echo $x 5 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-12.sql: -------------------------------------------------------------------------------- 1 | select substr(dept_name, 3, 3) from department; -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-15.sql: -------------------------------------------------------------------------------- 1 | select salary, 100*round(salary/300) from Employee; -------------------------------------------------------------------------------- /OOP Lab/Input Output/SortedMerge/02.txt: -------------------------------------------------------------------------------- 1 | aaaaaa 2 | bbbbbb 3 | ufffff 4 | uuuuuu 5 | zzzzzz -------------------------------------------------------------------------------- /OS Lab/Shell Intro/date: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dt=$(date +%A,\ %B\ %d\ %Y) 3 | echo "Today is: $dt" -------------------------------------------------------------------------------- /CD Lab/Simple LP/input.c: -------------------------------------------------------------------------------- 1 | main () { 2 | char apple, banana; 3 | int cat, dog; 4 | cat = 5; 5 | } -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab3/usl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # random comment 3 | 4 | echo "asdgjlxzvb" 5 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-21.sql: -------------------------------------------------------------------------------- 1 | select empName, round((sysdate - dob)/365) from employee; -------------------------------------------------------------------------------- /DBMS Lab/Database/univ.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DBMS Lab/Database/univ.db -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/demo.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 01/demo.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 01/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog1b.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 01/prog1b.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 01/prog2.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog2b.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 01/prog2b.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog3.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 01/prog3.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 02/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog2a.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 02/prog2a.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog2b.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 02/prog2b.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog2c.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 02/prog2c.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 03/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 03/prog2.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog3.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 03/prog3.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog4.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 03/prog4.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 04/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 04/prog2.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog3.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 04/prog3.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog4.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 04/prog4.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 05/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog1b.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 05/prog1b.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 05/prog2.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog3.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 05/prog3.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog4.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 05/prog4.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog5.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 05/prog5.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 06/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 06/prog2.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog3.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 06/prog3.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog4.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 06/prog4.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog5.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 06/prog5.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 07/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog3.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 07/prog3.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog4.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 07/prog4.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 08/prog1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 08/prog1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 08/prog2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 08/prog2.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 08/prog3.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 08/prog3.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 08/prog4.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 08/prog4.scf -------------------------------------------------------------------------------- /CD Lab/Another Parser/out.txt: -------------------------------------------------------------------------------- 1 | <,> <,> <,> <,> <,> -------------------------------------------------------------------------------- /CN Lab/App Layer/43_NW_7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/CN Lab/App Layer/43_NW_7.pdf -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-23.sql: -------------------------------------------------------------------------------- 1 | select empName from Employee where extract(year from dob)='1970'; -------------------------------------------------------------------------------- /OS Lab/Shell Intro/usercount: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | uc=$(users | wc -l) 3 | echo "Number of users logged in = $uc" -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog2_1.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 07/prog2_1.scf -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog2_2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/SCLD Lab/Lab 07/prog2_2.scf -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/notclang: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/CD Lab/C like Parser 1/notclang -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/temp/a.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main () { 3 | printf("HELLO WORLD!"); 4 | } 5 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-25.sql: -------------------------------------------------------------------------------- 1 | select empName from Employee where (extract(year from dob)+60)=2037; -------------------------------------------------------------------------------- /ALG Lab/GCD/Euclid/GCDEuclid.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/GCD/Euclid/GCDEuclid.pdf -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-3.sql: -------------------------------------------------------------------------------- 1 | alter table Employee add foreign key (dno) references Department2(deptNo); -------------------------------------------------------------------------------- /ALG Lab/Other/Tower of Hanoi/toh.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Other/Tower of Hanoi/toh.pdf -------------------------------------------------------------------------------- /CD Lab/C like Parser 2/temp.c: -------------------------------------------------------------------------------- 1 | main () { 2 | int a; 3 | int arr[10]; 4 | char b, c; 5 | a = a + 10; 6 | b = a * c; 7 | } -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-22.sql: -------------------------------------------------------------------------------- 1 | select empName, next_day(add_months(dob, 60 * 12), 'Saturday') from Employee; -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-24.sql: -------------------------------------------------------------------------------- 1 | select empName from Employee where extract(year from dob) between 1970 and 1972; -------------------------------------------------------------------------------- /DBMS Lab/Database/README.TXT: -------------------------------------------------------------------------------- 1 | This database is compatible with SQLite (Download RazorSQL/SQLite Browser to test queries.) -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/FIBN.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Number Manipulation/FIBN.PNG -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/UNPCK.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Number Manipulation/UNPCK.PNG -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab2/prog2output.txt: -------------------------------------------------------------------------------- 1 | Enter n 2 | Enter numbers 3 | printing now 4 | 2 5 | 65 6 | 12 7 | 32 8 | 11 9 | -------------------------------------------------------------------------------- /CD Lab/Simple LP With Get Next Token/input.c: -------------------------------------------------------------------------------- 1 | main () { 2 | char apple, banana, elephant; 3 | int cat, dog; 4 | cat = 5; 5 | } -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-20.sql: -------------------------------------------------------------------------------- 1 | select last_day(dob), to_char(last_day(dob), 'DAY') from employee where empNo='002'; -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/DIV168.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Introduction to MASM/DIV168.PNG -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/MUL88.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Introduction to MASM/MUL88.PNG -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Introduction to MASM/Thumbs.db -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/EVENODD.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Number Manipulation/EVENODD.PNG -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/HCFLCM.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Number Manipulation/HCFLCM.PNG -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/PCKBCD.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Number Manipulation/PCKBCD.PNG -------------------------------------------------------------------------------- /MP Lab/Proceudres and Macros/EDIT.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Proceudres and Macros/EDIT.COM -------------------------------------------------------------------------------- /ALG Lab/Greedy Approach/Floyd/floyd.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Greedy Approach/Floyd/floyd.pdf -------------------------------------------------------------------------------- /ALG Lab/Other/Nth Fibonacci/fibonacci.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Other/Nth Fibonacci/fibonacci.pdf -------------------------------------------------------------------------------- /CD Lab/Simple parsers/README.MD: -------------------------------------------------------------------------------- 1 | # Simple parsers 2 | 3 | Lab 6 codes. 4 | 5 | `two` and `four` work with the lexer in `notclang`. -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-7.sql: -------------------------------------------------------------------------------- 1 | alter table Employee add foreign key (dno) references Department2(deptNo) on delete cascade; -------------------------------------------------------------------------------- /DBMS Lab/SQL Basics/UniversitySchema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DBMS Lab/SQL Basics/UniversitySchema.png -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/DIV3216.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Introduction to MASM/DIV3216.PNG -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/MUL3216.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Introduction to MASM/MUL3216.PNG -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/MUL3232.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/MP Lab/Introduction to MASM/MUL3232.PNG -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab1/.prog4.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/OS Lab/OS Lab By Week/lab1/.prog4.c.swp -------------------------------------------------------------------------------- /OS Lab/Shell Intro/list: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "list demo" 3 | if [ -z "$1" ]; then 4 | ls -alh 5 | else 6 | ls -alh $1 7 | fi 8 | -------------------------------------------------------------------------------- /ALG Lab/Divide and Conquer/NodeCount/.~lock.number_of_nodes.csv#: -------------------------------------------------------------------------------- 1 | ,alb2,pgcp22,13.09.2016 16:05,file:///home/alb2/.config/libreoffice/4; -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/out.txt: -------------------------------------------------------------------------------- 1 |
<(> <)> <{> 2 | <;> 3 | <,> <;> 4 | <=> <;> 5 | <}> -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/database.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DBMS Lab/Constraints and Dates/database.db -------------------------------------------------------------------------------- /DBMS Lab/Lab 4 ER diagrams/ConferenceER.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DBMS Lab/Lab 4 ER diagrams/ConferenceER.dia -------------------------------------------------------------------------------- /DBMS Lab/Lab 4 ER diagrams/ShipOrderER.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DBMS Lab/Lab 4 ER diagrams/ShipOrderER.dia -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab1/prog1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Hello There\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab2/prog1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Hello There\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/Partition/partition.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Brute Forcing/Partition/partition.pdf -------------------------------------------------------------------------------- /ALG Lab/GCD/Middle School/GCDMiddleSchool.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/GCD/Middle School/GCDMiddleSchool.pdf -------------------------------------------------------------------------------- /ALG Lab/Greedy Approach/Warshall/warshall.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Greedy Approach/Warshall/warshall.pdf -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/.SelSort.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DS Lab/DS Lab programs by week/.SelSort.c.swp -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog4.v: -------------------------------------------------------------------------------- 1 | module prog4(a, b, c, f); 2 | input a, b, c; 3 | output f; 4 | assign f = (a&b)|(b&c)|(c&a); 5 | endmodule 6 | -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/Bubble Sort/bubblesort.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Brute Forcing/Bubble Sort/bubblesort.pdf -------------------------------------------------------------------------------- /ALG Lab/GCD/Conseq Integer/GCDConseqInteger.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/GCD/Conseq Integer/GCDConseqInteger.pdf -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-18.sql: -------------------------------------------------------------------------------- 1 | select empName, to_char(dob, 'DAY') from Employee; 2 | select empName, to_char(dob, 'Day') from Employee; -------------------------------------------------------------------------------- /DBMS Lab/ER Diagram to tables SQL/ER Diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DBMS Lab/ER Diagram to tables SQL/ER Diagram.jpg -------------------------------------------------------------------------------- /OS Lab/Intro to Shell and C Programs/prog1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Hello There\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /OS Lab/Shell Intro/filecount: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | lfc=$(ls -alh | wc -l) 3 | afc=$(($lfc-3)) 4 | echo "Number of files in the current directory = $afc" -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog1.v: -------------------------------------------------------------------------------- 1 | module prog1 (x, y, s, c); 2 | input x, y; 3 | output s, c; 4 | assign s = x^y; 5 | assign c = x&y; 6 | endmodule 7 | -------------------------------------------------------------------------------- /ALG Lab/Divide and Conquer/MergeSort/merge_sort.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Divide and Conquer/MergeSort/merge_sort.pdf -------------------------------------------------------------------------------- /ALG Lab/Divide and Conquer/QuickSort/quick_sort.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Divide and Conquer/QuickSort/quick_sort.pdf -------------------------------------------------------------------------------- /ALG Lab/Transform and Conquer/Heapsort/heapsort.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Transform and Conquer/Heapsort/heapsort.pdf -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-19.sql: -------------------------------------------------------------------------------- 1 | select empName, to_char(dob, 'MONTH') from Employee; 2 | select empName, to_char(dob, 'Month') from Employee; -------------------------------------------------------------------------------- /DBMS Lab/ER Diagram to tables SQL/Table Schema.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DBMS Lab/ER Diagram to tables SQL/Table Schema.jpg -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/.LabEvaluation.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DS Lab/DS Lab programs by week/.LabEvaluation.c.swp -------------------------------------------------------------------------------- /OS Lab/Intro to Shell and C Programs/.prog4.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/OS Lab/Intro to Shell and C Programs/.prog4.c.swp -------------------------------------------------------------------------------- /OS Lab/Shell Intro/lista: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "list demo 2" 3 | if [ -z "$1" ]; then 4 | ls -alh [A-a]*.* 5 | else 6 | ls -alh $1 [A-a]*.* 7 | fi 8 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog1.v: -------------------------------------------------------------------------------- 1 | module prog1 (f, a, b, c, d); 2 | input a, b, c, d; 3 | output f; 4 | assign f = (b&d)|(~b&~d)|(~a&b); 5 | endmodule 6 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog2.v: -------------------------------------------------------------------------------- 1 | module prog2(f, a, b, c, d); 2 | input a, b, c, d; 3 | output f; 4 | assign f = (~b&~d)|(c&~d)|(a&b&~c&d); 5 | endmodule 6 | -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/String Matching/stringmatch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Brute Forcing/String Matching/stringmatch.pdf -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/dftp/files/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (int argc, const char * argv []) { 4 | printf("Hello world!\n"); 5 | } -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/Matrix Multiplication/matmult.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Brute Forcing/Matrix Multiplication/matmult.pdf -------------------------------------------------------------------------------- /ALG Lab/Divide and Conquer/NodeCount/number_of_nodes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Divide and Conquer/NodeCount/number_of_nodes.pdf -------------------------------------------------------------------------------- /ALG Lab/Transform and Conquer/HeapDelete/heapdelete.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Transform and Conquer/HeapDelete/heapdelete.pdf -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/exeggute/a.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char const *argv[]) 4 | { 5 | printf("Hello friend.\n"); 6 | return 0; 7 | } -------------------------------------------------------------------------------- /OS Lab/Shell Intro/willcompile.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char const *argv[]) { 3 | printf("Hello world!\nGoodbye world!\n"); 4 | return 0; 5 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 03/prog3.v: -------------------------------------------------------------------------------- 1 | module prog3(f, a, b, c, d); 2 | input a, b, c, d; 3 | output f; 4 | assign f = (b|d)&(~a|b)&(a|~c|~d)&(~a|c|~d); 5 | endmodule 6 | -------------------------------------------------------------------------------- /ALG Lab/Transform and Conquer/Heap Creation/buildheap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/ALG Lab/Transform and Conquer/Heap Creation/buildheap.pdf -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 7/.stringsqueue.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitcse/CSE-Labs/HEAD/DS Lab/DS Lab programs by week/Week 7/.stringsqueue.c.swp -------------------------------------------------------------------------------- /OS Lab/Shell Intro/multiple: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | dt=$(date) 3 | px=$(pwd) 4 | echo "Eggguting date: $dt" 5 | echo "Eggguting ls:" 6 | ls -alh 7 | echo "Eggguting pwd: $px" -------------------------------------------------------------------------------- /CD Lab/lex/inf.c: -------------------------------------------------------------------------------- 1 | int main(int argc, char const *argv[]) 2 | { 3 | int a; 4 | printf("ajdfoiwejdf\n"); 5 | scanf("%d", &a); 6 | printf("a = %d\n", a); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /CD Lab/lex/out.c: -------------------------------------------------------------------------------- 1 | int main(int argc, char const *argv[]) 2 | { 3 | int a; 4 | WRITE("ajdfoiwejdf\n"); 5 | READ("%d", &a); 6 | WRITE("a = %d\n", a); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog1b.v: -------------------------------------------------------------------------------- 1 | module prog1b (x, y, cin, s, c); 2 | input x, y, cin; 3 | output s, c; 4 | assign s = x^y^cin; 5 | assign c = x&y|y&cin|cin&x; 6 | endmodule 7 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/demo.v: -------------------------------------------------------------------------------- 1 | module demo(f, x1, x2, x3); 2 | input x1, x2, x3; 3 | output f; 4 | and(g, x1, x2); 5 | not(h, x2); 6 | and(i, h, x3); 7 | or(f, i, g); 8 | endmodule 9 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-2.sql: -------------------------------------------------------------------------------- 1 | create table Department2 ( 2 | deptNo number(8), 3 | deptName varchar(20) unique, 4 | location varchar(20), 5 | primary key (deptNo) 6 | ); -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/swapping/main.cl: -------------------------------------------------------------------------------- 1 | __kernel void swapping (__global int *A) { 2 | 3 | int i = get_global_id(0); 4 | 5 | int c = A[i]; 6 | A[i] = A[i+2]; 7 | A[i+2] = c; 8 | 9 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog2.v: -------------------------------------------------------------------------------- 1 | module prog2 (a, b, d, f); 2 | input a, b, d; 3 | output f; 4 | nand (d1, d); 5 | nand (b1, b); 6 | nand (ab, a, b1); 7 | nand (f, d1, ab); 8 | endmodule 9 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 3/temp.c: -------------------------------------------------------------------------------- 1 | main () { 2 | int x; 3 | char y; 4 | int p; 5 | x = p; 6 | x = p + x * p; 7 | if (x == p) { 8 | y = x; 9 | } else { 10 | y = p; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /CD Lab/README.MD: -------------------------------------------------------------------------------- 1 | # Compiler Design Lab 2 | 3 | Lab exercies on the design of a C compiler. 4 | 5 | ##### Check out [notclang](https://github.com/avikantz/notclang) for a more streamlined version. -------------------------------------------------------------------------------- /OOP Lab/Basics/EmptyTemplate.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class EmptyTemplate { 3 | public static void main(String []args) { 4 | Scanner sc = new Scanner (System.in); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/vector_add/main.cl: -------------------------------------------------------------------------------- 1 | __kernel void vector_add (__global int *A, __global int *B, __global int *C) { 2 | 3 | int i = get_global_id(0); 4 | 5 | C[i] = A[i] + B[i]; 6 | 7 | } -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-17.sql: -------------------------------------------------------------------------------- 1 | select empName, to_char(dob, 'YEAR') from Employee; 2 | select empName, to_char(dob, 'Year') from Employee; 3 | select empName, to_char(dob, 'year') from Employee; -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/string reverse/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void reverse (__global char *S, int len) { 2 | size_t i = get_global_id(0); 3 | char t = S[len - 1 - i]; 4 | S[len - 1 - i] = S[i]; 5 | S[i] = t; 6 | } 7 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog2b.v: -------------------------------------------------------------------------------- 1 | module prog2b(x1, x2, x3, f); 2 | input x1, x2, x3; 3 | output f; 4 | // assign f = (x1^x2)^x3; 5 | assign f = (x1|x2|x3)&(~x1|~x2|x3)&(~x1|x2|~x3)&(x1|~x2|~x3); 6 | endmodule 7 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog4.v: -------------------------------------------------------------------------------- 1 | module prog4 (x1, x2, x3, x4, f, g, h); 2 | input x1, x2, x3, x4; 3 | output f, g, h; 4 | assign g = ~x1|~x2; 5 | assign h = ~x3&~x4; 6 | assign f = (g&h)|(~g&~h); 7 | endmodule 8 | -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/dftp/files/numbers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (int argc, const char * argv []) { 4 | int i; 5 | for (i = 0; i < 10; ++i) { 6 | printf("%d ", i+1); 7 | } 8 | printf("\n"); 9 | } -------------------------------------------------------------------------------- /DBMS Lab/Triggers/02.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE TRIGGER Item_update 2 | BEFORE INSERT ON Item_Transaction FOR EACH ROW 3 | BEGIN 4 | UPDATE Item_Master SET balanceStock = balanceStock - :NEW.quantity; 5 | END; 6 | / -------------------------------------------------------------------------------- /OOP Lab/Input Output/SortedMerge/04.txt: -------------------------------------------------------------------------------- 1 | aaaaaa 2 | aaaaaa 3 | bbbbbb 4 | bbbbbb 5 | ddddd 6 | fffff 7 | hhhhhh 8 | rrrrr 9 | ufffff 10 | ufffff 11 | uuuuuu 12 | uuuuuu 13 | yyyyyy 14 | zzzzzz 15 | zzzzzz 16 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog1b.v: -------------------------------------------------------------------------------- 1 | module prog1b(x1, x2, x3, x4, f, g, h); 2 | input x1, x2, x3, x4; 3 | output f, g, h; 4 | assign g = (x1&x3)|(x2&x4); 5 | assign h = (x1|~x3)&(~x2|x4); 6 | assign f = g|h; 7 | endmodule 8 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog4.v: -------------------------------------------------------------------------------- 1 | module prog4(w, t, f); 2 | input [3:0] w; 3 | input [1:0] t; 4 | output f; 5 | reg f; 6 | always @(w or t) 7 | f = t[1]?(t[0]?w[3]:w[2]):(t[0]?w[1]:w[0]); 8 | endmodule 9 | 10 | 11 | -------------------------------------------------------------------------------- /CD Lab/lex/count_lines.l: -------------------------------------------------------------------------------- 1 | %{ 2 | int linecount = 0; 3 | %} 4 | %% 5 | \n linecount++; 6 | %% 7 | int main () { 8 | yylex(); 9 | printf("Lines = %d\n", linecount); 10 | return 0; 11 | } 12 | int yywrap() { 13 | return 1; 14 | } -------------------------------------------------------------------------------- /CN Lab/Concurrent Server/files/halfbp.txt: -------------------------------------------------------------------------------- 1 | You dare use my own spells against me, Potter? 2 | It was I who invented them — I, the Half-Blood Prince! 3 | And you'd turn them on me like your filthy father, would you? I don't think so...No! -------------------------------------------------------------------------------- /OOP Lab/Interfaces and Exception Handling/Stack/Stack.java: -------------------------------------------------------------------------------- 1 | // 2 | // Stack.java 3 | // 4 | // Created by Avikant Saini on 10/3/15 5 | // 6 | 7 | public interface Stack { 8 | void push (int item); 9 | int pop (); 10 | } 11 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog3.v: -------------------------------------------------------------------------------- 1 | module prog3(x1, x2, x3, x4, f1, f2); 2 | input x1, x2, x3, x4; 3 | output f1, f2; 4 | assign f1 = (x1&x3)|(x2&x3)|(x3&x4)|(x1&x2)|(x1&x4); 5 | assign f2 = (x1|x3)&(x1|x2|x4)&(x2|x3|x4); 6 | endmodule 7 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog1.v: -------------------------------------------------------------------------------- 1 | module prog1 (a, b, c, d, f); 2 | input a, b, c, d; 3 | output f; 4 | nor (b1, b); 5 | nor (d1, d); 6 | nor (a1, a); 7 | nor (k, b1, d); 8 | nor (l, a1, d1); 9 | nor (f, k, l); 10 | endmodule 11 | -------------------------------------------------------------------------------- /ALG Lab/Greedy Approach/Floyd/floyd.csv: -------------------------------------------------------------------------------- 1 | input size, step count 2 | 1, 1 3 | 2, 8 4 | 3, 27 5 | 4, 64 6 | 5, 125 7 | 6, 216 8 | 7, 343 9 | 8, 512 10 | 9, 729 11 | 10, 1000 12 | 11, 1331 13 | 12, 1728 14 | 13, 2197 15 | 14, 2744 16 | 15, 3375 -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab3/prog3.sh: -------------------------------------------------------------------------------- 1 | #!bin/bash 2 | echo Enter two non-negative integer values 3 | read a 4 | read b 5 | while [ $b -gt 0 ] 6 | do 7 | temp=$b 8 | b=$(( $a % $b )) 9 | a=$temp 10 | done 11 | echo gcd is $a 12 | -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/string repeat/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void multiply (__global char *S, int n, int len, __global char *RS) { 2 | size_t id = get_global_id(0); 3 | int i; 4 | for (i = id; i < len * n; i += len) { 5 | RS[i] = S[id]; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab3/prog1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # check if input number is odd or even 3 | 4 | echo Enter a number 5 | read n 6 | if [ `expr $n % 2` -eq 0 ] 7 | then 8 | echo number is even 9 | else 10 | echo number is odd 11 | fi 12 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 04/prog3.v: -------------------------------------------------------------------------------- 1 | module prog3(x1, x2, x3, x4, f, g, k); 2 | input x1, x2, x3, x4; 3 | output f, g, k; 4 | assign k = (~x1&~x3&~x4)|(~x2&x3&~x4)|(x1&~x2&~x3&x4); 5 | assign f = k|(~x1&x2&x3); 6 | assign g = k|(x1&x2&x4); 7 | endmodule 8 | -------------------------------------------------------------------------------- /ALG Lab/Greedy Approach/Warshall/warshall.csv: -------------------------------------------------------------------------------- 1 | input size, step count 2 | 1, 1 3 | 2, 8 4 | 3, 27 5 | 4, 64 6 | 5, 125 7 | 6, 216 8 | 7, 343 9 | 8, 512 10 | 9, 729 11 | 10, 1000 12 | 11, 1331 13 | 12, 1728 14 | 13, 2197 15 | 14, 2744 16 | 15, 3375 -------------------------------------------------------------------------------- /CD Lab/C like Parser 4/temp.c: -------------------------------------------------------------------------------- 1 | main () { 2 | int x; 3 | char y; 4 | int p; 5 | x = p; 6 | x = p + x * p; 7 | if (x == p) { 8 | y = x; 9 | } else { 10 | y = p; 11 | } 12 | for (x = p; x <= p; x = x + 2) { 13 | y = y * 2; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-5.sql: -------------------------------------------------------------------------------- 1 | insert into Department2 values ('1', 'Bogo', 'NY'); 2 | 3 | insert into Employee values ('010', 'Carter', 'M', '900000', null, '4'); 4 | insert into Employee values ('002', 'Hersh', 'N', '650000', 'Address 2', '6'); -------------------------------------------------------------------------------- /DBMS Lab/Functions and Procedures/01.sql: -------------------------------------------------------------------------------- 1 | -- PROCEDURE to say hi 2 | 3 | CREATE OR REPLACE PROCEDURE Hello IS 4 | BEGIN 5 | DBMS_OUTPUT.PUT_LINE('Not a good day to you!'); 6 | END; 7 | / 8 | 9 | DECLARE 10 | BEGIN 11 | Hello; 12 | END; 13 | / -------------------------------------------------------------------------------- /OS Lab/Shell Intro/subshell: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "subshell demo" 3 | echo "current directory = " 4 | pwd 5 | ( 6 | echo "inside subshell" 7 | cd /bin/ 8 | echo "subshell directory = " 9 | pwd 10 | ) 11 | echo "subshell finished" 12 | echo "current directory = " 13 | pwd -------------------------------------------------------------------------------- /OS Lab/System Calls/hellowait.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char const *argv[]) { 4 | char *hello = "Hello world!!"; 5 | int i; 6 | for (i = 0; i < 12; ++i) { 7 | printf("%c", hello[i]); 8 | wait(1); 9 | } 10 | printf("\n"); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /OOP Lab/Interfaces and Exception Handling/ByTwos/Series.java: -------------------------------------------------------------------------------- 1 | // 2 | // Series.java 3 | // 4 | // Created by Avikant Saini on 10/3/15 5 | // 6 | 7 | public interface Series { 8 | 9 | int getNext (); 10 | void reset (); 11 | void setStart (int strt); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/matrix transpose/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void transpose (__global int *A, int M, int N, __global int *B) { 2 | int i = get_global_id(0); 3 | int j = get_global_id(1); 4 | // printf("B[%d] = A[%d] = %d\n", j * N + i, i * M + j, A[i * M + j]); 5 | B[j + N * i] = A[i + M * j]; 6 | } 7 | -------------------------------------------------------------------------------- /DBMS Lab/Functions and Procedures/05.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION square (x number) 2 | RETURN number AS 3 | s number; 4 | BEGIN 5 | s := x * x; 6 | RETURN s; 7 | END; 8 | / 9 | 10 | DECLARE 11 | BEGIN 12 | DBMS_OUTPUT.PUT_LINE('16 ^ 2 = '||square(16)); 13 | END; 14 | / -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/matrix row power/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void operate (__global int *A, int M, int N) { 2 | int i = get_global_id(0); 3 | int j = get_global_id(1); 4 | int k; 5 | int x = A[i * M + j]; 6 | int p = x; 7 | for (k = 1; k <= i; ++k) { 8 | p *= x; 9 | } 10 | A[i * M + j] = p; 11 | } 12 | -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/Matrix Multiplication/matmult.csv: -------------------------------------------------------------------------------- 1 | Size, Time 2 | 2, 0.000049 3 | 3, 0.000137 4 | 4, 0.000328 5 | 5, 0.000593 6 | 6, 0.001017 7 | 7, 0.001488 8 | 8, 0.002050 9 | 9, 0.003057 10 | 10, 0.004208 11 | 11, 0.005503 12 | 12, 0.007554 13 | 13, 0.008796 14 | 14, 0.011273 15 | 15, 0.014429 16 | -------------------------------------------------------------------------------- /CD Lab/lex/compound.l: -------------------------------------------------------------------------------- 1 | %{ 2 | int simple_flag = 1; 3 | %} 4 | %% 5 | (and|or|if) simple_flag = 0; 6 | %% 7 | int main() { 8 | yylex(); 9 | if(simple_flag) 10 | printf("Simple!\n"); 11 | else 12 | printf("Compound!\n"); 13 | return 0; 14 | } 15 | int yywrap() { 16 | return 1; 17 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog1.v: -------------------------------------------------------------------------------- 1 | module prog1(x1, x2, x3, x4, f, g, h); 2 | input x1, x2, x3, x4; 3 | output f, g, h; 4 | and(a, x1, x3); 5 | and(b, x2, x4); 6 | not(e1, x3); 7 | not(e2, x2); 8 | or(c, x1, e1); 9 | or(d, e2, x4); 10 | or(g, a, b); 11 | and(h, c, d); 12 | or(f, g, h); 13 | endmodule 14 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 01/prog2.v: -------------------------------------------------------------------------------- 1 | module prog2(x1, x2, x3, f); 2 | input x1, x2, x3; 3 | output f; 4 | not(x11, x1); 5 | not(x21, x2); 6 | not(x31, x3); 7 | or(y1, x1, x2, x3); 8 | or(y2, x11, x21, x3); 9 | or(y3, x11, x2, x31); 10 | or(y4, x1, x21, x31); 11 | and(f, y1, y2, y3, y4); 12 | endmodule 13 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab4/prog1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | pid_t pid = fork(); 8 | if (pid == 0) 9 | printf("Child process created\n"); 10 | else 11 | printf("Parent process\n"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-1.sql: -------------------------------------------------------------------------------- 1 | create table Employee ( 2 | empNo number(8), 3 | empName varchar(20) not null, 4 | sex varchar(1) check (sex = 'M' or sex = 'F') not null, 5 | salary numeric(8,0) default (1000) not null, 6 | address varchar(40) not null, 7 | dno number(8), 8 | primary key (empNo) 9 | ); -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab3/prog4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # reverse a number using until 3 | 4 | echo Enter number to be reversed 5 | read n 6 | num=0 7 | until [ $n -eq 0 ] 8 | do 9 | dig=`expr $n % 10` 10 | n=`expr $n / 10` 11 | num=`expr $num \* 10 + $dig` 12 | done 13 | echo reverse of number is $num 14 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog3.v: -------------------------------------------------------------------------------- 1 | module prog3(w, t, f); 2 | input [3:0] w; 3 | input [1:0] t; 4 | output f; 5 | reg f; 6 | always @(w or t or f) 7 | if (t == 0) 8 | f = w[0]; 9 | else if (t == 1) 10 | f = w[1]; 11 | else if(t == 2) 12 | f = w[2]; 13 | else 14 | f = w[3]; 15 | endmodule 16 | 17 | -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/dftp/files/fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (int argc, const char * argv []) { 4 | int a = 0; 5 | int b = 1; 6 | int c; 7 | printf("%d %d ", a, b); 8 | do { 9 | c = a + b; 10 | printf("%d ", c); 11 | a = b; 12 | b = c; 13 | } while (c < 1000); 14 | printf("\n"); 15 | } -------------------------------------------------------------------------------- /OS Lab/Inter process communication/message queue/common.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define SIZE 128 9 | 10 | typedef struct message { 11 | long mtype; 12 | char c[SIZE]; 13 | } MESSAGE_t; -------------------------------------------------------------------------------- /OS Lab/Shell Intro/wontcompile.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char const *argv[]) { 4 | char *string = (char *)malloc(100 * sizeof(char)); 5 | printf("Enter something: "); 6 | scanf(" %s", string); 7 | if let nope = "nope" { 8 | printf("NOPE\n"); 9 | } 10 | return -666; 11 | } -------------------------------------------------------------------------------- /CN Lab/Concurrent Server/files/ib.txt: -------------------------------------------------------------------------------- 1 | Gentlemen, I have no intention of killing Hitler and killing Goebbels and killing Göring and killing Bormann, not to mention winning the war single-handedly for the Allies, only later to find myself standing before a Jewish tribunal. 2 | If you want to win the war, tonight, We have to make a deal. -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog1.v: -------------------------------------------------------------------------------- 1 | module prog1(w, t, f); 2 | input [7:0] w; 3 | input [2:0] t; 4 | output f; 5 | reg f; 6 | always @(w or t) 7 | case(t) 8 | 0 : f=w[0]; 9 | 1 : f=w[1]; 10 | 2 : f=w[2]; 11 | 3 : f=w[3]; 12 | 4 : f=w[4]; 13 | 5 : f=w[5]; 14 | 6 : f=w[6]; 15 | 7 : f=w[7]; 16 | endcase 17 | endmodule 18 | -------------------------------------------------------------------------------- /CD Lab/Another Parser/include/common.h: -------------------------------------------------------------------------------- 1 | // Commoon header file 2 | 3 | #ifndef IMPORT_STUFF 4 | #define IMPORT_STUFF 5 | #include 6 | #include 7 | #include 8 | #include 9 | #endif 10 | 11 | #include "util.h" 12 | 13 | 14 | #define BUFFER_SIZE 256 15 | #define NONE -1 16 | #define EOS '\0' -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/include/common.h: -------------------------------------------------------------------------------- 1 | // Commoon header file 2 | 3 | #ifndef IMPORT_STUFF 4 | #define IMPORT_STUFF 5 | #include 6 | #include 7 | #include 8 | #include 9 | #endif 10 | 11 | #include "util.h" 12 | 13 | 14 | #define BUFFER_SIZE 256 15 | #define NONE -1 16 | #define EOS '\0' -------------------------------------------------------------------------------- /CD Lab/C like Parser 2/include/common.h: -------------------------------------------------------------------------------- 1 | // Commoon header file 2 | 3 | #ifndef IMPORT_STUFF 4 | #define IMPORT_STUFF 5 | #include 6 | #include 7 | #include 8 | #include 9 | #endif 10 | 11 | #include "util.h" 12 | 13 | 14 | #define BUFFER_SIZE 256 15 | #define NONE -1 16 | #define EOS '\0' -------------------------------------------------------------------------------- /CD Lab/C like Parser 3/include/common.h: -------------------------------------------------------------------------------- 1 | // Commoon header file 2 | 3 | #ifndef IMPORT_STUFF 4 | #define IMPORT_STUFF 5 | #include 6 | #include 7 | #include 8 | #include 9 | #endif 10 | 11 | #include "util.h" 12 | 13 | 14 | #define BUFFER_SIZE 256 15 | #define NONE -1 16 | #define EOS '\0' -------------------------------------------------------------------------------- /CD Lab/C like Parser 4/include/common.h: -------------------------------------------------------------------------------- 1 | // Commoon header file 2 | 3 | #ifndef IMPORT_STUFF 4 | #define IMPORT_STUFF 5 | #include 6 | #include 7 | #include 8 | #include 9 | #endif 10 | 11 | #include "util.h" 12 | 13 | 14 | #define BUFFER_SIZE 256 15 | #define NONE -1 16 | #define EOS '\0' -------------------------------------------------------------------------------- /CD Lab/Simple parsers/include/common.h: -------------------------------------------------------------------------------- 1 | // Commoon header file 2 | 3 | #ifndef IMPORT_STUFF 4 | #define IMPORT_STUFF 5 | #include 6 | #include 7 | #include 8 | #include 9 | #endif 10 | 11 | #include "util.h" 12 | 13 | 14 | #define BUFFER_SIZE 256 15 | #define NONE -1 16 | #define EOS '\0' -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/octal/main.cl: -------------------------------------------------------------------------------- 1 | __kernel void octal_conv (__global int *A, __global int *B) { 2 | 3 | int i = get_global_id(0); 4 | 5 | int dec = A[i]; 6 | int oct = 0, r, p = 1; 7 | while (dec != 0) { 8 | r = dec % 8; 9 | oct = oct + p * r; 10 | dec /= 8; 11 | p *= 10; 12 | } 13 | B[i] = oct; 14 | 15 | } -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab4/prog4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | pid_t pid = fork(); 8 | if (pid == 0) 9 | printf("Process id of child process is %d\n", getpid()); 10 | printf("Parent process id is %d\n", getppid()); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/ones_comp/main.cl: -------------------------------------------------------------------------------- 1 | __kernel void octal_conv (__global int *A, __global int *B) { 2 | 3 | int i = get_global_id(0); 4 | 5 | int bin = A[i]; 6 | int ones = 0; 7 | int b; 8 | while (bin > 0) { 9 | b = bin % 10; 10 | ones = ones * 10 + (b == 0); 11 | bin /= 10; 12 | } 13 | B[i] = ones; 14 | 15 | } -------------------------------------------------------------------------------- /CD Lab/lex/vowel_consonants.l: -------------------------------------------------------------------------------- 1 | %{ 2 | int vowels = 0; 3 | int cons = 0; 4 | %} 5 | %% 6 | [aeiouAEIOU] { vowels++; } 7 | [a-zA-Z] { cons++; } 8 | %% 9 | int yywrap() { 10 | return 1; 11 | } 12 | int main() { 13 | printf("Enter the string: \n"); 14 | yylex(); 15 | printf("No of vowels = %d\nNo of consonants = %d\n", vowels, cons); 16 | } -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/matrix repeat/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void operate (__global int *A, int count, __global int *B) { 2 | int i = get_global_id(0); 3 | int j = get_global_id(1); 4 | int x = A[i * count + j]; 5 | int ind = i * count + j; 6 | int k; 7 | for (k = 0; k < count * count; ++k) { 8 | B[ind * count * count + k] = x; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 2/Add Numbers Using Pointers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int varOne, varTwo, sum; 6 | int *ptrOne=&varOne; 7 | int *ptrTwo=&varTwo; 8 | printf("Enter two numbers\n"); 9 | scanf("%d %d", &varOne, &varTwo); 10 | sum = *ptrOne + *ptrTwo; 11 | printf("Sum is %d\n", sum); 12 | } 13 | -------------------------------------------------------------------------------- /OS Lab/System Calls/fork.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char const *argv[]) { 6 | pid_t pid = fork(); 7 | if (pid == 0) { 8 | printf("Child process created: %d!\n", pid); 9 | sleep(2); 10 | } else { 11 | printf("Parent process here: %d.\n", pid); 12 | } 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab3/add1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo Enter number to be checked 4 | read n 5 | temp=$n 6 | num=0 7 | until [ $n -eq 0 ] 8 | do 9 | dig=`expr $n % 10` 10 | n=`expr $n / 10` 11 | num=`expr $num \* 10 + $dig` 12 | done 13 | if [ $temp -eq $num ] 14 | then 15 | echo Palindrome 16 | else 17 | echo Not palindrome 18 | fi 19 | -------------------------------------------------------------------------------- /CN Lab/Concurrent Server/files/deadpool.txt: -------------------------------------------------------------------------------- 1 | What—oh! Oh hello. I know, right? Whose balls did I have to fondle to get my very own movie? 2 | I can't tell you, but it does rhyme with "Pulverine." 3 | And let me tell you, [In an Australian accent] he's got a nice pair of smooth criminals down under. 4 | Anyway, I got places to be, a face to fix, and—oh! Bad guys to kill! -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab3/add3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo Enter number of fibonacci you want 4 | read n 5 | a=0 6 | b=1 7 | echo first $n fibonacci numbers are 8 | echo $a 9 | echo $b 10 | n=`expr $n - 2` 11 | while [ $n -gt 0 ] 12 | do 13 | temp=`expr $a + $b` 14 | echo $temp 15 | a=$b 16 | b=$temp 17 | n=`expr $n - 1` 18 | done 19 | -------------------------------------------------------------------------------- /OS Lab/Shell Control Statements/fibonacci: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo Enter number of fibonacci you want 4 | read n 5 | a=0 6 | b=1 7 | echo first $n fibonacci numbers are 8 | echo $a 9 | echo $b 10 | n=`expr $n - 2` 11 | while [ $n -gt 0 ] 12 | do 13 | c=`expr $a + $b` 14 | echo $c 15 | a=$b 16 | b=$temp 17 | n=`expr $n - 1` 18 | done 19 | -------------------------------------------------------------------------------- /OS Lab/Shell Control Statements/numbertest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function evenTest { 4 | nm2=$(($1%2)) 5 | if [[ $nm2 -eq 0 ]]; then 6 | echo "$1 is even."; 7 | else 8 | echo "$1 is odd."; 9 | fi 10 | } 11 | 12 | if [[ -z "$1" ]]; then 13 | echo "Enter a god damn number: "; 14 | read number; 15 | evenTest $number; 16 | else 17 | evenTest $1; 18 | fi -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/07.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | DECLARE 4 | 5 | i int; 6 | x int; 7 | f int; 8 | 9 | BEGIN 10 | 11 | DBMS_OUTPUT.PUT_LINE(''); 12 | 13 | x := &x; 14 | f := 1; 15 | 16 | for i in 2..x loop 17 | f := f * i; 18 | end loop; 19 | 20 | DBMS_OUTPUT.PUT_LINE('' || x || '! = ' || f); 21 | 22 | END; 23 | / -------------------------------------------------------------------------------- /SCLD Lab/Lab 08/prog2.v: -------------------------------------------------------------------------------- 1 | module prog2 (w, y, z); 2 | input [7:0] w; 3 | output [2:0] y; 4 | output z; 5 | reg [2:0] y; 6 | reg z; 7 | integer k; 8 | always @(w) 9 | begin 10 | y = 3'bx; 11 | z = 0; 12 | for (k = 0; k < 8; k = k + 1) 13 | if (w[k]) 14 | begin 15 | y = k; 16 | z = 1; 17 | end 18 | end 19 | endmodule 20 | -------------------------------------------------------------------------------- /ALG Lab/Other/Tower of Hanoi/toh.csv: -------------------------------------------------------------------------------- 1 | Pegs, Time 2 | 1, 0.00000 3 | 2, 0.00000 4 | 3, 0.00001 5 | 4, 0.00001 6 | 5, 0.00002 7 | 6, 0.00008 8 | 7, 0.00007 9 | 8, 0.00015 10 | 9, 0.00030 11 | 10, 0.00075 12 | 11, 0.00174 13 | 12, 0.00292 14 | 13, 0.00579 15 | 14, 0.00967 16 | 15, 0.02253 17 | 16, 0.03795 18 | 17, 0.07989 19 | 18, 0.16336 20 | 19, 0.31184 21 | 20, 0.64618 22 | -------------------------------------------------------------------------------- /CD Lab/Another Parser/include/lexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // lexer.h 3 | // 4 | // Lexical analyzer, generates symbol table 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * Takes a pre processed file as input, and extracts tokens. 16 | */ 17 | void emit_tokens (char *inname); -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/include/lexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // lexer.h 3 | // 4 | // Lexical analyzer, generates symbol table 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * Takes a pre processed file as input, and extracts tokens. 16 | */ 17 | void emit_tokens (char *inname); -------------------------------------------------------------------------------- /CD Lab/C like Parser 2/include/lexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // lexer.h 3 | // 4 | // Lexical analyzer, generates symbol table 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * Takes a pre processed file as input, and extracts tokens. 16 | */ 17 | void emit_tokens (char *inname); -------------------------------------------------------------------------------- /CD Lab/C like Parser 3/include/lexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // lexer.h 3 | // 4 | // Lexical analyzer, generates symbol table 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * Takes a pre processed file as input, and extracts tokens. 16 | */ 17 | void emit_tokens (char *inname); -------------------------------------------------------------------------------- /CD Lab/C like Parser 4/include/lexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // lexer.h 3 | // 4 | // Lexical analyzer, generates symbol table 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * Takes a pre processed file as input, and extracts tokens. 16 | */ 17 | void emit_tokens (char *inname); -------------------------------------------------------------------------------- /CD Lab/Simple parsers/include/lexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // lexer.h 3 | // 4 | // Lexical analyzer, generates symbol table 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * Takes a pre processed file as input, and extracts tokens. 16 | */ 17 | void emit_tokens (char *inname); -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/DIV168.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a dw ? 3 | b db ? 4 | c db ? 5 | data ends 6 | 7 | code segment 8 | assume ds:data, cs:code 9 | 10 | start: mov ax, data 11 | mov ds, ax 12 | 13 | mov ax, a 14 | mov bl, b 15 | div bl 16 | mov c, al 17 | mov c+1, ah 18 | 19 | mov ah, 4ch 20 | int 21h 21 | code ends 22 | end start 23 | -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/MUL1616.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a dw ? 3 | b dw ? 4 | c dw ? 5 | data ends 6 | 7 | code segment 8 | assume ds:data, cs:code 9 | 10 | start: mov ax,data 11 | mov ds,ax 12 | 13 | mov ax, a 14 | mov bx, b 15 | mul bx 16 | mov c, ax 17 | mov c+2, dx 18 | 19 | mov ah, 4ch 20 | int 21h 21 | code ends 22 | end start 23 | -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/MUL88.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a db ? 3 | b db ? 4 | c db ? 5 | data ends 6 | 7 | code segment 8 | assume ds:data, cs:code 9 | 10 | start: mov ax, data 11 | mov ds, ax 12 | 13 | mov al, a 14 | mov bl, b 15 | mul bl 16 | mov c, al 17 | mov c+1, ah 18 | 19 | mov ah, 4ch 20 | int 21h 21 | code ends 22 | end start 23 | -------------------------------------------------------------------------------- /OS Lab/Shell Intro/compiletest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Compiling $1..." 3 | if [ -z "$1" ]; then 4 | echo "Supply a god-damn file!" 5 | else 6 | gcc -o a.out $1 &> /dev/null 7 | # if [ $(gcc $1 -o a.out &> /dev/null) ]; then 8 | if [[ $? -eq 0 ]]; then 9 | echo "Compilation success! Egguting..." 10 | ./a.out 11 | else 12 | echo "Compilation failure!" 13 | fi 14 | fi -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog1.v: -------------------------------------------------------------------------------- 1 | module prog1(x1, y1, z1, l1, r1, x2, y2, z2, l2, r2, a, l3, r3); 2 | input x1, y1, z1, x2, y2, z2, a; 3 | output l1, r1, l2, r2, l3, r3; 4 | 5 | assign l1 = x1&(y1|z1); 6 | assign r1 = x1&y1 | x1&z1; 7 | 8 | assign l2 = x2|(y2&z2); 9 | assign r2 = (x2&y2)|(x2&z2); 10 | 11 | assign l3 = ~(~a); 12 | assign r3 = a; 13 | 14 | endmodule 15 | -------------------------------------------------------------------------------- /OOP Lab/Interfaces and Exception Handling/Employee/EmployeeTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // EmployeeTest.java 3 | // 4 | // Created by Avikant Saini on 10/3/15 5 | // 6 | 7 | public class EmployeeTest { 8 | 9 | public static void main (String [] args) { 10 | 11 | Employee employee = new Employee(); 12 | 13 | employee.input(); 14 | 15 | employee.display(); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog2b.v: -------------------------------------------------------------------------------- 1 | module prog2b (x, y, z, f1, f2); 2 | input x, y, z; 3 | output f1, f2; 4 | 5 | // f1 for "NAND ONLY" 6 | // f2 for "NOR ONLY" 7 | 8 | nand (y1, y, y); 9 | nand (z1, z, z); 10 | nand (xz1, x, z1); 11 | nand (f1, y1, xz1); 12 | 13 | nor (z2, z); 14 | nor (xy2, x, y); 15 | nor (yz2, y, z2); 16 | nor (f2, xy2, yz2); 17 | 18 | endmodule 19 | -------------------------------------------------------------------------------- /OS Lab/Semaphores and Named Pipes/prod cons fifo/common.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define FIFO_FILE "FIFO_FILE" 11 | 12 | #define BUFFER_SIZE PIPE_BUF // PIPE_BUF = 64KB 13 | #define PROD_SIZE 16777216 // 16KB 14 | -------------------------------------------------------------------------------- /OS Lab/Shell Control Statements/reverse: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function reverse { 4 | r=0; 5 | n=$1; 6 | until [[ $n -eq 0 ]]; do 7 | b=$(($n % 10)); 8 | r=$((10*$r + $b)); 9 | n=$(($n/10)); 10 | done 11 | echo "Reverse of $1 is $r"; 12 | } 13 | 14 | if [[ -z "$1" ]]; then 15 | printf "Enter the god damn number: "; 16 | read a; 17 | reverse $a; 18 | else 19 | reverse $1; 20 | fi -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab1/prog2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Enter n\n"); 6 | int n; 7 | scanf("%d", &n); 8 | int *a; 9 | printf("Enter numbers\n"); 10 | for (int i=0; i 2 | 3 | int main() 4 | { 5 | printf("Enter n\n"); 6 | int n; 7 | scanf("%d", &n); 8 | int *a; 9 | printf("Enter numbers\n"); 10 | for (int i=0; i 2 | #include 3 | #include 4 | #include 5 | 6 | int main() 7 | { 8 | int fd; 9 | fd = open("prog6out.txt", O_CREAT | O_RDWR | O_APPEND, 0666); 10 | if (write (fd, "Writing contents to file now so check it out\n", 45) != 45) 11 | printf("Error writing to file\n"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/#AddEx1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void main() 5 | { 6 | int arr[10000], n, freq[201]; 7 | printf("Enter array size "); 8 | scanf("%d", &n); 9 | for(int i=; i 2 | 3 | int main() 4 | { 5 | printf("Enter n\n"); 6 | int n; 7 | scanf("%d", &n); 8 | int *a; 9 | printf("Enter numbers\n"); 10 | for (int i=0; i 5 | 6 | void add(int *a, int *b, int *s) { 7 | *s = *a + *b; 8 | } 9 | 10 | int main(int argc, const char *argv[]) { 11 | int a, b, s; 12 | printf("Enter two numbers: "); 13 | scanf("%d%d", &a, &b); 14 | add(&a, &b, &s); 15 | printf("\n\t%d + %d = %d\n\n", a, b, s); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/DIV3216.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a0 dw ? 3 | a1 dw ? 4 | b dw ? 5 | c dw ? 6 | data ends 7 | 8 | code segment 9 | assume ds:data, cs:code 10 | 11 | start: mov ax, data 12 | mov ds, ax 13 | 14 | mov ax, a0 15 | mov dx, a1 16 | mov bx, b 17 | div bx 18 | mov c, ax 19 | mov c+2, dx 20 | 21 | mov ah, 4ch 22 | int 21h 23 | code ends 24 | end start 25 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/SumOfNumbers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int arr[100], i, n; 6 | int sum=0; 7 | printf("Enter array size\n"); 8 | scanf("%d", &n); 9 | printf("Enter array\n"); 10 | for (i=0; i 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("inputcoprime.csv", "w+"); 7 | int a = 3; 8 | int b = 1; 9 | int c; 10 | int i = 0; 11 | while ((++i) < 100) { 12 | fprintf(output, "%d, %d\n", b, a); 13 | c = a; 14 | a = 2 * a - b; 15 | b = c; 16 | } 17 | fclose(output); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 3/Decimal to Binary.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long dec2bin(int n) 4 | { 5 | if (n == 0) 6 | { 7 | return 0; 8 | } 9 | else 10 | { 11 | return (n % 2) + 10 * dec2bin(n/2); 12 | } 13 | } 14 | 15 | int main() 16 | { 17 | int n; 18 | printf("Enter decimal number you want converted\n"); 19 | scanf("%d", &n); 20 | printf("%li\n", dec2bin(n)); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/Week1Sub/SumOfNumbers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int arr[100], i, n; 6 | int sum=0; 7 | printf("Enter array size\n"); 8 | scanf("%d", &n); 9 | printf("Enter array\n"); 10 | for (i=0; i 2 | #include 3 | 4 | int main(int argc, char const *argv[]) 5 | { 6 | int a = 0; 7 | int b = 1; 8 | int c; 9 | 10 | FILE *output; 11 | output = fopen("inputfib.csv", "w+"); 12 | 13 | do { 14 | c = a + b; 15 | fprintf(output, "%d, %d\n", a, b); 16 | a = b; 17 | b = c; 18 | } while (c < 100000000); 19 | 20 | fclose(output); 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /OOP Lab/Interfaces and Exception Handling/ByTwos/ByTwos.java: -------------------------------------------------------------------------------- 1 | // 2 | // ByTwos.java 3 | // 4 | // Created by Avikant Saini on 10/3/15 5 | // 6 | 7 | public class ByTwos implements Series { 8 | 9 | private int k; 10 | 11 | public void setStart (int strt) { 12 | k = strt; 13 | } 14 | 15 | public int getNext () { 16 | k += 2; 17 | return k; 18 | } 19 | 20 | public void reset () { 21 | k = 0; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog2c.v: -------------------------------------------------------------------------------- 1 | module prog2c (x1, x2, x3, f1, f2); 2 | input x1, x2, x3; 3 | output f1, f2; 4 | 5 | // f1 for "NOR ONLY" 6 | // f2 for "NAND ONLY" 7 | 8 | nor (x11, x1); 9 | nor (x31, x3); 10 | nor (a1, x2, x1); 11 | nor (b1, x31, x11); 12 | nor (f1, a1, b1); 13 | 14 | nand (x12, x1); 15 | nand (x32, x3); 16 | nand (a2, x2, x12); 17 | nand (b2, x1, x32); 18 | nand (f2, a2, b2); 19 | 20 | endmodule 21 | -------------------------------------------------------------------------------- /OS Lab/System Calls/block.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char const *argv[]) { 8 | pid_t pid = fork(); 9 | int status; 10 | if (pid == 0) { 11 | printf("In child process...\n"); 12 | sleep(2); 13 | } else { 14 | while(wait(&status) != pid); 15 | printf("Parent process here...\n"); 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /CD Lab/C like Parser 4/out.txt: -------------------------------------------------------------------------------- 1 |
<(> <)> <{> 2 | <;> 3 | <;> 4 | <;> 5 | <=> <;> 6 | <=> <+> <*> <;> 7 | <(> <==> <)> <{> 8 | <=> <;> 9 | <}> <{> 10 | <=> <;> 11 | <}> 12 | <(> <=> <;> <<=> <;> <=> <+> <)> <{> 13 | <=> <*> <;> 14 | <}> 15 | <}> 16 | -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/captalize vowels/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void multiply (__global char *S, int len, __global char *RS) { 2 | size_t i = get_global_id(0); 3 | char x = S[i]; 4 | __constant char *vowels = "AEIOUaeiou"; 5 | int vowel = 0; 6 | for (int j = 0; j < 10; ++j) { 7 | vowel |= (x == vowels[j]); 8 | } 9 | if (vowel) { 10 | RS[i] = x & ~('a' - 'A'); 11 | } else { 12 | RS[i] = x + ((x >= 'A' && x <= 'Z') ? 32 : 0); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/03.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | DECLARE 4 | 5 | a int; 6 | b int; 7 | c int; 8 | 9 | x int := 500; 10 | 11 | BEGIN 12 | 13 | a := 0; 14 | b := 1; 15 | 16 | DBMS_OUTPUT.PUT_LINE(a || ' '); 17 | DBMS_OUTPUT.PUT_LINE(b || ' '); 18 | 19 | while ((a + b) <= x) loop 20 | c := a + b; 21 | a := b; 22 | b := c; 23 | DBMS_OUTPUT.PUT_LINE(c || ' '); 24 | end loop; 25 | 26 | END; 27 | / -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 3/Product of Natural Numbers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int product(int a, int b) 4 | { 5 | if (b == 1) 6 | { 7 | return a; 8 | } 9 | else 10 | { 11 | return a + product(a,b-1); 12 | } 13 | } 14 | 15 | int main() 16 | { 17 | int m, n; 18 | printf("Enter numbers you want to multiply\n"); 19 | scanf("%d %d", &m, &n); 20 | printf("Product of %d and %d is %d\n", m, n, product(m,n)); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/MUL3216.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a0 dw ? 3 | a1 dw ? 4 | b dw ? 5 | c dw ? 6 | data ends 7 | 8 | code segment 9 | assume ds:data, cs:code 10 | 11 | start: mov ax, data 12 | mov ds, ax 13 | 14 | mov ax, a0 15 | mov bx, b 16 | mul bx 17 | mov c, ax 18 | mov c+2, dx 19 | mov ax, a1 20 | mul bx 21 | add c+2, ax 22 | adc c+4, dx 23 | 24 | mov ah, 4ch 25 | int 21h 26 | code ends 27 | end start 28 | -------------------------------------------------------------------------------- /DBMS Lab/Triggers/05.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE VIEW Advisor_Student AS 2 | SELECT s_id, s.name AS s_name, s.dept_name AS s_dept, s.tot_cred, i_id, i.name AS i_name, i.dept_name AS i_dept, i.salary 3 | FROM ((Student s JOIN Advisor a ON s.id = a.s_id) JOIN Instructor i on i_id = i.id); 4 | 5 | CREATE OR REPLACE TRIGGER AdvUpdate 6 | INSTEAD OF DELETE ON Advisor_Student FOR EACH ROW 7 | BEGIN 8 | DELETE FROM Advisor WHERE s_id = :OLD.s_id; 9 | END; 10 | / -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 3/Factorial.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long fact (int n) 4 | { 5 | long fac = 1; 6 | if (n==1) 7 | { 8 | return 1; 9 | } 10 | else 11 | { 12 | return n*fact(n-1); 13 | } 14 | } 15 | 16 | int main() 17 | { 18 | int n; 19 | long fac; 20 | printf("Enter number you want factorial of (till 25)\n"); 21 | scanf("%d", &n); 22 | fac = fact(n); 23 | printf("Factorial of %d is %li\n", n, fac); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/Bubble Sort/numgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("numbers.txt", "w+"); 7 | int i, j; 8 | for (i = 1; i <= 1000; ++i) { 9 | fprintf(output, "%d ", i); 10 | for (j = 0; j < i; ++j) { 11 | int random = rand(); 12 | fprintf(output, "%d ", random); 13 | } 14 | fprintf(output, "\n"); 15 | } 16 | fclose(output); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /OS Lab/Shell Control Statements/palindrome: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function palin { 4 | z=$1 5 | r=0 6 | until [[ $z -eq 0 ]]; do 7 | b=`expr $z % 10` 8 | r=`expr $r \* 10 + $b` 9 | z=`expr $z / 10` 10 | done 11 | if [[ $r -eq $1 ]]; then 12 | echo "$1 is palindrome" 13 | else 14 | echo "$1 is not a palindrome" 15 | fi 16 | } 17 | 18 | if [[ -z "$1" ]]; then 19 | printf "Enter the goddamn number: " 20 | read n 21 | palin $n 22 | else 23 | palin $1 24 | fi -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog5.v: -------------------------------------------------------------------------------- 1 | module prog5(w, t, f); 2 | input [7:0] w; 3 | input [2:0] t; 4 | output f; 5 | reg f; 6 | always @(w or t) 7 | if(t == 0) 8 | f = w[0]; 9 | else if (t == 1) 10 | f = w[1]; 11 | else if (t == 2) 12 | f = w[2]; 13 | else if (t == 3) 14 | f = w[3]; 15 | else if (t == 4) 16 | f = w[4]; 17 | else if (t == 5) 18 | f = w[5]; 19 | else if (t == 6) 20 | f = w[6]; 21 | else 22 | f = w[7]; 23 | endmodule 24 | 25 | -------------------------------------------------------------------------------- /ALG Lab/Divide and Conquer/QuickSort/numgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("numbers.txt", "w+"); 7 | int i, j; 8 | for (i = 10; i <= 1000; i += 10) { 9 | fprintf(output, "%d ", i); 10 | for (j = 0; j < i; ++j) { 11 | int random = 1000 - j; 12 | fprintf(output, "%d ", random); 13 | } 14 | fprintf(output, "\n"); 15 | } 16 | fclose(output); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /ALG Lab/Transform and Conquer/HeapDelete/numgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("numbers.txt", "w+"); 7 | int i, j; 8 | for (i = 40; i <= 2000; i += 20) { 9 | fprintf(output, "%d ", i); 10 | for (j = 0; j < i; ++j) { 11 | int random = rand(); 12 | fprintf(output, "%d ", random); 13 | } 14 | fprintf(output, "\n"); 15 | } 16 | fclose(output); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /ALG Lab/Transform and Conquer/Heapsort/numgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("numbers.txt", "w+"); 7 | int i, j; 8 | for (i = 20; i <= 1000; i += 20) { 9 | fprintf(output, "%d ", i); 10 | for (j = 0; j < i; ++j) { 11 | int random = rand(); 12 | fprintf(output, "%d ", random); 13 | } 14 | fprintf(output, "\n"); 15 | } 16 | fclose(output); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog4.v: -------------------------------------------------------------------------------- 1 | module prog4 (a, b, s); 2 | input [1:0] a, b; 3 | output [3:0] s; 4 | wire [3:0] i; 5 | assign i[1] = a[0]&b[1]; 6 | assign i[2] = a[1]&b[0]; 7 | assign i[3] = a[1]&b[1]; 8 | assign s[0] = a[0]&b[0]; 9 | halfadd h1(i[1], i[2], s[1], i[0]); 10 | halfadd h2(i[3], i[0], s[2], s[3]); 11 | endmodule 12 | 13 | module halfadd (x, y, ss, cc); 14 | input x, y; 15 | output ss, cc; 16 | assign ss = x^y; 17 | assign cc = x&y; 18 | endmodule 19 | -------------------------------------------------------------------------------- /ALG Lab/Transform and Conquer/Heap Creation/numgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("numbers.txt", "w+"); 7 | int i, j; 8 | for (i = 100; i <= 10000; i += 10) { 9 | fprintf(output, "%d ", i); 10 | for (j = 0; j < i; ++j) { 11 | int random = rand(); 12 | fprintf(output, "%d ", random); 13 | } 14 | fprintf(output, "\n"); 15 | } 16 | fclose(output); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/String Matching/strgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, const char * argv []) { 5 | 6 | FILE *output; 7 | output = fopen("strings.txt", "w+"); 8 | 9 | int size = 10; 10 | int i, j; 11 | 12 | for (i = 0; i < 100; ++i, size += 15) { 13 | fprintf(output, "%d ", size); 14 | for (j = 0; j < size; ++j) { 15 | fprintf(output, "A"); 16 | } 17 | fprintf(output, "\n"); 18 | } 19 | 20 | fclose(output); 21 | 22 | } -------------------------------------------------------------------------------- /ALG Lab/Divide and Conquer/MergeSort/numgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("numbers.txt", "w+"); 7 | int i, j; 8 | for (i = 10; i <= 1000; i += 10) { 9 | fprintf(output, "%d ", i); 10 | for (j = 0; j < i; ++j) { 11 | int random = rand() % 1000 + 1000; 12 | fprintf(output, "%d ", random); 13 | } 14 | fprintf(output, "\n"); 15 | } 16 | fclose(output); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/README.MD: -------------------------------------------------------------------------------- 1 | # Simple C like parser 2 | 3 | Parser for the grammer: 4 | 5 | ``` 6 | program -> main () { declarations assign_stat } 7 | declarations -> data-type identifier_list; declarations | e 8 | data_type -> int | char 9 | identifier_list -> id | id , identifier_list 10 | assign_stat -> id = id; | id = num; 11 | ``` 12 | 13 | ### Usage 14 | 15 | - `make` 16 | - Input in any file, say `temp.c` 17 | - Run `./notclang temp.c` 18 | - Build and execute `rdparser.c` -------------------------------------------------------------------------------- /CD Lab/Another Parser/src/test.c: -------------------------------------------------------------------------------- 1 | // 2 | // test.c 3 | // 4 | // Testing the 'compiler' 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #include "preprocessor.h" 10 | #include "lexer.h" 11 | 12 | int main (int argc, const char * argv []) { 13 | 14 | char inname[128]; 15 | if (argc < 2) { 16 | printf("Enter file name: "); 17 | scanf(" %s", inname); 18 | } else { 19 | strcpy(inname, argv[1]); 20 | } 21 | 22 | emit_tokens(inname); 23 | 24 | return 0; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/src/test.c: -------------------------------------------------------------------------------- 1 | // 2 | // test.c 3 | // 4 | // Testing the 'compiler' 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #include "preprocessor.h" 10 | #include "lexer.h" 11 | 12 | int main (int argc, const char * argv []) { 13 | 14 | char inname[128]; 15 | if (argc < 2) { 16 | printf("Enter file name: "); 17 | scanf(" %s", inname); 18 | } else { 19 | strcpy(inname, argv[1]); 20 | } 21 | 22 | emit_tokens(inname); 23 | 24 | return 0; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 2/src/test.c: -------------------------------------------------------------------------------- 1 | // 2 | // test.c 3 | // 4 | // Testing the 'compiler' 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #include "preprocessor.h" 10 | #include "lexer.h" 11 | 12 | int main (int argc, const char * argv []) { 13 | 14 | char inname[128]; 15 | if (argc < 2) { 16 | printf("Enter file name: "); 17 | scanf(" %s", inname); 18 | } else { 19 | strcpy(inname, argv[1]); 20 | } 21 | 22 | emit_tokens(inname); 23 | 24 | return 0; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 3/src/test.c: -------------------------------------------------------------------------------- 1 | // 2 | // test.c 3 | // 4 | // Testing the 'compiler' 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #include "preprocessor.h" 10 | #include "lexer.h" 11 | 12 | int main (int argc, const char * argv []) { 13 | 14 | char inname[128]; 15 | if (argc < 2) { 16 | printf("Enter file name: "); 17 | scanf(" %s", inname); 18 | } else { 19 | strcpy(inname, argv[1]); 20 | } 21 | 22 | emit_tokens(inname); 23 | 24 | return 0; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 4/src/test.c: -------------------------------------------------------------------------------- 1 | // 2 | // test.c 3 | // 4 | // Testing the 'compiler' 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #include "preprocessor.h" 10 | #include "lexer.h" 11 | 12 | int main (int argc, const char * argv []) { 13 | 14 | char inname[128]; 15 | if (argc < 2) { 16 | printf("Enter file name: "); 17 | scanf(" %s", inname); 18 | } else { 19 | strcpy(inname, argv[1]); 20 | } 21 | 22 | emit_tokens(inname); 23 | 24 | return 0; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /MP Lab/Strings/LEN.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | stg db "DEADPOOL$" 3 | len db ? 4 | data ends 5 | 6 | code segment 7 | assume ds: data, cs: code, es: data 8 | start: mov ax, data; 9 | mov ds, ax; 10 | 11 | lea di, stg; 12 | mov al, 24h; 13 | mov bl, 00h; 14 | 15 | do: 16 | inc bl; 17 | scasb; 18 | jnz do; 19 | jmp done; 20 | 21 | done: 22 | dec bl; 23 | mov len, bl; 24 | 25 | mov ah, 4ch 26 | int 21h 27 | 28 | code ends 29 | end start -------------------------------------------------------------------------------- /OOP Lab/Inheritance and Packages/Building/School.java: -------------------------------------------------------------------------------- 1 | package com.course.buildings; 2 | 3 | import java.util.*; 4 | 5 | public class School extends Building { 6 | 7 | int nClass; 8 | String grade; 9 | 10 | void setClass (int nClass) { 11 | this.nClass = nClass; 12 | } 13 | 14 | void setGrade (String grade) { 15 | this.grade = new String(grade); 16 | } 17 | 18 | int getnClass () { 19 | return nClass; 20 | } 21 | 22 | String getGrade () { 23 | return grade; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /OOP Lab/Inheritance and Packages/Building/Building.java: -------------------------------------------------------------------------------- 1 | package com.course.buildings; 2 | 3 | import java.util.*; 4 | 5 | public class Building { 6 | 7 | float sqft; 8 | int stories; 9 | 10 | public void setFeet (float sqft) { 11 | this.sqft = sqft; 12 | } 13 | 14 | public void setStories(int stories) { 15 | this.stories = stories; 16 | } 17 | 18 | public int getStories() { 19 | return stories; 20 | } 21 | 22 | public float getFeet() { 23 | return sqft; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/Partition/partgen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (int argc, const char * argv []) { 5 | FILE *output; 6 | output = fopen("numbers.txt", "w+"); 7 | int size = 4; 8 | int i, j; 9 | for (i = 0; i < 20; ++i, size += 2) { 10 | fprintf(output, "%d ", size); 11 | int r = rand() % 1000; 12 | int inc = rand() % 20; 13 | for (j = 0; j < size; ++j, r += inc) { 14 | fprintf(output, "%d ", r); 15 | } 16 | fprintf(output, "\n"); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /OOP Lab/Inheritance and Packages/Building/House.java: -------------------------------------------------------------------------------- 1 | package com.course.buildings; 2 | 3 | import java.util.*; 4 | 5 | public class House extends Building { 6 | 7 | int nBeds; 8 | int nBaths; 9 | 10 | public void setBed (int nBeds) { 11 | this.nBeds = nBeds; 12 | } 13 | 14 | public void setBath (int nBaths) { 15 | this.nBaths = nBaths; 16 | } 17 | 18 | public int getBed () { 19 | return nBeds; 20 | } 21 | 22 | public int getBath () { 23 | return nBaths; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /DBMS Lab/PL Cursors And Exceptions/05.sql: -------------------------------------------------------------------------------- 1 | set serveroutput on; 2 | 3 | DECLARE 4 | CURSOR curse is SELECT * FROM student ORDER BY tot_cred; 5 | studrow student%rowtype; 6 | 7 | BEGIN 8 | DBMS_OUTPUT.PUT_LINE('name \t|\t ID \t|\t credits'); 9 | 10 | OPEN curse; 11 | LOOP 12 | FETCH curse INTO studrow; 13 | DBMS_OUTPUT.PUT_LINE(studrow.name || ' | ' || studrow.ID || ' | ' || studrow.tot_cred); 14 | EXIT WHEN curse%ROWCOUNT > 9; 15 | END LOOP; 16 | 17 | CLOSE curse; 18 | END; 19 | / -------------------------------------------------------------------------------- /OOP Lab/Basics/Largest.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Largest { 3 | public static void main(String []args) { 4 | Scanner sc = new Scanner (System.in); 5 | System.out.println("Enter three numbers: "); 6 | int a = sc.nextInt(); 7 | int b = sc.nextInt(); 8 | int c = sc.nextInt(); 9 | System.out.println("Largest of "+a+", "+b+", and "+c+" is "+largest(a, b, c)+"."); 10 | } 11 | static int largest(int a, int b, int c) { 12 | return (a>b)?((a>c)?a:c):((b>c)?b:c); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 06/prog2.v: -------------------------------------------------------------------------------- 1 | module prog2(w, t, f); 2 | input [15:0]w; 3 | input [3:0]t; 4 | output f; 5 | wire [3:0]m; 6 | mux41 m0(w[15:12], t[1:0], m[3]); 7 | mux41 m1(w[11:8], t[1:0], m[2]); 8 | mux41 m2(w[7:4], t[1:0], m[1]); 9 | mux41 m3(w[3:0], t[1:0], m[0]); 10 | mux41 m4(m[3:0], t[3:2], f); 11 | endmodule 12 | 13 | module mux41(w, t, f); 14 | input [3:0]w; 15 | input [1:0]t; 16 | output f; 17 | reg f; 18 | always @(w or t) 19 | f=t[1]?(t[0]?w[3]:w[2]):(t[0]?w[1]:w[0]); 20 | endmodule 21 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 3/Fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long fibo (int n) 4 | { 5 | if (n == 0) 6 | { 7 | return 0; 8 | } 9 | if (n == 1) 10 | { 11 | return 1; 12 | } 13 | else 14 | { 15 | return (fibo(n-1) + fibo(n-2)); 16 | } 17 | } 18 | 19 | int main() 20 | { 21 | int n; 22 | printf("Enter number of Fibonacci sequence terms you want\n"); 23 | scanf("%d", &n); 24 | int i; 25 | for (i=0; i 2 | 3 | int gcd(int x, int y) 4 | { 5 | while (x != y) 6 | { 7 | if (x > y) 8 | { 9 | return gcd(x-y, y); 10 | } 11 | else 12 | { 13 | return gcd(x, y-x); 14 | } 15 | } 16 | return x; 17 | } 18 | 19 | int main() 20 | { 21 | int a, b, result; 22 | printf("Enter two numbers you want gcd of\n"); 23 | scanf("%d %d", &a, &b); 24 | result = gcd(a,b); 25 | printf("GCD of %d and %d is %d\n", a, b, result); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/01.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | DECLARE 4 | 5 | a float := 3; 6 | b float := 5; 7 | c float := -1; 8 | 9 | d float; 10 | 11 | r1 float; 12 | r2 float; 13 | 14 | BEGIN 15 | 16 | d := b * b - 4 * a * c; 17 | 18 | if (d >= 0) then 19 | r1 := (-b + sqrt(d))/(2 * a); 20 | r2 := (-b - sqrt(d))/(2 * a); 21 | DBMS_OUTPUT.PUT_LINE('Roots: ' || r1 || ', ' || r2); 22 | else 23 | DBMS_OUTPUT.PUT_LINE('Imaginary Roots!'); 24 | end if; 25 | 26 | END; 27 | / -------------------------------------------------------------------------------- /OOP Lab/Basics/SumDigits.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class SumDigits { 3 | static int findSum(int n) { 4 | if (n == 0) 5 | return 0; 6 | return (int)(n%10) + findSum(n/10); 7 | } 8 | public static void main(String []args) { 9 | Scanner sc = new Scanner (System.in); 10 | System.out.print("\nThis program will find the sum of digits of a number.\n\n\tEnter a number: "); 11 | int n = sc.nextInt(); 12 | System.out.println("\n\tThe sum of digits of "+n+" is = "+findSum(n)+".\n"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 02/prog2a.v: -------------------------------------------------------------------------------- 1 | module prog2a(a, b, c, y1, y2); 2 | input a, b, c; 3 | output y1, y2; 4 | not (a1, a); 5 | not (b1, b); 6 | not (c1, c); 7 | and (z1, a, b, c); 8 | and (z2, a, b, c1); 9 | and (z3, a, b1, c); 10 | and (z4, a1, b, c); 11 | or (y1, z1, z2, z3, z4); 12 | 13 | nand (a2, a, a); 14 | nand (b2, b, b); 15 | nand (c2, c, c); 16 | nand (n1, a, b, c); 17 | nand (n2, a, b, c2); 18 | nand (n3, a, b2, c); 19 | nand (n4, a2, b, c); 20 | nand (y2, n1, n2, n3, n4); 21 | 22 | endmodule 23 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog2_2.v: -------------------------------------------------------------------------------- 1 | module prog2_2 (i, o); 2 | input [2:0] i; // A, B, C 3 | output o; 4 | wire [3:0] w; 5 | assign w[0] = ~i[2], w[1] = 0, w[2] = 1, w[3] = ~i[2]; 6 | mux4_1 m1 (w, i[1:0], o); 7 | endmodule 8 | 9 | module mux4_1 (w, t, f); 10 | input [3:0] w; 11 | input [1:0] t; 12 | output f; 13 | reg f; 14 | always @(w or t) 15 | if(t == 0) 16 | f = w[0]; 17 | else if (t == 1) 18 | f = w[1]; 19 | else if (t == 2) 20 | f = w[2]; 21 | else 22 | f = w[3]; 23 | endmodule 24 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/LinearSearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int arr[100], n, ele, i, pos; 6 | printf("Enter array size "); 7 | scanf("%d", &n); 8 | printf("Enter array "); 9 | for (i=0; i 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char const *argv[]) { 8 | char *str = (char *)malloc(65536 * sizeof(char)); 9 | printf("Enter stuff to write: \n"); 10 | fgets(str, 65536, stdin); 11 | int len = strlen(str); 12 | int fd = open("file.txt", O_CREAT | O_RDWR | O_APPEND, 0666); 13 | if (write (fd, str, len) != len) 14 | printf("Error writing to file\n"); 15 | close(fd); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/matrix multiply/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void multiply (__global int *A, __global int *B, int n, int m, __global int *C) { 2 | size_t r = get_global_id(0); 3 | size_t c = get_global_id(1); 4 | // printf("(r, c) = (%d, %d)\n", r, c); 5 | int sum = 0, i; 6 | for (i = 0; i < n; ++i) { 7 | // printf("sum += (A[%d] = %d) * (B[%d] = %d)\n", r * n + i, A[r * n + i], m * i + c, B[m * i + c]); 8 | sum += (A[r * n + i] * B[m * i + c]); 9 | } 10 | // printf("C[%d] = %d\n", r * n + c, sum); 11 | C[r * m + c] = sum; 12 | } 13 | -------------------------------------------------------------------------------- /CD Lab/Another Parser/include/preprocessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // preprocessor.h 3 | // 4 | // Discard preprocessor directives and comments from the file 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * remove_directives (char *) 16 | * input: 17 | * output: file named "pr_" with preprocessor directives and comments removed. 18 | * return: file name "pr_" 19 | */ 20 | char *remove_directives (char *); 21 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/include/preprocessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // preprocessor.h 3 | // 4 | // Discard preprocessor directives and comments from the file 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * remove_directives (char *) 16 | * input: 17 | * output: file named "pr_" with preprocessor directives and comments removed. 18 | * return: file name "pr_" 19 | */ 20 | char *remove_directives (char *); 21 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 2/include/preprocessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // preprocessor.h 3 | // 4 | // Discard preprocessor directives and comments from the file 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * remove_directives (char *) 16 | * input: 17 | * output: file named "pr_" with preprocessor directives and comments removed. 18 | * return: file name "pr_" 19 | */ 20 | char *remove_directives (char *); 21 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 3/include/preprocessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // preprocessor.h 3 | // 4 | // Discard preprocessor directives and comments from the file 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * remove_directives (char *) 16 | * input: 17 | * output: file named "pr_" with preprocessor directives and comments removed. 18 | * return: file name "pr_" 19 | */ 20 | char *remove_directives (char *); 21 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 4/include/preprocessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // preprocessor.h 3 | // 4 | // Discard preprocessor directives and comments from the file 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * remove_directives (char *) 16 | * input: 17 | * output: file named "pr_" with preprocessor directives and comments removed. 18 | * return: file name "pr_" 19 | */ 20 | char *remove_directives (char *); 21 | -------------------------------------------------------------------------------- /CD Lab/Simple parsers/include/preprocessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // preprocessor.h 3 | // 4 | // Discard preprocessor directives and comments from the file 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #ifndef COMMON_H 10 | #define COMMON_H 11 | #include "common.h" 12 | #endif 13 | 14 | /** 15 | * remove_directives (char *) 16 | * input: 17 | * output: file named "pr_" with preprocessor directives and comments removed. 18 | * return: file name "pr_" 19 | */ 20 | char *remove_directives (char *); 21 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/Week1Sub/LinearSearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int arr[100], n, ele, i, pos; 6 | printf("Enter array size "); 7 | scanf("%d", &n); 8 | printf("Enter array "); 9 | for (i=0; i 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char const *argv[]) { 8 | pid_t pid = fork(); 9 | int status; 10 | if (pid == 0) { 11 | printf("In child process, exegguting hellowait.c\n"); 12 | system("gcc hellowait.c -o hellowait.o"); 13 | system("./hellowait.o"); 14 | sleep(2); 15 | } else { 16 | while(wait(&status) != pid); 17 | printf("Parent process here...\n"); 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /CD Lab/Simple parsers/src/test.c: -------------------------------------------------------------------------------- 1 | // 2 | // test.c 3 | // 4 | // Testing the 'compiler' 5 | // 6 | // Created by @avikantz on 01/26/17 7 | // 8 | 9 | #include "preprocessor.h" 10 | #include "lexer.h" 11 | 12 | int main (int argc, const char * argv []) { 13 | 14 | char inname[128]; 15 | if (argc < 2) { 16 | printf("Enter file name: "); 17 | scanf(" %s", inname); 18 | } else { 19 | strcpy(inname, argv[1]); 20 | } 21 | 22 | char *pr_name = remove_directives(inname); 23 | emit_tokens(pr_name); 24 | 25 | return 0; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /MP Lab/Random Assembly/asciimult.asm: -------------------------------------------------------------------------------- 1 | data segment 2 | a db 39h 3 | b db 37h 4 | c db ?, ? 5 | data ends 6 | 7 | code segment 8 | start: 9 | assume cs: code, ds: data 10 | mov ax, data 11 | mov ds, ax 12 | 13 | mov bl, a 14 | sub bl, 30h 15 | mov al, bl 16 | 17 | mov cl, b 18 | sub cl, 30h 19 | mul cl 20 | 21 | aam 22 | 23 | mov c, al 24 | mov c+1, ah 25 | 26 | mov ah, 4ch 27 | int 21h 28 | 29 | code ends 30 | end start -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog2.v: -------------------------------------------------------------------------------- 1 | module prog2 (x, y, s, cout, cin); 2 | input [3:0] x, y; 3 | input cin; 4 | output [3:0] s; 5 | output cout; 6 | wire [3:1] c; 7 | fulladd stage0 (x[0], y[0], cin, s[0], c[1]); 8 | fulladd stage1 (x[1], y[1], c[1], s[1], c[2]); 9 | fulladd stage2 (x[2], y[2], c[2], s[2], c[3]); 10 | fulladd stage3 (x[3], y[3], c[3], s[3], cout); 11 | endmodule 12 | 13 | module fulladd (x, y, cin, s, c); 14 | input x, y, cin; 15 | output s, c; 16 | assign s = x^y^cin; 17 | assign c = x&y|y&cin|cin&x; 18 | endmodule 19 | -------------------------------------------------------------------------------- /DS Lab/Basic Programs - Recursive/Product.c: -------------------------------------------------------------------------------- 1 | // Product.c 2 | // Created by @avikantz on 08/11/15 3 | 4 | #include 5 | 6 | long mult (int a, int b) { 7 | if (b == 1) 8 | return a; 9 | return a + mult(a, b-1); 10 | } 11 | 12 | int main (int argc, const char *argv []) { 13 | int a, b; 14 | printf("This program will calculate the product of 2 numbers.\n\n\tEnter number 1: "); 15 | scanf("%d", &a); 16 | printf("\tEnter number 2: "); 17 | scanf("%d", &b); 18 | printf("\n\t%d x %d = %ld.\n\n", a, b, mult(a, b)); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 3/Sum of List.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int summer (int a[], int n) 4 | { 5 | int sum = a[n-1]; 6 | if (n == 1) 7 | { 8 | return a[n-1]; 9 | } 10 | else 11 | { 12 | return sum + summer (a, n-1); 13 | } 14 | } 15 | 16 | int main() 17 | { 18 | int a[100], n; 19 | printf("Enter array size\n"); 20 | scanf("%d", &n); 21 | printf("Enter array\n"); 22 | int i; 23 | for (i=0; i 2 | #include 3 | 4 | int main(int argc, char const *argv[]) { 5 | FILE *output; 6 | output = fopen("trees.txt", "w+"); 7 | int i, j; 8 | for (i = 2; i <= 100; i += 2) { 9 | fprintf(output, "56 "); 10 | for (j = 0; j < i-2; ++j) { 11 | int rd; 12 | if (j % 2 == 0) 13 | rd = rand() % 50 + 40; 14 | else 15 | rd = rand() % 50 + 10; 16 | fprintf(output, "%d ", rd); 17 | } 18 | fprintf(output, "-99\n"); 19 | } 20 | fclose(output); 21 | return 0; 22 | } -------------------------------------------------------------------------------- /CD Lab/lex/replace.l: -------------------------------------------------------------------------------- 1 | %{ 2 | int pfc=0, sfc=0; 3 | %} 4 | %% 5 | "printf" { fprintf(yyout, "WRITE"); pfc++; } 6 | "scanf" { fprintf(yyout, "READ"); sfc++; } 7 | %% 8 | 9 | int main (int argc, char *argv[]) { 10 | if (argc != 3) { 11 | printf("Usage: ./a.out infile outfile\n"); 12 | exit(0); 13 | } 14 | yyin = fopen(argv[1], "r"); 15 | yyout = fopen(argv[2], "w"); 16 | yylex(); 17 | printf("\nThe number of printf lines = %d\n", pfc); 18 | printf("\nThe number of scanf lines = %d\n", sfc); 19 | } 20 | 21 | int yywrap() { 22 | return 1; 23 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 05/prog3.v: -------------------------------------------------------------------------------- 1 | module prog3 (s, cout, x, y, m); 2 | input [3:0] x, y; 3 | input m; 4 | output [3:0] s; 5 | output cout; 6 | wire [3:0] w; 7 | wire [3:1] c; 8 | assign w = y^m; 9 | fulladd f1(x[0], w[0], m, s[0], c[1]); 10 | fulladd f2(x[1], w[1], c[1], s[1], c[2]); 11 | fulladd f3(x[2], w[2], c[2], s[2], c[3]); 12 | fulladd f4(x[3], w[3], c[3], s[3], cout); 13 | endmodule 14 | 15 | module fulladd (j, k, l, ss, cc); 16 | input j, k, l; 17 | output ss, cc; 18 | assign ss = j^k^l; 19 | assign cc = j&k|k&l|l&j; 20 | endmodule 21 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 08/prog3.v: -------------------------------------------------------------------------------- 1 | module prog3 (w, y, z); 2 | input [7:0] w; 3 | output [2:0] y; 4 | output z; 5 | reg [2:0] y; 6 | reg z; 7 | always @(w) 8 | begin 9 | z = 1; 10 | casex(w) 11 | 8'b1xxxxxxx: y = 7; 12 | 8'b01xxxxxx: y = 6; 13 | 8'b001xxxxx: y = 5; 14 | 8'b0001xxxx: y = 4; 15 | 8'b00001xxx: y = 3; 16 | 8'b000001xx: y = 2; 17 | 8'b0000001x: y = 1; 18 | 8'b00000001: y = 0; 19 | default: 20 | begin 21 | z = 0; 22 | y = 3'bx; 23 | end 24 | endcase 25 | end 26 | endmodule 27 | -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/UNPCK.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | bcd db ?, ? 3 | asc dw ?, ? 4 | n db 02 5 | data ends 6 | 7 | code segment 8 | assume ds:data, cs:code 9 | 10 | start: mov ax, data 11 | mov ds, ax 12 | 13 | mov cl, 04h 14 | 15 | lea si, bcd 16 | lea di, asc 17 | 18 | up: 19 | mov ah, 00h 20 | mov al, [si] 21 | rol ax, cl; 22 | shr al, cl; 23 | add ax, 3030h; 24 | mov [di], ax; 25 | inc si 26 | add di, 2h 27 | dec n 28 | jnz up 29 | 30 | mov ah, 4ch 31 | int 21h 32 | code ends 33 | end start 34 | -------------------------------------------------------------------------------- /OOP Lab/Generics/Tree/Tree/TNode.java: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // 4 | // 5 | // 6 | // 7 | // 8 | 9 | package Tree; 10 | 11 | public class TNode { 12 | 13 | public T data; 14 | 15 | public TNode left; 16 | public TNode right; 17 | 18 | public TNode () { 19 | this.data = null; 20 | this.left = null; 21 | this.right = null; 22 | } 23 | 24 | public TNode (T data) { 25 | this.data = data; 26 | this.left = null; 27 | this.right = null; 28 | } 29 | 30 | @Override 31 | public String toString () { 32 | return "" + this.data + ""; 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab4/prog2-3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | pid_t pid = fork(); 10 | int status; 11 | *argv = "./prog4"; 12 | if (pid == 0) 13 | { 14 | printf("Attempting to run exec file of prog4\n"); 15 | if (execvp(*argv, argv) < 0) 16 | exit(1); 17 | exit(1); 18 | } 19 | else 20 | while(wait(&status) != pid); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab7/prog2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main() 8 | { 9 | int fd[2]; 10 | pipe(fd); 11 | if(fork()) 12 | { 13 | dup2(fd[0], 0); 14 | close(fd[0]); 15 | close(fd[1]); 16 | execlp("wc", "wc", "-l", NULL); 17 | } 18 | else 19 | { 20 | dup2(fd[1], 1); 21 | close(fd[0]); 22 | close(fd[1]); 23 | execlp("who", "who", "-l", NULL); 24 | } 25 | exit(EXIT_FAILURE); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /CN Lab/UDP Client Server/chat/common.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | typedef enum { NO, YES } BOOL; 16 | 17 | typedef struct sockaddr_in sockaddr_in_t; 18 | 19 | typedef struct sockaddr sockaddr_t, *sockaddr_p_t; 20 | 21 | typedef char* string; 22 | 23 | #define BUFLEN 2048 24 | 25 | #define SERVER "127.0.0.1" 26 | 27 | #define PORT 7871 -------------------------------------------------------------------------------- /OS Lab/Inter process communication/message queue/client_message_queue.c: -------------------------------------------------------------------------------- 1 | 2 | #include "common.h" 3 | 4 | int main (int argc, char const * argv[] ) { 5 | 6 | int qt; 7 | MESSAGE_t message; 8 | 9 | if((qt = msgget(1271, 0)) < 0) { 10 | perror("Error in msgget()"); 11 | } 12 | 13 | printf("Enter the message: "); 14 | fgets(message.c, SIZE, stdin); 15 | message.mtype = 1; 16 | 17 | if(msgsnd(qt, &message, sizeof(MESSAGE_t), 0) < 0) { 18 | perror("Error in msgsnd()"); 19 | } 20 | 21 | printf("Successfully sent.\n"); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /MP Lab/Loope/DEUSRT.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | arr db 01h, 07h, 05h, 06h, 03h, 02h 3 | pos dw 03h 4 | siz dw 06h 5 | data ends 6 | 7 | code segment 8 | assume cs:code, ds:data 9 | start: mov ax, data 10 | mov ds, ax 11 | 12 | lea si, arr 13 | mov cx, siz; 14 | sub cx, pos; 15 | add si, cx 16 | 17 | dloop: 18 | mov al, [si + 1] 19 | xchg [si], al 20 | inc si 21 | dec cx 22 | jnz dloop 23 | and al, 00h 24 | mov [si], al 25 | 26 | mov ah, 4ch 27 | int 21h 28 | code ends 29 | end start -------------------------------------------------------------------------------- /OS Lab/System Calls/wait.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char const *argv[]) { 7 | int x = 1; 8 | int i; 9 | for (i = 0; i < 21; ++i) { 10 | pid_t pid = fork(); 11 | if (pid == 0) { 12 | x = 0; 13 | printf("\n[i = %d, x = %d] Child [%d] Parent [%d]\n", i, x, getpid(), getppid()); 14 | // sleep(1); 15 | exit(i); 16 | } else { 17 | wait(&x); 18 | printf("Parent [%d] [x = %d, return = %d]\n", getpid(), x, x/256); 19 | } 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /SCLD Lab/Lab 08/prog1.v: -------------------------------------------------------------------------------- 1 | module prog1 (w, y, en); 2 | input [2:0] w; 3 | input en; 4 | output [7:0] y; 5 | reg [7:0] y; 6 | always @(w or en) 7 | begin 8 | if(en == 0) 9 | y = 8'b11111111; 10 | else 11 | case({en, w}) 12 | 15: y = 8'b11111110; 13 | 14: y = 8'b11111101; 14 | 13: y = 8'b11111011; 15 | 12: y = 8'b11110111; 16 | 11: y = 8'b11101111; 17 | 10: y = 8'b11011111; 18 | 9: y = 8'b10111111; 19 | 8: y = 8'b01111111; 20 | default: y = 8'b11111111; 21 | endcase 22 | end 23 | endmodule 24 | -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/04.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | DECLARE 4 | 5 | num int := 109383901; 6 | rev int; 7 | tmp int; 8 | 9 | b int; 10 | 11 | BEGIN 12 | 13 | DBMS_OUTPUT.PUT_LINE(''); 14 | 15 | tmp := num; 16 | rev := 0; 17 | 18 | while (tmp > 0) loop 19 | b := mod(tmp, 10); 20 | rev := rev * 10 + b; 21 | tmp := floor(tmp / 10); 22 | end loop; 23 | 24 | if (num = rev) then 25 | DBMS_OUTPUT.PUT_LINE('PALINDROME!!!'); 26 | else 27 | DBMS_OUTPUT.PUT_LINE('NOT A PALINDROME!'); 28 | end if; 29 | 30 | END; 31 | / -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/06.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | DROP TABLE SPHERE; 4 | CREATE TABLE SPHERE (raduis numeric(2, 0), volume numeric(8, 2), sarea numeric(8, 2)); 5 | 6 | DECLARE 7 | 8 | svalue int := 3; 9 | evalue int := 24; 10 | 11 | BEGIN 12 | 13 | DBMS_OUTPUT.PUT_LINE(''); 14 | 15 | while (svalue <= evalue) loop 16 | INSERT INTO SPHERE VALUES (svalue, round(1.33 * 3.14 * svalue * svalue * svalue, 2), round(4 * 3.14 * svalue * svalue, 2)); 17 | svalue := svalue + 1; 18 | end loop; 19 | 20 | END; 21 | / 22 | 23 | SELECT * FROM SPHERE; -------------------------------------------------------------------------------- /ALG Lab/GCD/Euclid/inputfib.csv: -------------------------------------------------------------------------------- 1 | 1, 2 2 | 2, 3 3 | 3, 5 4 | 5, 8 5 | 8, 13 6 | 13, 21 7 | 21, 34 8 | 34, 55 9 | 55, 89 10 | 89, 144 11 | 144, 233 12 | 233, 377 13 | 377, 610 14 | 610, 987 15 | 987, 1597 16 | 1597, 2584 17 | 2584, 4181 18 | 4181, 6765 19 | 6765, 10946 20 | 10946, 17711 21 | 17711, 28657 22 | 28657, 46368 23 | 46368, 75025 24 | 75025, 121393 25 | 121393, 196418 26 | 196418, 317811 27 | 317811, 514229 28 | 514229, 832040 29 | 832040, 1346269 30 | 1346269, 2178309 31 | 2178309, 3524578 32 | 3524578, 5702887 33 | 5702887, 9227465 34 | 9227465, 14930352 35 | 14930352, 24157817 -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/exeggute/b.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (int argc, char const * argv []) { 4 | int n = 5, c, k, space = 1; 5 | space = n - 1; 6 | for (k = 1; k <= n; k++) { 7 | for (c = 1; c <= space; c++) 8 | printf(" "); 9 | space--; 10 | for (c = 1; c <= 2*k-1; c++) 11 | printf("* "); 12 | printf("\n"); 13 | } 14 | space = 1; 15 | for (k = 1; k <= n - 1; k++) { 16 | for (c = 1; c <= space; c++) 17 | printf(" "); 18 | space++; 19 | for (c = 1 ; c <= 2*(n-k)-1; c++) 20 | printf("* "); 21 | printf("\n"); 22 | } 23 | return 0; 24 | } -------------------------------------------------------------------------------- /OOP Lab/Generics/Tree/BTTest/BinaryTreeTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // 4 | // 5 | // 6 | // 7 | // 8 | 9 | package BTTest; 10 | 11 | import BinaryTree.*; 12 | import Tree.*; 13 | 14 | public class BinaryTreeTest { 15 | 16 | public static void main (String [] args) { 17 | 18 | BinaryTree tree = new BinaryTree(); 19 | 20 | System.out.print("\n\tPreorder: "); 21 | BinaryTree.preorder(tree); 22 | 23 | System.out.print("\n\tInorder: "); 24 | BinaryTree.inorder(tree); 25 | 26 | System.out.print("\n\tPostorder: "); 27 | BinaryTree.postorder(tree); 28 | 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /CD Lab/Another Parser/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | IDIR =include 4 | CC=gcc 5 | CFLAGS=-I$(IDIR) 6 | 7 | ODIR=src 8 | LDIR =lib 9 | 10 | LIBS=-lm 11 | 12 | _DEPS = common.h 13 | DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) 14 | 15 | %.o: %.c $(DEPS) 16 | $(CC) -c -o $@ $< $(CFLAGS) 17 | 18 | _OBJ = util.o lexer.o preprocessor.o test.o 19 | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) 20 | 21 | 22 | $(ODIR)/%.o: %.c $(DEPS) 23 | $(CC) -c -o $@ $< $(CFLAGS) 24 | 25 | notclang: $(OBJ) 26 | gcc -o $@ $^ $(CFLAGS) $(LIBS) 27 | 28 | .PHONY: clean 29 | 30 | clean: 31 | rm -f $(ODIR)/*.o *.o $(OBJ) -------------------------------------------------------------------------------- /CD Lab/Simple parsers/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | IDIR =include 4 | CC=gcc 5 | CFLAGS=-I$(IDIR) 6 | 7 | ODIR=src 8 | LDIR =lib 9 | 10 | LIBS=-lm 11 | 12 | _DEPS = common.h 13 | DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) 14 | 15 | %.o: %.c $(DEPS) 16 | $(CC) -c -o $@ $< $(CFLAGS) 17 | 18 | _OBJ = util.o lexer.o preprocessor.o test.o 19 | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) 20 | 21 | 22 | $(ODIR)/%.o: %.c $(DEPS) 23 | $(CC) -c -o $@ $< $(CFLAGS) 24 | 25 | notclang: $(OBJ) 26 | gcc -o $@ $^ $(CFLAGS) $(LIBS) 27 | 28 | .PHONY: clean 29 | 30 | clean: 31 | rm -f $(ODIR)/*.o *.o $(OBJ) -------------------------------------------------------------------------------- /MP Lab/Proceudres and Macros/FACT.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | num dw ? 3 | fct dw ?, ? 4 | data ends 5 | 6 | code segment 7 | assume cs:code, ds:data; 8 | start : 9 | mov ax, data; 10 | mov ds, ax; 11 | 12 | mov ax, num; 13 | mov bx, num; 14 | 15 | fact proc near 16 | 17 | dec bx; 18 | jz done; 19 | mul bx; 20 | call fact; 21 | 22 | ret; 23 | fact endp 24 | 25 | done: 26 | mov fct, ax; 27 | mov fct + 1, dx; 28 | 29 | mov ah, 4ch; 30 | int 21h; 31 | 32 | code ends 33 | end start 34 | -------------------------------------------------------------------------------- /CD Lab/C like Parser 1/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | IDIR =include 4 | CC=gcc 5 | CFLAGS=-I$(IDIR) 6 | 7 | ODIR=src 8 | LDIR =lib 9 | 10 | LIBS=-lm 11 | 12 | _DEPS = common.h 13 | DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) 14 | 15 | %.o: %.c $(DEPS) 16 | $(CC) -c -o $@ $< $(CFLAGS) 17 | 18 | _OBJ = util.o lexer.o preprocessor.o test.o 19 | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) 20 | 21 | 22 | $(ODIR)/%.o: %.c $(DEPS) 23 | $(CC) -c -o $@ $< $(CFLAGS) 24 | 25 | notclang: $(OBJ) 26 | gcc -o $@ $^ $(CFLAGS) $(LIBS) 27 | 28 | .PHONY: clean 29 | 30 | clean: 31 | rm -f $(ODIR)/*.o *.o $(OBJ) -------------------------------------------------------------------------------- /CD Lab/C like Parser 2/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | IDIR =include 4 | CC=gcc 5 | CFLAGS=-I$(IDIR) 6 | 7 | ODIR=src 8 | LDIR =lib 9 | 10 | LIBS=-lm 11 | 12 | _DEPS = common.h 13 | DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) 14 | 15 | %.o: %.c $(DEPS) 16 | $(CC) -c -o $@ $< $(CFLAGS) 17 | 18 | _OBJ = util.o lexer.o preprocessor.o test.o 19 | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) 20 | 21 | 22 | $(ODIR)/%.o: %.c $(DEPS) 23 | $(CC) -c -o $@ $< $(CFLAGS) 24 | 25 | notclang: $(OBJ) 26 | gcc -o $@ $^ $(CFLAGS) $(LIBS) 27 | 28 | .PHONY: clean 29 | 30 | clean: 31 | rm -f $(ODIR)/*.o *.o $(OBJ) -------------------------------------------------------------------------------- /CD Lab/C like Parser 3/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | IDIR =include 4 | CC=gcc 5 | CFLAGS=-I$(IDIR) 6 | 7 | ODIR=src 8 | LDIR =lib 9 | 10 | LIBS=-lm 11 | 12 | _DEPS = common.h 13 | DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) 14 | 15 | %.o: %.c $(DEPS) 16 | $(CC) -c -o $@ $< $(CFLAGS) 17 | 18 | _OBJ = util.o lexer.o preprocessor.o test.o 19 | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) 20 | 21 | 22 | $(ODIR)/%.o: %.c $(DEPS) 23 | $(CC) -c -o $@ $< $(CFLAGS) 24 | 25 | notclang: $(OBJ) 26 | gcc -o $@ $^ $(CFLAGS) $(LIBS) 27 | 28 | .PHONY: clean 29 | 30 | clean: 31 | rm -f $(ODIR)/*.o *.o $(OBJ) -------------------------------------------------------------------------------- /CD Lab/C like Parser 4/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | 3 | IDIR =include 4 | CC=gcc 5 | CFLAGS=-I$(IDIR) 6 | 7 | ODIR=src 8 | LDIR =lib 9 | 10 | LIBS=-lm 11 | 12 | _DEPS = common.h 13 | DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) 14 | 15 | %.o: %.c $(DEPS) 16 | $(CC) -c -o $@ $< $(CFLAGS) 17 | 18 | _OBJ = util.o lexer.o preprocessor.o test.o 19 | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) 20 | 21 | 22 | $(ODIR)/%.o: %.c $(DEPS) 23 | $(CC) -c -o $@ $< $(CFLAGS) 24 | 25 | notclang: $(OBJ) 26 | gcc -o $@ $^ $(CFLAGS) $(LIBS) 27 | 28 | .PHONY: clean 29 | 30 | clean: 31 | rm -f $(ODIR)/*.o *.o $(OBJ) -------------------------------------------------------------------------------- /DS Lab/Basic Programs - Recursive/Factorial.c: -------------------------------------------------------------------------------- 1 | // 2 | // Factorial.c 3 | // Factorial 4 | // 5 | // Created by Avikant Saini on 8/15/15. 6 | // Copyright © 2015 avikantz. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | long factorial (long n) { 12 | if (n == 1) 13 | return 1; 14 | return n*factorial(n-1); 15 | } 16 | 17 | int main(int argc, const char * argv[]) { 18 | long n; 19 | printf("This program will calculate the factorial of a number recursively.\n\tEnter a number : "); 20 | scanf("%ld", &n); 21 | printf("\n\t%ld! = %ld\n\n", n, factorial(n)); 22 | } 23 | -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/PCKBCD.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | bcd db ?, ?, ?, ? 3 | asc db ?, ? 4 | data ends 5 | 6 | code segment 7 | assume ds:data, cs:code 8 | 9 | start: mov ax, data 10 | mov ds, ax 11 | 12 | mov dl, 2; 13 | lea si, bcd; 14 | lea di, asc; 15 | 16 | bloop: 17 | mov al, [si]; 18 | mov ah, [si+1]; 19 | sub ax, 3030h; 20 | mov cl, 4; 21 | rol ah, cl; 22 | add al, ah; 23 | daa; 24 | mov [di], al; 25 | inc di; 26 | add si, 2; 27 | dec dl; 28 | jnz bloop; 29 | 30 | mov ah, 4ch 31 | int 21h 32 | code ends 33 | end start 34 | -------------------------------------------------------------------------------- /OS Lab/Inter process communication/message queue/server_message_queue.c: -------------------------------------------------------------------------------- 1 | 2 | #include "common.h" 3 | 4 | int main (int argc, char const * argv[] ) { 5 | 6 | int qt; 7 | MESSAGE_t message; 8 | 9 | if((qt = msgget(1271, IPC_CREAT | IPC_EXCL | 0600)) < 0) { 10 | perror("Error in msgget()"); 11 | } 12 | 13 | printf("Message queue created.\n"); 14 | 15 | if(msgrcv(qt, &message, sizeof(MESSAGE_t), 0, 0) < 0) { 16 | perror("Error in msgrcv()"); 17 | } 18 | 19 | printf("Successfully received: %s\n", message.c); 20 | 21 | msgctl(qt, IPC_RMID, NULL); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-16.sql: -------------------------------------------------------------------------------- 1 | alter table Employee add dob date; 2 | 3 | update Employee set dob='16-NOV-70' where empNo='001'; 4 | update Employee set dob='14-NOV-73' where empNo='002'; 5 | update Employee set dob='03-DEC-72' where empNo='003'; 6 | update Employee set dob='08-JAN-74' where empNo='004'; 7 | update Employee set dob='23-FEB-77' where empNo='005'; 8 | update Employee set dob='19-OCT-81' where empNo='006'; 9 | 10 | select to_char(dob, 'DD-MON-YYYY') from employee; 11 | select to_char(dob, 'DD-MON-YY') from employee; 12 | select to_char(dob, 'DD-MM-YY') from employee; -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/EVENODD.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | num db ? 3 | evenx db " Yer number Even! $" 4 | oddx db " Yer number Odd! $" 5 | data ends 6 | 7 | code segment 8 | assume ds:data, cs:code 9 | 10 | start: mov ax, data 11 | mov ds, ax 12 | 13 | mov al, num; 14 | and al, 1; 15 | xor al, 1; 16 | 17 | jz nodd; 18 | 19 | neven: 20 | lea dx, evenx; 21 | mov ah, 09h; 22 | int 21h; 23 | jmp endd 24 | 25 | nodd: 26 | lea dx, oddx; 27 | mov ah, 09h; 28 | int 21h; 29 | 30 | endd: 31 | mov ah, 4ch 32 | int 21h 33 | code ends 34 | end start 35 | -------------------------------------------------------------------------------- /OS Lab/Inter process communication/number_of_users.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main (int argc, const char * argv []) { 7 | 8 | int fd[2]; 9 | pipe(fd); 10 | 11 | pid_t pid; 12 | pid = fork(); 13 | 14 | if (pid == 0) { 15 | 16 | dup2(fd[0], 0); 17 | close(fd[0]); 18 | close(fd[1]); 19 | execlp("/usr/bin/wc", "wc", "-l", NULL); 20 | 21 | } else { 22 | 23 | dup2(fd[1], 1); 24 | close(fd[0]); 25 | close(fd[1]); 26 | execlp("/usr/bin/who", "who", "-l", NULL); 27 | 28 | } 29 | 30 | exit(-1); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /MP Lab/Number Manipulation/FIBN.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | n db ? 3 | a db ? 4 | data ends 5 | 6 | code segment 7 | assume ds:data, cs:code 8 | 9 | start: mov ax, data 10 | mov ds, ax 11 | 12 | mov dl, n; 13 | sub dl, 2; 14 | lea si, a; 15 | 16 | mov al, 00h; 17 | mov bl, 01h; 18 | mov [si], al; 19 | inc si; 20 | mov [si], bl; 21 | inc si; 22 | 23 | floop: 24 | mov cl, al; 25 | add cl, bl; 26 | mov al, bl; 27 | mov bl, cl; 28 | mov [si], cl; 29 | inc si; 30 | dec dl; 31 | jnz floop; 32 | 33 | mov ah, 4ch 34 | int 21h 35 | code ends 36 | end start 37 | -------------------------------------------------------------------------------- /OS Lab/System Calls/pids.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char const *argv[]) { 8 | pid_t pid = fork(); 9 | int status; 10 | if (pid == 0) { 11 | printf("In child process...\n"); 12 | printf("Parent pid = %d\n", getppid()); 13 | printf("Child pid = %d\n", getpid()); 14 | sleep(2); 15 | } else { 16 | while(wait(&status) != pid); 17 | printf("Parent process here...\n"); 18 | printf("Parent pid = %d\n", getppid()); 19 | printf("Child pid = %d\n", getpid()); 20 | } 21 | return 0; 22 | } -------------------------------------------------------------------------------- /PCAP Lab/Message Passing Interface/Basic programs/helloworld.cpp: -------------------------------------------------------------------------------- 1 | // helloworld 2 | // Create some threads, even numbered print 'HELLO', odd numbered print 'WORLD' 3 | 4 | #include "mpi.h" 5 | #include 6 | #include 7 | 8 | int main (int argc, char *argv []) { 9 | 10 | int size, rank; 11 | 12 | MPI_Init(&argc, &argv); 13 | 14 | MPI_Comm_size(MPI_COMM_WORLD, &size); 15 | MPI_Comm_rank(MPI_COMM_WORLD, &rank); 16 | 17 | if (rank % 2 == 0) { 18 | printf("%.3d. HELLO\n", rank); 19 | } else { 20 | printf("%.3d. WORLD\n", rank); 21 | } 22 | 23 | MPI_Finalize(); 24 | } -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/Biggest.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void biggest (int arr[], int n) 4 | { 5 | int i, big, pos; 6 | big = arr[0]; 7 | pos = 0; 8 | for (i=1; i 2000000 THEN 20 | ROLLBACK TO SAVEPOINT salInc; 21 | DBMS_OUTPUT.PUT_LINE('ROLLBACKED!'); 22 | END IF; 23 | 24 | END; 25 | / 26 | -------------------------------------------------------------------------------- /DS Lab/Basic Programs - Recursive/GCD.c: -------------------------------------------------------------------------------- 1 | // 2 | // GCD.c 3 | // GCD 4 | // 5 | // Created by Avikant Saini on 8/15/15. 6 | // Copyright © 2015 avikantz. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | long gcd(long a, long b){ 12 | if (b > a) 13 | return gcd(b, a); 14 | if(b == 0) 15 | return a; 16 | return gcd(b, a%b); 17 | } 18 | 19 | int main(int argc, const char * argv[]) { 20 | long a, b; 21 | printf("This program will calculate the GCD of two numbers recursively.\n\tEnter two numbers : "); 22 | scanf("%ld %ld", &a, &b); 23 | printf("\n\tGCD(%ld, %ld) = %ld\n\n", a, b, gcd(a, b)); 24 | } 25 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/Week1Sub/Biggest.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void biggest (int arr[], int n) 4 | { 5 | int i, big, pos; 6 | big = arr[0]; 7 | pos = 0; 8 | for (i=1; i 4 | #include 5 | #include 6 | #include 7 | 8 | int main (int argc, const char * argv []) { 9 | 10 | printf("Files in the directory: \n"); 11 | system("ls -l"); 12 | 13 | char fname[100]; 14 | printf("Enter a filename: "); 15 | scanf(" %s", fname); 16 | 17 | FILE *file = fopen(fname, "r"); 18 | if (file == NULL) { 19 | printf("Invalid file name!\n"); 20 | return 9; 21 | } 22 | fseek(file, 0, SEEK_END); 23 | size_t flen = ftell(file); 24 | 25 | printf("Size of '%s' = %liB\n", fname, flen); 26 | 27 | } -------------------------------------------------------------------------------- /DS Lab/Basic Programs - Recursive/Decimal to Binary.c: -------------------------------------------------------------------------------- 1 | // 2 | // Decimal to Binary.c 3 | // Decimal to Binary 4 | // 5 | // Created by Avikant Saini on 8/15/15. 6 | // Copyright © 2015 avikantz. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | long decToBin (long n) { 12 | if (n == 0) 13 | return 0; 14 | return (n%2 + 10*decToBin(n/2)); 15 | } 16 | 17 | int main(int argc, const char * argv[]) { 18 | long n; 19 | printf("This program will convert a decimal number into binary using recursion.\n\tEnter the decimal number : "); 20 | scanf("%ld", &n); 21 | printf("\n\t %ld|d = %ld|b\n\n", n, decToBin(n)); 22 | } 23 | -------------------------------------------------------------------------------- /CN Lab/Concurrent Server/files/machine.txt: -------------------------------------------------------------------------------- 1 | If you can hear this, you're alone. 2 | The only thing left of me is the sound of my voice. 3 | I don't know if any of us made it. 4 | Did we win, did we lose? I don't know. 5 | But either way, its over. 6 | So let me tell you who we were. 7 | Let me tell you who you are. 8 | Someone once asked me if I had learned anything from it all, so let me tell you what I learned. 9 | I learned everyone dies alone. 10 | But if you meant something to someone, if you helped someone, or loved someone, if even a single person remembers you, then maybe you never really die. 11 | And maybe... this isn't the end at all. -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/MUL3232.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a0 dw ? 3 | a1 dw ? 4 | b0 dw ? 5 | b1 dw ? 6 | c dw ? 7 | data ends 8 | 9 | code segment 10 | assume ds:data, cs:code 11 | 12 | start: mov ax, data 13 | mov ds, ax 14 | 15 | mov ax, a0 16 | mov bx, b0 17 | mul bx 18 | mov c, ax 19 | mov c+2, dx 20 | 21 | mov ax, a1 22 | mul bx 23 | add c+2, ax 24 | adc c+4, dx 25 | 26 | mov ax, a0 27 | mov bx, b1 28 | mul bx 29 | add c+2, ax 30 | adc c+4, dx 31 | 32 | mov ax, a1 33 | mul bx 34 | add c+4, ax 35 | adc c+6, dx 36 | 37 | mov ah, 4ch 38 | int 21h 39 | code ends 40 | end start 41 | -------------------------------------------------------------------------------- /MP Lab/Proceudres and Macros/SORT.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | list db 15h,03h,08h,01h,14h 3 | count equ 4 4 | data ends 5 | 6 | code segment 7 | assume cs:code,ds:data 8 | start: 9 | mov ax,data 10 | mov ds,ax 11 | mov dx,count 12 | call sort 13 | mov ah,4ch 14 | int 21h 15 | sort proc near 16 | 17 | rep1: 18 | mov cx,dx 19 | lea si,list 20 | rep2: 21 | mov al,[si] 22 | cmp al,[si+1] 23 | jl do 24 | xchg [si+1],al 25 | mov [si],al 26 | do: inc si 27 | loop rep2 28 | dec dx 29 | jnz rep1 30 | ret 31 | sort endp 32 | 33 | 34 | code ends 35 | end start 36 | 37 | -------------------------------------------------------------------------------- /ALG Lab/Brute Forcing/Matrix Multiplication/gen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (int argc, const char * argv []) { 5 | 6 | FILE *outfile = fopen("matrices.txt", "w+"); 7 | 8 | int i, j, k; 9 | 10 | for (k = 2; k < 16; ++k) { 11 | 12 | fprintf(outfile, "%d\n", k); 13 | 14 | for (i = 0; i < k; ++i) { 15 | for (j = 0; j < k; ++j) { 16 | fprintf(outfile, "%d ", rand() % 20 + 1); 17 | } 18 | fprintf(outfile, "\n"); 19 | for (j = 0; j < k; ++j) { 20 | fprintf(outfile, "%d ", rand() % 20 + 1); 21 | } 22 | fprintf(outfile, "\n"); 23 | } 24 | 25 | } 26 | 27 | fclose(outfile); 28 | 29 | } -------------------------------------------------------------------------------- /CN Lab/README.MD: -------------------------------------------------------------------------------- 1 | # Computer Networks Lab 2 | 3 | Programs on socket programming in C. 4 | 5 | ## Table of contents 6 | 7 | - UDP Client Server 8 | - Chat server 9 | - Echo server 10 | - Operations server 11 | 12 | - TCP Client Server 13 | - Dank FTP 14 | - Echo server 15 | - Exeggute server 16 | - Multiple clients 17 | 18 | - Concurrent Server 19 | - File server 20 | - Time server 21 | 22 | - Synchronous IO Multiplexing 23 | - Synchronous echo server 24 | - Group chat client 25 | - Time server 26 | 27 | 28 | ## Contributing 29 | 30 | Feel free send a pull if you want to add another algorithm not implemented here/fixing some bugs. -------------------------------------------------------------------------------- /OS Lab/System Calls/copy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char const *argv[]) { 8 | 9 | printf("Files list: \n"); 10 | system("ls -A1"); 11 | 12 | char src[64], dst[64]; 13 | 14 | printf("Enter source name: "); 15 | scanf(" %s", src); 16 | 17 | printf("Enter dest name: "); 18 | scanf(" %s", dst); 19 | 20 | int sfd = open(src, O_RDONLY); 21 | int dfd = open(dst, O_WRONLY | O_CREAT, 0640); 22 | 23 | char buffer[1]; 24 | while ((read(sfd, buffer, 1)) > 0) { 25 | write(dfd, buffer, 1); 26 | } 27 | 28 | return 0; 29 | 30 | } -------------------------------------------------------------------------------- /PCAP Lab/OpenCL/matrix row col sum/kernel.cl: -------------------------------------------------------------------------------- 1 | __kernel void transpose (__global int *A, int M, int N, __global int *B) { 2 | int row = get_global_id(0); 3 | int col = get_global_id(1); 4 | int rsum = 0, csum = 0; 5 | int i; 6 | for (i = 0; i < N; ++i) { 7 | // printf("rsum += A[%d] (%d)\n", i + M * row, A[i + M * row]); 8 | rsum += A[i + M * row]; 9 | } 10 | for (i = 0; i < M; ++i) { 11 | // printf("csum += A[%d] (%d)\n", i * N + col, A[i * N + col]); 12 | csum += A[i * N + col]; 13 | } 14 | // printf("(row, col) = (%d, %d) = %d | rsum = %d, csum = %d\n", row, col, row * M + col, rsum, csum); 15 | B[row * M + col] = rsum + csum; 16 | } 17 | -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/02.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | DECLARE 4 | 5 | issue date := '21-DEC-2012'; 6 | retur date := '18-FEB-2014'; 7 | 8 | days int; 9 | fine float; 10 | 11 | BEGIN 12 | 13 | days := retur - issue; 14 | 15 | if (days < 5) then 16 | fine := 0; 17 | elsif (days = 5) then 18 | fine := 0.5; 19 | elsif (days <= 10) then 20 | fine := 0.5 + (days - 5) * 1.00; 21 | elsif (days <= 30) then 22 | fine := 0.5 + 5 * 1.0 + (days - 10) * 5.00; 23 | else 24 | fine := 0.5 + 5 * 1.0 + 20 * 5.00 + (days - 30) * 10; 25 | end if; 26 | 27 | DBMS_OUTPUT.PUT_LINE('FINE : ' || fine); 28 | 29 | END; 30 | / -------------------------------------------------------------------------------- /DS Lab/Basic Programs - Recursive/SumList.c: -------------------------------------------------------------------------------- 1 | // SumList.c 2 | // Created by @avikantz on 08/11/15 3 | 4 | #include 5 | 6 | long sum (int list[], int n) { 7 | if (n == 0) 8 | return 0; 9 | return list[n-1] + sum(list, n-1); 10 | } 11 | 12 | int main (int argc, const char *argv []) { 13 | int i, n, list[100]; 14 | printf("This program will calculate sum of a list of integers.\n\n\tEnter number of integers: "); 15 | scanf("%d", &n); 16 | printf("\n"); 17 | for (i = 0; i < n; ++i) { 18 | printf("\tEnter list[%d]: ", i+1); 19 | scanf("%d", &list[i]); 20 | } 21 | printf("\nThe sum of above entered integers = %ld.\n\n", sum(list, n)); 22 | } -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/AddEx1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void main() 5 | { 6 | int arr[10000], n, freq[199], i, temp; 7 | i=0; 8 | printf("Enter array size "); 9 | scanf("%d", &n); 10 | for (i=0; i<199; i++) 11 | { 12 | freq[i] = 0; 13 | } 14 | for(i=0; i 2 | #include 3 | #include 4 | #include 5 | int main() 6 | { 7 | printf("Parent process\n"); 8 | int pid = fork(); 9 | if(pid == -1) 10 | printf("Error\n"); 11 | else if (pid == 0) 12 | { 13 | printf("Parent ID:%d\n", getppid); 14 | printf("Child ID:%d\n", getpid()); 15 | printf("Child process\n"); 16 | printf("Child process completed\n"); 17 | exit(0); 18 | } 19 | else 20 | { 21 | sleep(5); 22 | printf("Child created\n"); 23 | while(1); 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/Week1Sub/AddEx1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void main() 5 | { 6 | int arr[10000], n, freq[199], i, temp; 7 | i=0; 8 | printf("Enter array size "); 9 | scanf("%d", &n); 10 | for (i=0; i<199; i++) 11 | { 12 | freq[i] = 0; 13 | } 14 | for(i=0; i> ~/.bashrc 8 | rm atom-amd64.tar.gz 9 | rmdir atom-1.9.9-amd64/ 10 | echo "------------------------------------" 11 | echo "Use 'atom' for exegguting atom. Open a new terminal, this will close now." 12 | sleep 2 13 | 14 | # Copy the following line (Uncommented) and paste it in the terminal to install atom in one go 15 | 16 | # $(wget 'https://raw.githubusercontent.com/mitcse/CSE-Labs/master/Scripts/atom.sh') sh atom.sh && rm atom.sh && exit -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 3/Towers of Hanoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long moves = 0; 4 | 5 | void tower (int n, char from, char intermediate, char to) 6 | { 7 | moves++; 8 | if (n == 1) 9 | { 10 | printf("Move disc 1 from %c to %c\n", from, to); 11 | return; 12 | } 13 | else 14 | { 15 | tower (n-1, from, to, intermediate); 16 | printf("Move disc %d from %c to %c\n", n, from, to); 17 | tower (n-1, intermediate, from, to); 18 | } 19 | } 20 | 21 | int main() 22 | { 23 | int n; 24 | printf("Enter number of discs\n"); 25 | scanf("%d", &n); 26 | tower(n, 'A', 'B', 'C'); 27 | printf("Total moves taken is %li\n", moves); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/05.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | DROP TABLE TBL_NEXT_DATE; 4 | CREATE TABLE TBL_NEXT_DATE (gdate date, ndate date); 5 | 6 | DECLARE 7 | 8 | sdate date := '01-JAN-2016'; 9 | edate date := '31-DEC-2016'; 10 | 11 | BEGIN 12 | 13 | DBMS_OUTPUT.PUT_LINE(''); 14 | 15 | /* 16 | while not (sdate >= edate) loop 17 | INSERT INTO TBL_NEXT_DATE VALUES (sdate, sdate + 2); 18 | sdate := sdate + 7; 19 | end loop; 20 | */ 21 | 22 | while not (sdate = 'Z') loop 23 | INSERT INTO TBL_NEXT_DATE VALUES (sdate, sdate + 2); 24 | sdate := sdate + 7; 25 | end loop; 26 | 27 | END; 28 | / 29 | -- 30 | -- SELECT * FROM TBL_NEXT_DATE; -------------------------------------------------------------------------------- /OOP Lab/Basics/PrimeGenerator.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class PrimeGenerator { 3 | static boolean isPrime(int n) { 4 | for (int i = 2; i <= n/2; ++i) 5 | if (n%i == 0) 6 | return false; 7 | return true; 8 | } 9 | public static void main(String []args) { 10 | Scanner sc = new Scanner (System.in); 11 | System.out.print("This program will generate \'n\' prime numbers.\nEnter \'n\': "); 12 | int n = sc.nextInt(); 13 | System.out.println("\n\tN\t|\tNth Prime\n\t\t|"); 14 | int k = 1; 15 | for (int i = 2; k <= n; ++i) 16 | if (isPrime(i)) 17 | System.out.println("\t"+(k++)+"\t|\t"+i); 18 | System.out.println("\n\nPeace Out!"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MP Lab/Strings/Concatenate: -------------------------------------------------------------------------------- 1 | data segment 2 | st1 db "poke" 3 | len1 db ($-str1) 4 | st2 db "mon" 5 | len2 db ($-str2) 6 | st3 db 10 dup(0) 7 | data ends 8 | 9 | code segment 10 | assume cs:code, ds:data,es:data 11 | start:mov ax,data 12 | mov ds,ax 13 | mov es,ax 14 | 15 | lea di,st3 16 | lea si,st1 17 | mov cl,len1 18 | 19 | cld 20 | 21 | rep movs st3,st1 22 | 23 | mov cl,len2 24 | lea si,st2 25 | 26 | rep movs st3,st1 27 | 28 | mov al,'$' 29 | mov [di],al 30 | 31 | mov ah,4ch 32 | int 21h 33 | code ends 34 | end start 35 | -------------------------------------------------------------------------------- /OOP Lab/Input Output/Copy.java: -------------------------------------------------------------------------------- 1 | // 2 | // Copy.java 3 | // Copies the contents of a input file to output file passed as argument 4 | // 5 | // 6 | // 7 | // 8 | 9 | import java.io.*; 10 | 11 | public class Copy { 12 | 13 | public static void main (String [] args) throws IOException { 14 | 15 | FileInputStream fin = null; 16 | FileOutputStream fout = null; 17 | 18 | try { 19 | 20 | fin = new FileInputStream(args[0]); 21 | fout = new FileOutputStream(args[1]); 22 | 23 | int ch; 24 | 25 | while ((ch = fin.read()) != -1) 26 | fout.write(ch); 27 | 28 | } 29 | finally { 30 | 31 | fin.close(); 32 | fout.close(); 33 | 34 | } 35 | 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /DS Lab/Basic Programs - Recursive/Fibonacci.c: -------------------------------------------------------------------------------- 1 | // 2 | // Fibonacci.c 3 | // Fibonacci 4 | // 5 | // Created by Avikant Saini on 8/15/15. 6 | // Copyright © 2015 avikantz. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | long fib (long n) { 12 | if (n == 0) return 0; 13 | if (n == 1) return 1; 14 | return fib(n - 1) + fib(n-2); 15 | } 16 | 17 | int main(int argc, const char * argv[]) { 18 | int n, i; 19 | printf("This program will generate the fibonacci series with the help of a recursive function.\n\tEnter the limit: "); 20 | scanf("%d", &n); 21 | printf("\n\t0\t1"); 22 | for(i = 1; i <= n-2; ++i) 23 | printf("\t%ld", fib(0, 1, i, 1)); 24 | printf("\n\n"); 25 | return 0; 26 | } -------------------------------------------------------------------------------- /ALG Lab/Other/Nth Fibonacci/fibonacci.csv: -------------------------------------------------------------------------------- 1 | Number, Time 2 | 0, 0.00000 3 | 1, 0.00000 4 | 2, 0.00000 5 | 3, 0.00000 6 | 4, 0.00000 7 | 5, 0.00000 8 | 6, 0.00000 9 | 7, 0.00000 10 | 8, 0.00001 11 | 9, 0.00001 12 | 10, 0.00001 13 | 11, 0.00002 14 | 12, 0.00003 15 | 13, 0.00005 16 | 14, 0.00009 17 | 15, 0.00014 18 | 16, 0.00023 19 | 17, 0.00038 20 | 18, 0.00058 21 | 19, 0.00092 22 | 20, 0.00146 23 | 21, 0.00244 24 | 22, 0.00402 25 | 23, 0.00603 26 | 24, 0.01017 27 | 25, 0.02077 28 | 26, 0.03356 29 | 27, 0.04891 30 | 28, 0.07121 31 | 29, 0.11805 32 | 30, 0.18748 33 | 31, 0.30483 34 | 32, 0.48532 35 | 33, 0.82365 36 | 34, 1.42424 37 | 35, 2.20417 38 | 36, 3.48552 39 | 37, 5.63650 40 | 38, 8.98181 41 | 39, 14.95684 42 | -------------------------------------------------------------------------------- /DBMS Lab/PL Basics/08.sql: -------------------------------------------------------------------------------- 1 | SET SERVEROUTPUT ON 2 | 3 | 4 | 5 | DECLARE 6 | 7 | n int; 8 | c int; 9 | s int; 10 | a float; 11 | 12 | type numbers is varray(10) of integer; 13 | num numbers := numbers(11, 24, 16, 98, 82, 59, 19, 03, -1, 10); 14 | 15 | BEGIN 16 | 17 | DBMS_OUTPUT.PUT_LINE(''); 18 | 19 | c := 0; 20 | s := 0; 21 | 22 | loop 23 | n := num(c + 1); 24 | if (n = -1) then 25 | goto ends; 26 | else 27 | c := c + 1; 28 | s := s + n; 29 | end if; 30 | end loop; 31 | 32 | <> 33 | if (c = 0) then 34 | a := 0; 35 | else 36 | a := s / c; 37 | end if; 38 | DBMS_OUTPUT.PUT_LINE('Average = ' || a); 39 | 40 | END; 41 | / -------------------------------------------------------------------------------- /DBMS Lab/ER Diagram to tables SQL/lab5-1-5.sql: -------------------------------------------------------------------------------- 1 | # 1 2 | 3 | select bdate, address 4 | from XEmployee 5 | where fname='John' and mname='B' and lname='Smith'; 6 | 7 | # 2 8 | 9 | select fname, lname, address 10 | from XEmployee 11 | where dno in (select dno from XDepartment where dname='Machine Field'); 12 | 13 | # 3 14 | 15 | select pno, XProject.dno, lname, address, bdate 16 | from XProject, XEmployee, XDepartment 17 | where ploc='NY' and XProject.dno=XDepartment.dno and XDepartment.mssn=XEmployee.ssn; 18 | 19 | # 4 20 | 21 | select distinct salary from XEmployee; 22 | 23 | # 5 24 | 25 | select E.fname, E.lname, S.fname, S.lname 26 | from XEmployee E, XEmployee S 27 | where E.sssn=S.ssn; -------------------------------------------------------------------------------- /DS Lab/Basic Programs/ArrayPrintPointer.c: -------------------------------------------------------------------------------- 1 | // ArrayPrintPointer.c 2 | // Created by @avikantz on 08/11/15 3 | 4 | #include 5 | 6 | void printArray(int *arr, int n) { 7 | int *pi = arr, *pn = arr+n; 8 | printf("\n\tFORWARD HA!\n\t\t"); 9 | for(; pi < pn; ++pi) 10 | printf("%d\t", *pi); 11 | 12 | printf("\n\n\t!AH DRAWKCAB\n\t\t"); 13 | for(pi = pn - 1; pi >= arr; --pi) 14 | printf("%d\t", *pi); 15 | 16 | printf("\n\n"); 17 | } 18 | 19 | int main(int argc, const char *argv[]) { 20 | int a[100], n, i; 21 | printf("Enter the size of the array: "); 22 | scanf("%d", &n); 23 | printf("Enter the array: "); 24 | for (i = 0; i < n; ++i) 25 | scanf("%d", &a[i]); 26 | printArray(a, n); 27 | } 28 | -------------------------------------------------------------------------------- /MP Lab/Stepper Motors/Interface2.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | bas equ 0ce00h 3 | porta equ bas+00h 4 | portb equ bas+01h 5 | portc equ bas+02h 6 | ctrl equ bas+03h 7 | data ends 8 | 9 | code segment 10 | assume cs:code, ds:data 11 | start: mov ax, data 12 | mov ds, ax 13 | mov dx, ctrl 14 | mov al, 8ah 15 | out dx, al 16 | 17 | rpt: 18 | mov dx, portb 19 | in al, dx 20 | cbw 21 | neg ax 22 | mov ah, 00h 23 | mov dx, porta 24 | out dx, al 25 | mov ah, 0bh 26 | int 21h 27 | or al, al 28 | jz rpt 29 | mov ah, 4ch 30 | int 21h 31 | code ends 32 | end start 33 | -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/multiple/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | // Typedefs 24 | 25 | typedef enum { NO, YES } BOOL; 26 | 27 | typedef struct sockaddr_in sockaddr_in_t; 28 | typedef struct sockaddr sockaddr_t; 29 | typedef struct sockaddr * sockaddr_p_t; 30 | 31 | typedef char * string; 32 | 33 | // Defines 34 | 35 | #define BUFLEN sizeof(int) 36 | 37 | #define PORT 17682 38 | 39 | #endif -------------------------------------------------------------------------------- /CD Lab/File operations/copyfile.c: -------------------------------------------------------------------------------- 1 | // Copy contents of one file into another 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main (int argc, const char * argv []) { 10 | 11 | printf("Files in the directory: \n"); 12 | system("ls -l"); 13 | 14 | char src[100], dst[100]; 15 | 16 | printf("Enter source name: "); 17 | scanf(" %s", src); 18 | 19 | printf("Enter dest name: "); 20 | scanf(" %s", dst); 21 | 22 | int sfd = open(src, O_RDONLY); 23 | int dfd = open(dst, O_WRONLY | O_CREAT, 0640); 24 | 25 | char buffer[1]; 26 | while (read(sfd, buffer, 1) > 0) { 27 | write(dfd, buffer, 1); 28 | } 29 | 30 | return 0; 31 | 32 | } -------------------------------------------------------------------------------- /DS Lab/Basic Programs/SumArr.c: -------------------------------------------------------------------------------- 1 | // 2 | // main.c 3 | // SumArr 4 | // 5 | // Created by Avikant Saini on 8/10/15. 6 | // Copyright © 2015 avikantz. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | int sumArr (int a[], int n) { 12 | int sum = 0, i; 13 | for (i = 0; i < n; ++i) 14 | sum += a[i]; 15 | return sum; 16 | } 17 | 18 | int main(int argc, const char * argv[]) { 19 | // insert code here... 20 | int list[100], n, i; 21 | printf("Enter the number of integers: "); 22 | scanf("%d", &n); 23 | printf("\nEnter %d integers: ", n); 24 | for (i = 0; i < n; ++i) 25 | scanf("%d", &list[i]); 26 | 27 | printf("\nThe sum of integers inputted above = %d", sumArr(list, n)); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 2/Question 2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void sum (int *p, int *q) 4 | { 5 | int s; 6 | s = *p + *q; 7 | printf("Sum by passing pointers to function is %d\n", s); 8 | } 9 | 10 | int* add (int *p, int *q) 11 | { 12 | int sum; 13 | int *s; 14 | int **ds; 15 | ds = &s; 16 | s = ∑ 17 | sum = *p + *q; 18 | printf("Sum using double pointer is %d\n", **ds); 19 | return s; 20 | } 21 | 22 | int main() 23 | { 24 | int a, b; 25 | printf("Enter two numbers to be added\n"); 26 | scanf("%d %d", &a, &b); 27 | int *p = &a; 28 | int *q = &b; 29 | int *s; 30 | sum(p,q); 31 | s = add(p,q); 32 | printf("Sum using pointer returned from function is %d\n", *s); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 2/Traverse Array by Pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i, a[100], n; 5 | printf("Enter array size: "); 6 | scanf("%d", &n); 7 | printf("Enter array elements: \n"); 8 | for(i=0; i 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | // Typedefs 24 | 25 | typedef enum { NO, YES } BOOL; 26 | 27 | typedef struct sockaddr_in sockaddr_in_t; 28 | typedef struct sockaddr sockaddr_t; 29 | typedef struct sockaddr * sockaddr_p_t; 30 | 31 | typedef char * string; 32 | 33 | // Defines 34 | 35 | #define BUFLEN 65535 36 | #define FLEN 1023 37 | 38 | #define PORT 17682 39 | 40 | #endif -------------------------------------------------------------------------------- /MP Lab/Files/DISP.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | fname db "DATFILE.TXT", 0; 3 | fdata db 50, ?, 50 dup(0); 4 | data ends 5 | 6 | code segment 7 | assume cs: code, ds: data, es: data; 8 | start: 9 | mov ax, data; 10 | mov ds, ax; 11 | mov es, ax; 12 | 13 | ; open 14 | 15 | lea dx, fname; 16 | mov al, 0; 17 | mov ah, 3dh; 18 | int 21h; 19 | 20 | mov bx, ax; 21 | 22 | ; read 23 | 24 | lea dx, fdata; 25 | mov cx, 48; 26 | mov ah, 3fh; 27 | int 21h; 28 | 29 | mov ah, 3eh; 30 | int 21h; 31 | 32 | lea dx, fdata; 33 | mov ah, 09h; 34 | int 21h; 35 | 36 | done: 37 | 38 | mov ah, 4ch; 39 | int 21h; 40 | 41 | code ends; 42 | end start; -------------------------------------------------------------------------------- /OOP Lab/Inheritance and Packages/myPackages/p1/Max.java: -------------------------------------------------------------------------------- 1 | // 2 | // Max.java 3 | // Defined in package p1 4 | // 5 | // 6 | 7 | 8 | package p1; 9 | 10 | import java.util.Scanner; 11 | 12 | public class Max { 13 | 14 | int max (int a, int b, int c) { 15 | return (a>b)?((a>c)?a:c):((b>c)?b:c); 16 | } 17 | 18 | float max (float a, float b, float c) { 19 | return (a>b)?((a>c)?a:c):((b>c)?b:c); 20 | } 21 | 22 | int max (int a[]) { 23 | int max = 0; 24 | for (int i : a) 25 | if (i > max) 26 | max = i; 27 | return max; 28 | } 29 | 30 | int max(int a[][]) { 31 | int max = 0; 32 | for (int b[] : a) 33 | for (int i : b) 34 | if (i > max) 35 | max = i; 36 | return max; 37 | } 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /OS Lab/System Calls/mfork.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | pid_t pids[10]; 8 | int count = 0; 9 | 10 | void forkThatProcess (int i) { 11 | 12 | if (i == 10) 13 | return; 14 | 15 | if ((pids[count++] = fork()) == 0) { 16 | 17 | printf("Child [%d], Parent [%d]\n", getpid(), getppid()); 18 | 19 | // sleep(1); 20 | 21 | forkThatProcess(i+1); 22 | 23 | exit(i); 24 | 25 | } else { 26 | 27 | int x; 28 | wait(&x); 29 | x = x >> 8; 30 | 31 | printf("Parent [%d], return status = %d\n", getpid(), x); 32 | 33 | } 34 | 35 | } 36 | 37 | int main (int argc, const char * argv []) { 38 | 39 | forkThatProcess(0); 40 | 41 | } -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/echo/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | // Typedefs 24 | 25 | typedef enum { NO, YES } BOOL; 26 | 27 | typedef struct sockaddr_in sockaddr_in_t; 28 | typedef struct sockaddr sockaddr_t; 29 | typedef struct sockaddr * sockaddr_p_t; 30 | 31 | typedef char * string; 32 | 33 | // Defines 34 | 35 | #define MAX_LEN 255 36 | 37 | #define BUFLEN 140 38 | 39 | #define PORT 5035 40 | 41 | #endif -------------------------------------------------------------------------------- /CN Lab/UDP Client Server/echo/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | // Typedefs 24 | 25 | typedef enum { NO, YES } BOOL; 26 | 27 | typedef struct sockaddr_in sockaddr_in_t; 28 | typedef struct sockaddr sockaddr_t; 29 | typedef struct sockaddr * sockaddr_p_t; 30 | 31 | typedef char * string; 32 | 33 | // Defines 34 | 35 | #define MAX_LEN 255 36 | 37 | #define BUFLEN 140 38 | 39 | #define PORT 19389 40 | 41 | #endif -------------------------------------------------------------------------------- /CD Lab/Scanning/discard_newlinetab.c: -------------------------------------------------------------------------------- 1 | // Discard new line and tabs 2 | 3 | #include 4 | #include 5 | 6 | int main (int argc, const char * argv []) { 7 | 8 | char inname[128]; 9 | printf("Enter input filename: "); 10 | scanf(" %s", inname); 11 | 12 | FILE *input = fopen(inname, "r"); 13 | 14 | char outname[128]; 15 | snprintf(outname, 128, "tr_%s", inname); 16 | 17 | FILE *output = fopen(outname, "w+"); 18 | 19 | char ch; 20 | do { 21 | ch = getc(input); // Get character from input file. 22 | if (ch != '\n' && ch != '\t') { 23 | putc(ch, output); // Put if not a space, next line or return. 24 | } 25 | } while (ch != EOF); 26 | 27 | fclose(input); 28 | fclose(output); 29 | 30 | return 0; 31 | 32 | } -------------------------------------------------------------------------------- /CN Lab/Concurrent Server/files/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | // Typedefs 24 | 25 | typedef enum { NO, YES } BOOL; 26 | 27 | typedef struct sockaddr_in sockaddr_in_t; 28 | typedef struct sockaddr sockaddr_t; 29 | typedef struct sockaddr * sockaddr_p_t; 30 | 31 | typedef char * string; 32 | 33 | // Defines 34 | 35 | #define MAX_LEN 65535 36 | 37 | #define BUFLEN 65535 38 | 39 | #define PORT 42069 40 | 41 | #endif -------------------------------------------------------------------------------- /CN Lab/TCP Client Server/exeggute/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | // Typedefs 24 | 25 | typedef enum { NO, YES } BOOL; 26 | 27 | typedef struct sockaddr_in sockaddr_in_t; 28 | typedef struct sockaddr sockaddr_t; 29 | typedef struct sockaddr * sockaddr_p_t; 30 | 31 | typedef char * string; 32 | 33 | // Defines 34 | 35 | #define MAX_LEN 65535 36 | 37 | #define BUFLEN 65535 38 | 39 | #define PORT 11373 40 | 41 | #endif -------------------------------------------------------------------------------- /DBMS Lab/ER Diagram to tables SQL/lab5-11-15.sql: -------------------------------------------------------------------------------- 1 | # 11 2 | 3 | select fname, lname 4 | from XEmployee 5 | where sssn is null; 6 | 7 | # 12 8 | 9 | select fname, lname 10 | from XEmployee, XDependent 11 | where XEmployee.ssn = XDependent.essn and XEmployee.sex = XDependent.sex and XEmployee.lname = XDependent.dname; 12 | 13 | # 13 14 | 15 | select fname, lname 16 | from XEmployee 17 | where ssn not in (select essn from XDependent); 18 | 19 | # 14 20 | 21 | select fname, lname 22 | from XEmployee 23 | where ssn in (select essn from XDependent) and ssn in (select mssn from XDepartment); 24 | 25 | # 15 26 | 27 | select ssn 28 | from XEmployee 29 | where ssn in (select essn from XWorksOn where pno between 701 and 703); -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/BinarySearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int arr[100], n, ele, pos, i, low, mid, high; 6 | printf("Enter size of array\n"); 7 | scanf("%d", &n); 8 | printf("Enter sorted array\n"); 9 | for (i=0; i arr[mid]) 27 | { 28 | low = mid; 29 | } 30 | else 31 | { 32 | high = mid; 33 | } 34 | } 35 | printf("Element is at %d position\n", pos); 36 | } 37 | -------------------------------------------------------------------------------- /MP Lab/Loope/SORT.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | arr db 05h, 08h, 03h, 02h, 01h, 09h, 07h, 04h 3 | siz equ 7 4 | data ends 5 | 6 | code segment 7 | assume cs:code, ds:data 8 | start: mov ax, data 9 | mov ds, ax 10 | 11 | mov dx, siz 12 | 13 | oloop: 14 | mov cx, dx 15 | lea si, arr 16 | 17 | iloop: 18 | mov al, [si] 19 | cmp al, [si + 1] 20 | jl eloop 21 | xchg al, [si + 1] 22 | mov [si], al 23 | eloop: 24 | add si, 1 25 | loop iloop; 26 | dec dx 27 | jnz oloop; 28 | 29 | mov ah, 4ch 30 | int 21h 31 | 32 | code ends 33 | end start 34 | -------------------------------------------------------------------------------- /MP Lab/Loope/PRIME.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a db 2,9 3 | list db 5 dup(0) 4 | count equ 1 5 | data ends 6 | 7 | code segment 8 | assume cs:code,ds:data 9 | start: 10 | mov ax,data 11 | mov ds,ax 12 | lea di,list 13 | mov bh,a 14 | 15 | do1:add bh,1 16 | cmp bh,a+1 17 | je fnsh 18 | mov bl,count 19 | 20 | do2:add bl,1 21 | cmp bl,bh 22 | je do3 23 | mov ah,0 24 | mov al,bh 25 | div bl 26 | cmp ah,0 27 | je do1 28 | jne do2 29 | 30 | do3:mov [di],bh 31 | inc di 32 | jmp do1 33 | 34 | fnsh:mov ah,4ch 35 | int 21h 36 | code ends 37 | end start 38 | -------------------------------------------------------------------------------- /MP Lab/Loope/SORT1.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | arr db 05h, 08h, 03h, 02h, 01h, 09h, 07h, 04h 3 | siz db 08h 4 | data ends 5 | 6 | code segment 7 | assume cs: code, ds: data; 8 | start: mov ax, data; 9 | mov ds, ax; 10 | 11 | lea si, arr; 12 | mov dl, siz; 13 | 14 | mov ch, 07h; 15 | mov cl, 00h; 16 | 17 | inc si; 18 | 19 | oloop: 20 | mov dh, [si]; 21 | mov cl, ch; 22 | 23 | iloop: 24 | dec cl; 25 | jz ile; 26 | 27 | cmp dh, cl[si]; 28 | jng ile; 29 | 30 | mov cl[si + 1], cl[si]; 31 | jmp iloop; 32 | 33 | ile: 34 | mov cl[si], dh 35 | 36 | inc si 37 | dec ch; 38 | 39 | jnz oloop; 40 | 41 | mov ah, 4ch; 42 | int 21h; 43 | code ends 44 | end start; -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab7/prog3client.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | struct msg 9 | { 10 | long mtype; 11 | char c[100]; 12 | }; 13 | 14 | int main() 15 | { 16 | int qt; 17 | struct msg m; 18 | qt = msgget(1271, 0); 19 | if(qt < 0) 20 | { 21 | perror("Error getting message\n"); 22 | } 23 | printf("Message init\n"); 24 | printf("Enter a message\n"); 25 | scanf("%s", m.c); 26 | m.mtype = 1; 27 | if(msgsnd(qt, &m, sizeof(struct msg),0) < 0) 28 | { 29 | perror("Message send error\n"); 30 | } 31 | printf("Message sent\n"); 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /OS Lab/System Calls/orphan.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main (int argc, const char * argv []) { 8 | 9 | pid_t pid; 10 | int status; 11 | 12 | pid = fork(); 13 | 14 | if (pid == 0) { 15 | 16 | // Child... 17 | 18 | printf("Child [%d] here, parent [%d] alive\n", getpid(), getppid()); 19 | 20 | sleep(5); 21 | 22 | printf("Child [%d] orphan now, adopted by the root process [%d]\n", getpid(), getppid()); 23 | 24 | exit(0); 25 | 26 | } else { 27 | 28 | // Parent... 29 | 30 | printf("Parent [%d] here\n", getpid()); 31 | 32 | sleep(2); 33 | 34 | printf("Parent dieded\n"); 35 | 36 | exit(0); 37 | 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /CD Lab/Another Parser/README.MD: -------------------------------------------------------------------------------- 1 | # Simple C like parser 2 | 3 | Parser for the grammer: 4 | 5 | ``` 6 | start -> SUBSTRACT idnum from_clause 7 | idnum -> term, idnum | term 8 | term -> id | num 9 | from_clause -> FROM identifier 10 | identifier -> id, identifier | id 11 | ``` 12 | 13 | ### Usage 14 | 15 | - `make` 16 | - Input in any file, say `temp.c` 17 | - Run `./notclang temp.c` 18 | - Build and execute `rdparser.c` 19 | 20 | ### Sample Input 21 | 22 | ``` 23 | >> cat temp.c 24 | SUBSTRACT 100, 120, 140, nope FROM beats, balls, apple 25 | ``` 26 | 27 | #### Lexer (notclang) output 28 | 29 | ``` 30 | <,> <,> <,> <,> <,> 31 | ``` 32 | 33 | #### Parser output 34 | 35 | ``` 36 | TBA 37 | ``` -------------------------------------------------------------------------------- /CD Lab/Scanning/discard_blanks.c: -------------------------------------------------------------------------------- 1 | // Discard blanks from a file 2 | 3 | #include 4 | #include 5 | 6 | int main (int argc, const char * argv []) { 7 | 8 | char inname[128]; 9 | printf("Enter input filename: "); 10 | scanf(" %s", inname); 11 | 12 | FILE *input = fopen(inname, "r"); 13 | 14 | char outname[128]; 15 | snprintf(outname, 128, "sr_%s", inname); 16 | 17 | FILE *output = fopen(outname, "w+"); 18 | 19 | char ch; 20 | do { 21 | ch = getc(input); // Get character from input file. 22 | if (ch != ' ' && ch != '\n' && ch != '\r') { 23 | putc(ch, output); // Put if not a space, next line or return. 24 | } 25 | } while (ch != EOF); 26 | 27 | fclose(input); 28 | fclose(output); 29 | 30 | return 0; 31 | 32 | } -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/Week1Sub/BinarySearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main() 4 | { 5 | int arr[100], n, ele, pos, i, low, mid, high; 6 | printf("Enter size of array\n"); 7 | scanf("%d", &n); 8 | printf("Enter sorted array\n"); 9 | for (i=0; i arr[mid]) 27 | { 28 | low = mid; 29 | } 30 | else 31 | { 32 | high = mid; 33 | } 34 | } 35 | printf("Element is at %d position\n", pos); 36 | } 37 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab7/prog3server.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | struct msg 9 | { 10 | long mtype; 11 | char c[100]; 12 | }; 13 | 14 | int main() 15 | { 16 | int qt; 17 | struct msg m; 18 | qt = msgget(1271, IPC_CREAT | IPC_EXCL | 0600); 19 | if(qt < 0) 20 | { 21 | perror("Error in getting message\n"); 22 | } 23 | printf("Message queue created\n"); 24 | if(msgrcv(qt, &m, sizeof(struct msg), 0, 0) < 0) 25 | { 26 | perror("Message receive error"); 27 | } 28 | printf("Message received\t%s\n", m.c); 29 | msgctl(qt, IPC_RMID, NULL); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /Scripts/sublime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | wget 'https://download.sublimetext.com/sublime_text_3_build_3114_x64.tar.bz2' 4 | mv 'sublime_text_3_build_3114_x64.tar.bz2' 'sublime.tar.bz2' 5 | tar jxf sublime.tar.bz2 6 | mkdir ~/.sublime 7 | mv sublime_text_3/* ~/.sublime 8 | echo "alias subl='~/.sublime/sublime_text'" >> ~/.bashrc 9 | rm sublime.tar.bz2 10 | rmdir sublime_text_3/ 11 | echo "------------------------------------" 12 | echo "Use 'subl' for sublime text. Open a new terminal, this will close now." 13 | sleep 2 14 | 15 | # Copy the following line (Uncommented) and paste it in the terminal to install sublime_text_3 in one go 16 | 17 | # $(wget 'https://raw.githubusercontent.com/mitcse/CSE-Labs/master/Scripts/sublime.sh') sh sublime.sh && rm sublime.sh && exit -------------------------------------------------------------------------------- /CN Lab/Concurrent Server/time/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include 24 | 25 | // Typedefs 26 | 27 | typedef enum { NO, YES } BOOL; 28 | 29 | typedef struct sockaddr_in sockaddr_in_t; 30 | typedef struct sockaddr sockaddr_t; 31 | typedef struct sockaddr * sockaddr_p_t; 32 | 33 | typedef char * string; 34 | 35 | // Defines 36 | 37 | #define BUFLEN 1024 38 | 39 | #define PORT 21094 40 | 41 | #define SERVER "127.0.0.1" 42 | 43 | #endif -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab6/prog1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | int size, n, waste=0, i=0, t=0, sum=0, n1=0; 7 | int *p; 8 | printf("Enter the distribution size "); 9 | scanf("%d", &size); 10 | printf("Enter no. of Blocks :"); 11 | scanf("%d", &n); 12 | p=(int *)calloc(n, sizeof(int)); 13 | while(n1(size/n)) 19 | { 20 | printf("Cannot be allocated\n"); 21 | t--; 22 | continue; 23 | } 24 | sum+=p[i-1]; 25 | n1++; 26 | } 27 | waste=size-sum; 28 | printf("Total Memory Allocated %d Internal Fragmentation %d\n", sum, waste); 29 | return 0; 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /CN Lab/Synchronous IO Multiplexing/echo/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include 24 | 25 | // Typedefs 26 | 27 | typedef enum { NO, YES } BOOL; 28 | 29 | typedef struct sockaddr_in sockaddr_in_t; 30 | typedef struct sockaddr sockaddr_t; 31 | typedef struct sockaddr * sockaddr_p_t; 32 | 33 | typedef char * string; 34 | 35 | // Defines 36 | 37 | #define BUFLEN 1024 38 | 39 | #define PORT 20134 40 | 41 | #define SERVER "127.0.0.1" 42 | 43 | #endif -------------------------------------------------------------------------------- /CN Lab/Synchronous IO Multiplexing/time/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include 24 | 25 | // Typedefs 26 | 27 | typedef enum { NO, YES } BOOL; 28 | 29 | typedef struct sockaddr_in sockaddr_in_t; 30 | typedef struct sockaddr sockaddr_t; 31 | typedef struct sockaddr * sockaddr_p_t; 32 | 33 | typedef char * string; 34 | 35 | // Defines 36 | 37 | #define BUFLEN 1024 38 | 39 | #define PORT 20134 40 | 41 | #define SERVER "127.0.0.1" 42 | 43 | #endif -------------------------------------------------------------------------------- /DBMS Lab/PL Cursors And Exceptions/04.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE salary_raise; 2 | CREATE TABLE salary_raise (iid varchar(5), rdate date, amt number(8,2)); 3 | 4 | set serveroutput on; 5 | 6 | DECLARE 7 | temp instructor%ROWTYPE; 8 | dname varchar2(20) := 'Biology'; 9 | CURSOR curse IS SELECT * FROM instructor WHERE dept_name = dname; 10 | raiset number(8,2); 11 | 12 | BEGIN 13 | OPEN curse; 14 | 15 | LOOP 16 | FETCH curse INTO temp; 17 | EXIT WHEN curse%notfound; 18 | UPDATE instructor SET salary = salary * 1.05 WHERE dept_name = dname; 19 | raiset := temp.salary * 0.05; 20 | INSERT INTO salary_raise VALUES (temp.id, (SELECT sysdate FROM dual), raiset); 21 | END loop; 22 | 23 | CLOSE curse; 24 | end; 25 | / 26 | 27 | SELECT * FROM salary_raise; -------------------------------------------------------------------------------- /OOP Lab/Basics/Armstrong.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class Armstrong { 3 | static boolean isArmstrong(int n) { 4 | if (n == sumDigitsCube(n)) 5 | return true; 6 | return false; 7 | } 8 | static int sumDigitsCube(int n) { 9 | if (n == 0) 10 | return 0; 11 | return (int)Math.pow(n%10, 3) + sumDigitsCube(n/10); 12 | } 13 | public static void main(String []args) { 14 | Scanner sc = new Scanner (System.in); 15 | System.out.print("This program will check if the inputted number is an Armstrong number or not.\n\n\tEnter a number: "); 16 | int n = sc.nextInt(); 17 | if (isArmstrong(n)) 18 | System.out.println("\n\t"+n+" is an Armstrong number. :)\n\n"); 19 | else 20 | System.out.println("\n\t"+n+" is not an Armstrong number. :(\n\n"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CN Lab/Synchronous IO Multiplexing/group chat/common.h: -------------------------------------------------------------------------------- 1 | // ... 2 | 3 | // Includes 4 | 5 | #ifndef COMMON_H 6 | #define COMMON_H 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include 24 | 25 | // Typedefs 26 | 27 | typedef enum { NO, YES } BOOL; 28 | 29 | typedef struct sockaddr_in sockaddr_in_t; 30 | typedef struct sockaddr sockaddr_t; 31 | typedef struct sockaddr * sockaddr_p_t; 32 | 33 | typedef char * string; 34 | 35 | // Defines 36 | 37 | #define BUFLEN 1024 38 | 39 | #define PORT 44444 40 | 41 | #define SERVER "127.0.0.1" 42 | 43 | #endif -------------------------------------------------------------------------------- /MP Lab/Loope/DESRT.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | arr db 01h, 02h, 05h, 06h, 07h, 08h 3 | num db 05h 4 | siz dw 06h 5 | data ends 6 | 7 | code segment 8 | assume cs:code, ds:data 9 | start: mov ax, data 10 | mov ds, ax 11 | 12 | lea si, arr 13 | mov dl, num 14 | mov dh, 00; 15 | 16 | ploop: 17 | cmp dl, [si] 18 | je del 19 | inc si 20 | jmp ploop; 21 | 22 | del: 23 | mov dx, si; 24 | lea si, arr 25 | sub dx, si; 26 | mov cx, siz; 27 | sub cx, dx; 28 | add si, dx 29 | 30 | dloop: 31 | mov al, [si + 1] 32 | xchg [si], al 33 | inc si 34 | dec cx 35 | jnz dloop 36 | and al, 00h 37 | mov [si], al 38 | 39 | mov ah, 4ch 40 | int 21h 41 | code ends 42 | end start -------------------------------------------------------------------------------- /MP Lab/Proceudres and Macros/MUL.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a dw ? 3 | b dw ? 4 | p dw ?, ? 5 | data ends 6 | 7 | stck segment stack 8 | dw 100 dup(0) 9 | tos label word 10 | stck ends 11 | 12 | code segment 13 | assume cs:code, ds:data, ss:stck 14 | start: 15 | mov ax, data; 16 | mov ds, ax; 17 | mov ax, stck; 18 | mov ss, ax; 19 | 20 | lea sp, tos; 21 | 22 | mov ax, a; 23 | push ax; 24 | mov ax, b; 25 | push ax; 26 | 27 | call multiply; 28 | mov p, ax; 29 | mov p + 2, dx; 30 | 31 | mov ah, 4ch; 32 | int 21h; 33 | 34 | multiply proc near 35 | pop cx; 36 | pop ax; 37 | pop bx; 38 | mul bx; 39 | push cx; 40 | ret; 41 | multiply endp 42 | 43 | code ends 44 | end start 45 | 46 | -------------------------------------------------------------------------------- /MP Lab/Introduction to MASM/DIV32_8.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | a0 dw ?; lower word of number 3 | a1 dw ?; higher word of number 4 | b db ?; byte 5 | quo dw ? 6 | rem dw ? 7 | data ends 8 | 9 | code segment 10 | assume ds: data, cs: code 11 | start: mov ax, data 12 | mov ds, ax 13 | 14 | mov ax, 0000h; clear ax 15 | mov al, b; move the byte to al 16 | cbw; convery byte to word 17 | mov bx, ax; copy newly formed word to bx 18 | mov ax, a0; copy the lower word of dividend to ax 19 | mov dx, a1; copy the higher word of dividend to dx 20 | xor dx, dx; prevents overflow (maybe?) 21 | idiv bx; signed divide dx:ax by bx; 22 | mov quo, ax; copy quotient to quo 23 | mov rem, dx; copy remainder to rem 24 | 25 | mov ah, 4ch 26 | int 21h 27 | code ends 28 | end start -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab2/scr1.sh: -------------------------------------------------------------------------------- 1 | echo This shell script answers questions 1 to 7 of OS lab 2 2 | echo 3 | # list all files 4 | ls 5 | echo 6 | # list all files starting with a or A 7 | ls [aA]* 8 | echo 9 | # count number of logged in users 10 | who -q 11 | echo 12 | # count number of files in current directory 13 | ls | wc -l 14 | echo 15 | # echo date with string 16 | echo The date today is Fri Aug 12 21:24:05 IST 2016 17 | echo 18 | # run date ls pwd 19 | date; ls; pwd 20 | echo 21 | # display output ofa compiled program 22 | ./prog1 23 | echo 24 | # run exec file in bg with i/o redirect 25 | ./prog2 < prog2input.txt > prog2output.txt & 26 | echo question 8 done check prog2output text file 27 | echo 28 | # simulate grep 29 | # ./a.out inputfile pattern 30 | ./prog9 prog2output.txt Enter 31 | echo 32 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab11/prog1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | int queue[20], n, head, i, j, k, seek=0, max, diff; 7 | float aver; 8 | printf("Max disk range?\n"); 9 | scanf("%d", &max); 10 | printf("Queue request size?\n"); 11 | scanf("%d", &n); 12 | printf("Queue?\n"); 13 | for(i=1; i<=n; i++) 14 | scanf("%d", &queue[i]); 15 | printf("Initial head at?\n"); 16 | scanf("%d", &head); 17 | queue[0] = head; 18 | for(j=0; j<=n-1; j++) 19 | { 20 | diff = abs(queue[j+1]-queue[j]); 21 | seek += diff; 22 | printf("From %d to %d with seek %d\n", queue[j], queue[j+1], diff); 23 | } 24 | printf("total seek time = %d\n", seek); 25 | aver = seek/(float)n; 26 | printf("average seek time = %.2f\n", aver); 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /OS Lab/Semaphores and Named Pipes/prod cons fifo/consumer.c: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | 3 | int main(int argc, char const * argv []) { 4 | 5 | int pipe_fd; 6 | int res; 7 | 8 | char buffer[BUFFER_SIZE + 1]; 9 | int bytes_read = 0; 10 | 11 | memset(buffer, '\0', sizeof(buffer)); 12 | printf("Process %d opening FIFO O_RDONLY\n", getpid()); 13 | pipe_fd = open(FIFO_NAME, O_RDONLY); 14 | printf("Process %d result %d\n", getpid(), pipe_fd); 15 | 16 | if (pipe_fd != -1) { 17 | do { 18 | res = read(pipe_fd, buffer, BUFFER_SIZE); 19 | bytes_read += res; 20 | } while (res > 0); 21 | (void)close(pipe_fd); 22 | } 23 | else 24 | { 25 | exit(EXIT_FAILURE); 26 | } 27 | printf("Process %d finished, %d bytes read\n", getpid(), bytes_read); 28 | exit(EXIT_SUCCESS); 29 | 30 | 31 | return 0; 32 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog4.v: -------------------------------------------------------------------------------- 1 | module prog4 (b, g); 2 | input [3:0] b; 3 | output [3:0] g; 4 | wire [3:0] w0, w1, w2; 5 | wire [1:0] m; 6 | assign m[1] = b[3], m[0] = b[2]; 7 | assign w2[0] = 0, w2[1] = b[1]|b[0], w2[2] = 1, w2[3] = 1; 8 | assign w1[0] = 0, w1[1] = b[1]|(~b[0]), w1[2] = 1, w1[3] = 1; 9 | assign w0[0] = b[1], w0[1] = ~(b[1])&b[0], w0[2] = 1, w0[3] = 1; 10 | mux4_1 m0 (w2, m, g[3]); 11 | mux4_1 m1 (w1, m, g[2]); 12 | mux4_1 m2 (w0, m, g[1]); 13 | assign g[0] = b[0]; 14 | endmodule 15 | 16 | module mux4_1 (w, t, f); 17 | input [3:0] w; 18 | input [1:0] t; 19 | output f; 20 | reg f; 21 | always @(w or t) 22 | if(t == 0) 23 | f = w[0]; 24 | else if (t == 1) 25 | f = w[1]; 26 | else if (t == 2) 27 | f = w[2]; 28 | else 29 | f = w[3]; 30 | endmodule 31 | -------------------------------------------------------------------------------- /OS Lab/System Calls/zombie.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char const *argv[]) { 8 | 9 | pid_t pid = fork(); 10 | int status; 11 | 12 | if (pid == 0) { 13 | 14 | printf("\tIn child process [%d]...\n", getpid()); 15 | sleep(6); 16 | 17 | printf("\tchild [%d] ps output:\n", getpid()); 18 | system("ps"); 19 | 20 | sleep(3); 21 | printf("\tChild [%d] quitting.\n", getpid()); 22 | 23 | exit(0); 24 | return 0; 25 | 26 | } else { 27 | 28 | printf("Parent process here [%d]...\n", getpid()); 29 | sleep(3); 30 | 31 | printf("parent [%d] ps output:\n", getpid()); 32 | system("ps"); 33 | 34 | printf("Parent [%d] quitting.\n", getpid()); 35 | } 36 | return 0; 37 | } -------------------------------------------------------------------------------- /DS Lab/DS Lab programs by week/Week 1/SelectionSort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void SelSort(int arr[], int size) 4 | { 5 | int pos, i, j, temp; 6 | for (i=0; i arr[i]) 12 | { 13 | pos = j; 14 | } 15 | } 16 | temp = arr[pos]; 17 | arr[pos] = arr[i]; 18 | arr[i] = temp; 19 | } 20 | printf("Sorted array is "); 21 | for (i=0; i 1 THEN 18 | raise EXC; 19 | END if; 20 | 21 | DBMS_OUTPUT.PUT_LINE('Name: '|| name); 22 | 23 | EXCEPTION 24 | WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE('No associated instructor'); 25 | WHEN TOO_MANY_ROWS THEN DBMS_OUTPUT.PUT_LINE('Ambiguous data.'); 26 | WHEN EXC THEN DBMS_OUTPUT.PUT_LINE('1 instructor, multiple depts'); 27 | 28 | END; 29 | / -------------------------------------------------------------------------------- /OOP Lab/Input Output/Copy4.java: -------------------------------------------------------------------------------- 1 | // 2 | // Copy4.java 3 | // Copies the contents of a input file to output file passed as argument 4 | // 5 | // 6 | // 7 | // 8 | 9 | 10 | import java.io.*; 11 | import java.util.Scanner; 12 | 13 | public class Copy4 { 14 | 15 | public static void main (String [] args) throws IOException, FileNotFoundException { 16 | 17 | File source = null; 18 | File dest = null; 19 | 20 | Scanner fs = null; 21 | PrintWriter pw = null; 22 | 23 | try { 24 | 25 | source = new File(args[0]); 26 | dest = new File(args[1]); 27 | 28 | fs = new Scanner(source); 29 | pw = new PrintWriter(dest); 30 | 31 | while(fs.hasNextLine()) { 32 | pw.println(fs.nextLine()); 33 | } 34 | 35 | } 36 | finally { 37 | fs.close(); 38 | pw.close(); 39 | } 40 | 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /OOP Lab/Interfaces and Exception Handling/Stack/DynamicStack.java: -------------------------------------------------------------------------------- 1 | // 2 | // DynamicStack.java 3 | // 4 | // Created by Avikant Saini on 10/3/15 5 | // 6 | 7 | import java.util.Scanner; 8 | 9 | class DynamicStack implements Stack { 10 | 11 | int arr[], tos; 12 | 13 | public DynamicStack () { 14 | arr = new int[4]; 15 | tos = -1; 16 | } 17 | 18 | public void push (int item) { 19 | 20 | if (tos == arr.length - 1) { 21 | int newArr[] = new int[2 * arr.length]; 22 | for (int i = 0; i < arr.length; ++i) 23 | newArr[i] = arr[i]; 24 | arr = newArr; 25 | newArr = null; 26 | } 27 | arr[++tos] = item; 28 | } 29 | 30 | public int pop () { 31 | if (tos == -1) { 32 | System.out.println("\n\tSTACK UNDERFLOW!\n"); 33 | return -32767; 34 | } 35 | return arr[tos--]; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /OOP Lab/Constructors/Counter.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Counter 4 | { 5 | static int countObjects = 0; 6 | 7 | static void showCount() 8 | { 9 | System.out.println("Number of static objects right now are " +countObjects); 10 | } 11 | 12 | Counter () 13 | { 14 | countObjects++; 15 | } 16 | 17 | public static void main(String args[]) 18 | { 19 | Counter c1 = new Counter(); 20 | showCount(); 21 | Scanner userEntry = new Scanner(System.in); 22 | char f; 23 | System.out.println("Do you want to keep adding classes? y/n"); 24 | f = userEntry.next().charAt(0); 25 | while (f == 'y') 26 | { 27 | Counter c = new Counter(); 28 | showCount(); 29 | System.out.println("Do you want to keep adding classes? y/n"); 30 | f = userEntry.next().charAt(0); 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /OOP Lab/Input Output/Copy5.java: -------------------------------------------------------------------------------- 1 | // 2 | // Copy4.java 3 | // Copies the contents of a input file to output file passed as argument 4 | // 5 | // 6 | // 7 | // 8 | 9 | 10 | import java.io.*; 11 | import java.util.Scanner; 12 | 13 | public class Copy4 { 14 | 15 | public static void main (String [] args) throws IOException, FileNotFoundException { 16 | 17 | File source = null; 18 | File dest = null; 19 | 20 | Scanner fs = null; 21 | PrintWriter pw = null; 22 | 23 | try { 24 | 25 | source = new File(args[0]); 26 | dest = new File(args[1]); 27 | 28 | fs = new Scanner(source); 29 | pw = new PrintWriter(dest); 30 | 31 | while(fs.hasNextLine()) { 32 | pw.println(fs.nextLine()); 33 | } 34 | 35 | } 36 | finally { 37 | fs.close(); 38 | pw.close(); 39 | } 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /CN Lab/Synchronous IO Multiplexing/select demo/select_demo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | fd_set rfds; 9 | struct timeval tv; 10 | int retval; 11 | 12 | /* Watch stdin (fd 0) to see when it has input. */ 13 | 14 | FD_ZERO(&rfds); 15 | FD_SET(0, &rfds); 16 | 17 | /* Wait up to five seconds. */ 18 | 19 | tv.tv_sec = 5; 20 | tv.tv_usec = 0; 21 | 22 | retval = select(1, &rfds, NULL, NULL, &tv); 23 | /* Don't rely on the value of tv now! */ 24 | 25 | if (retval == -1) 26 | perror("select()"); 27 | else if (retval) 28 | printf("Data is available now.\n"); 29 | /* FD_ISSET(0, &rfds) will be true. */ 30 | else 31 | printf("No data within five seconds.\n"); 32 | 33 | exit(EXIT_SUCCESS); 34 | } -------------------------------------------------------------------------------- /ALG Lab/Other/Nth Fibonacci/nth_fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | int fibonacci (int n) { 7 | if (n <= 2) return 1; 8 | return fibonacci(n-1) + fibonacci(n-2); 9 | } 10 | 11 | int main (int argc, const char * argv []) { 12 | 13 | clock_t st, et; 14 | double tt; 15 | 16 | FILE *outfile = fopen("fibonacci.csv", "w+"); 17 | 18 | fprintf(outfile, "Number, Time\n"); 19 | 20 | int i, k; 21 | 22 | for (k = 0; k < 40; ++k) { 23 | 24 | int x; 25 | 26 | st = clock(); 27 | 28 | for (i = 0; i < 50; ++i) { 29 | x = fibonacci(k); 30 | } 31 | 32 | et = clock(); 33 | 34 | printf("fibonacci(%d) = %d\n", k, x); 35 | 36 | tt = (double)(et - st)/CLOCKS_PER_SEC; 37 | 38 | fprintf(outfile, "%d, %.5lf\n", k, tt); 39 | 40 | } 41 | 42 | fclose(outfile); 43 | 44 | } -------------------------------------------------------------------------------- /MP Lab/Proceudres and Macros/COPY.ASM: -------------------------------------------------------------------------------- 1 | data segment 2 | str db 20, ?, 20 dup(0) 3 | str1 db 'pool.txt' 4 | blank db ? 5 | str2 db 'pooh.txt' 6 | data ends 7 | 8 | code segment 9 | assume cs:code, ds:data 10 | start: 11 | mov ax, data 12 | mov ds, ax 13 | mov es, ax 14 | 15 | mov dx, offset str1 16 | mov al, 0 17 | mov ah, 3dh 18 | int 21h 19 | 20 | mov bx, ax 21 | mov ax, 0 22 | mov ah, 3fh 23 | mov cx, 20 24 | mov dx, offset str 25 | int 21h 26 | 27 | mov dx, offset str 28 | mov ah, 09h 29 | int 21h 30 | 31 | lea dx, str2 32 | mov cx, 0 33 | mov ah, 3ch 34 | 35 | int 21h 36 | 37 | mov bx, ax 38 | mov cx, 20 39 | lea dx, str 40 | mov ah, 40h 41 | int 21h 42 | 43 | mov ah, 4ch 44 | int 21h 45 | 46 | code ends 47 | end start 48 | -------------------------------------------------------------------------------- /OS Lab/OS Lab By Week/lab1/prog3.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void sorting(int a[], int n); 4 | int main() 5 | { 6 | printf("Enter n\n"); 7 | int n; 8 | scanf("%d", &n); 9 | int *a; 10 | printf("Enter numbers\n"); 11 | for (int i=0; i 2 | 3 | void sorting(int a[], int n); 4 | int main() 5 | { 6 | printf("Enter n\n"); 7 | int n; 8 | scanf("%d", &n); 9 | int *a; 10 | printf("Enter numbers\n"); 11 | for (int i=0; i 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main() 8 | { 9 | int segment_id; 10 | char *shared_memory; 11 | const int size = 4096; 12 | segment_id = shmget(IPC_PRIVATE, size, S_IRUSR | S_IWUSR); 13 | shared_memory = (char *) shmat(segment_id, NULL, 0); 14 | sprintf(shared_memory, "Inter process communication demo"); 15 | pid_t pid = fork(); 16 | if (pid == 0) 17 | { 18 | printf("In child\n"); 19 | puts(shared_memory); 20 | shmdt(shared_memory); 21 | } 22 | else 23 | { 24 | printf("In parent\n"); 25 | puts(shared_memory); 26 | shmdt(shared_memory); 27 | } 28 | shmctl(segment_id, IPC_RMID, NULL); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /OS Lab/Shell Intro/grep.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main (int argc, char const * argv []) { 7 | FILE *fp; 8 | char fline[100]; 9 | char *newline; 10 | int i, count = 0, occ = 0; 11 | if (argc < 3) { 12 | printf("Not enough command line parameters given!\n"); 13 | return 3; 14 | } 15 | fp = fopen(argv[1], "r"); 16 | if (fp == NULL) { 17 | printf("File could not be opened, found or whatever, errno is %d\n",errno); 18 | return 3; 19 | } 20 | while (fgets(fline, 100, fp) != NULL) { 21 | count++; 22 | if (newline = strchr(fline, '\n')) 23 | *newline = '\0'; 24 | if (strstr(fline, argv[2]) != NULL) { 25 | printf("%s %d %s\n", argv[1], count, fline); 26 | occ++; 27 | } 28 | } 29 | printf("\n\tOccurence= %d\n", occ); 30 | 31 | return 1; 32 | } -------------------------------------------------------------------------------- /DBMS Lab/Constraints and Dates/lab4-4.sql: -------------------------------------------------------------------------------- 1 | 2 | insert into Department2 values ('1', 'Sniffing', 'NY'); 3 | insert into Department2 values ('2', 'Enforcement', 'NY'); 4 | insert into Department2 values ('4', 'Admin', 'NY'); 5 | insert into Department2 values ('6', 'Field', 'NY'); 6 | insert into Department2 values ('9', 'AnalogInterface', 'NY'); 7 | 8 | insert into Employee values ('001', 'Finch', 'M', '900000', 'Not Determined', '4'); 9 | insert into Employee values ('002', 'Reese', 'M', '650000', 'Address 2', '6'); 10 | insert into Employee values ('003', 'Shaw', 'F', '650000', 'Address 4', '6'); 11 | insert into Employee values ('004', 'Root', 'F', '800000', 'Address 3', '9'); 12 | insert into Employee values ('005', 'Fusco', 'M', '500000', 'Address 6', '2'); 13 | insert into Employee values ('006', 'Bear', 'M', '200000', 'Address 7', '1'); -------------------------------------------------------------------------------- /DS Lab/Basic Programs/NestStrUnion.c: -------------------------------------------------------------------------------- 1 | // NestStrUnion.c 2 | // Created by @avikantz on 08/11/15 3 | 4 | #include 5 | 6 | typedef struct Date { 7 | int dd, mm, yyyy, hh, mm; 8 | } DATE_t; 9 | 10 | typedef struct Episode { 11 | char *name; 12 | char *summary; 13 | DATE_t *airDate; 14 | } EPISODE_t; 15 | 16 | typedef union Person { 17 | char *name; 18 | char *quote; 19 | } PERSON_t; 20 | 21 | typedef struct TVShow { 22 | char *name; 23 | EPISODE_t *episodes; 24 | DATE_t *premieredDate; 25 | PERSON_t *showCreator; 26 | }; 27 | 28 | int main (int argc, const char *argv[]) { 29 | TVShow *show; 30 | show.name = "Angel"; 31 | show.episodes = [{"City Of", "1x01", {5, 10, 1999, 10, 30}}, 32 | {"Not Fade Away", "5x22", {19, 05, 2004, 10, 30}}]; 33 | show.showCreator = {"Joss Whedon", "*insert Joss Whedon quote*"}; 34 | return 0; 35 | } -------------------------------------------------------------------------------- /SCLD Lab/Lab 07/prog2_1.v: -------------------------------------------------------------------------------- 1 | module prog2_1 (inp, out); 2 | input [3:0] inp; // A, B, C, D; 3 | output out; 4 | wire [3:0] w1, w2; 5 | wire [1:0] o1; 6 | assign w1[0] = 0, w1[1] = 1, w1[2] = inp[2], w1[3] = ~inp[2]; 7 | assign w2[0] = 0, w2[1] = ~inp[2], w2[2] = 0, w2[3] = ~inp[2]; 8 | mux4_1 m1 (w1, inp[1:0], o1[0]); 9 | mux4_1 m2 (w2, inp[1:0], o1[1]); 10 | mux2_1 m3 (o1, inp[3], out); 11 | endmodule 12 | 13 | 14 | module mux4_1 (w, t, f); 15 | input [3:0] w; 16 | input [1:0] t; 17 | output f; 18 | reg f; 19 | always @(w or t) 20 | if(t == 0) 21 | f = w[0]; 22 | else if (t == 1) 23 | f = w[1]; 24 | else if (t == 2) 25 | f = w[2]; 26 | else 27 | f = w[3]; 28 | endmodule 29 | 30 | module mux2_1 (w, t, f); 31 | input [1:0] w; 32 | input t; 33 | output f; 34 | assign f = (t==1)?w[1]:w[0]; 35 | endmodule 36 | -------------------------------------------------------------------------------- /OOP Lab/Interfaces and Exception Handling/Stack/FixedStack.java: -------------------------------------------------------------------------------- 1 | // 2 | // FixedStack.java 3 | // 4 | // Created by Avikant Saini on 10/3/15 5 | // 6 | 7 | 8 | import java.util.Scanner; 9 | 10 | class FixedStack implements Stack { 11 | 12 | int arr[], tos; 13 | 14 | public FixedStack () { 15 | Scanner sc = new Scanner (System.in); 16 | System.out.print("\n\tEnter size of the fixed stack: "); 17 | int n = sc.nextInt(); 18 | arr = new int[n]; 19 | tos = -1; 20 | } 21 | 22 | public void push (int item) { 23 | 24 | if (tos == arr.length - 1) { 25 | System.out.println("\n\tSTACK OVERFLOW!!\n"); 26 | return; 27 | } 28 | arr[++tos] = item; 29 | } 30 | 31 | public int pop () { 32 | if (tos == -1) { 33 | System.out.println("\n\tSTACK UNDERFLOW!!\n"); 34 | return -32767; 35 | } 36 | return arr[tos--]; 37 | } 38 | 39 | } 40 | --------------------------------------------------------------------------------