Assignment 1 and 4 GOlang
Assignment 1 and 4 GOlang
Practical Session: -
1. Basic Programs using printf( ) & println ( ) – 5 Programs
2. Data Types Related Programs- At least 05 programs
3. Type Casting Related Programs- At Least 05 Programs
4. Program related to Constant & Variable declaration and its
types- (At least 02 Programs)
5. User input Related Programs- At least 02
6. Using Decision Making Statement
1) if statement – (05 Programs)
2) if-----else statement- (05 Programs)
3) nested if—else statement- (1 Programs)
4) switch-----case Statement- (03 Programs –Menu
Driven)
7. Using Looping Statements
1) While loop- (05 Programs)
2) Do---while - (05 Programs)
3) for loop - (05 programs)
8. Using Array - 1D (05 Programs)
9. Using String- (15 Programs)
10. Pointer – (05 Programs)
11. SET-A- (04 Programs)
12. SET-B- (05 Programs)
13. SET-C- (05 Programs)
SET C
1. WAP in go language to concatenate two strings using pointers.
2. WAP in go language to accept two strings and compare them.
3. WAP in go language to accept user choice and print answer of
using arithmetical operators.
4. WAP in go language to check whether accepted number is
single digit or not.
5. WAP in go language to check whether first string is substring of
another string or not.
SET A
1. WAP in go language to find the largest and
smallest number in an array.
2. WAP in go language to accept the book
details such as BookID, Title, Author, Price.
Read and display the details of n number of
books.
3. WAP in go language to Initialize a Slice
using Multi-Line Syntax and display
SET B
1. WAP in go language to create and print
multidimensional Slice.
2. WAP in go language to sort array elements
in ascending order.
3. WAP in go language to accept n student
details like roll_no, stud_name, mark1,mark2,
mark3. Calculate the total and average of
marks using structure.
SET C
1. WAP in go language to accept two matrices
and display it's multiplication.
2. WAP in go language to accept n records of
employee information (eno,ename,salary) and
display record of employees having maximum
salary.
3. WAP in go language to demonstrate
working of slices (like append, remove, copy
etc.)
Assignment 4
Method and Interface
(Page no 45 to 67)
Function: -
1. Go program to illustrate the use of function.
Method: -
2. Go program to illustrate the method with struct
type receiver.
3. Method with a receiver of author type.
4. Method with Non-Struct Type Receiver.
5. Method with Pointer Receiver
6. Method Can Accept both Pointer and
Value.
7. Method with a value receiver of author
type.
8. Functions that return multiple values.
9. Giving Name to the Return Values.
10. Pointer and Value Receivers.
11. Difference between the value Receiver
and Pointer receiver. (01)
Value receiver makes a copy of the type and pass
it to the function.
The function stack now holds an equal object but
at a different location on memory.
That means any changes done on the passed
object will remain local to the method.
The original object will remain unchanged.
Pointer receiver passes the address of a type to
the function.
The function stack has a reference to the original
object.
So any modifications on the passed object will modify
the original object.
12. Functions that accept other functions as
parameters:
Interface
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
SET A
1. Write a program in go language to create an
interface shape that includes area and
perimeter. Implements these methods in circle
and rectangle type.
2. Write a program in go language to print
multiplication of two numbers using method.
3. Write a program in go language to create
structure author. Write a method show ()
whose receiver is struct author.
SET B
1. Write a program in go language to create
structure student. Write a method show ()
whose receiver is a pointer of struct student.
2. Write a program in go language to
demonstrate working type switch in interface.
3. Write a program in go language to copy all
elements of one array into another using
method.
SET C
1. Write a program in go language to create an
interface and display its values with the help
of type assertion.
2. Write a program in go language to store n
student information (rollno, name, percentage)
and write a method to display student
information in descending order of percentage.
3. Write a program in go language to
demonstrate working embedded interfaces.