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

Interview

The document contains various programming tasks and code snippets in C and Java, covering topics such as sorting algorithms, Armstrong numbers, minimum spanning trees, and string comparisons. It also includes a birthday greeting program in Python that creatively presents messages and decorations. Overall, it showcases different programming concepts and implementations across multiple languages.

Uploaded by

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

Interview

The document contains various programming tasks and code snippets in C and Java, covering topics such as sorting algorithms, Armstrong numbers, minimum spanning trees, and string comparisons. It also includes a birthday greeting program in Python that creatively presents messages and decorations. Overall, it showcases different programming concepts and implementations across multiple languages.

Uploaded by

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

OOP

Aptitude(reasoning)
Technical written interview -> Petterns, logical(string,Array,matrix)
Technical interview(OOP(full), DBMS)
Non-Technical -> GD, Debate

#include<stdio.h>

void main()
{
int n,temp=0,x,mid=0,flag=0;
printf("Enter the size of array : ");
scanf("%d",&n);

int a[n];
for (int i=0; i<n; i++)
{
scanf("%d",&a[i]);
}
for (int i = 0; i < n; i++)
{
for(int j=i+1; j<=n; j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for (int i = 0; i < n; i++)
{
printf("%d->",a[i]);
}
printf("\n\n\n");
printf("Enter the element to find in array : ");
scanf("%d",&x);

int j=n;

for (int i=0; i<n; i++)


{
mid=j/2;
if(x==a[mid])
{
flag=1;
}
else if(x<a[mid])
{
j=mid-1;
}
else if(x>a[mid])
{
j=mid+1;
}
}
if(flag==1)
{
printf("%d is present in array.",x);
}
else
{
printf("%d is not present in array.",x);
}
}

-----------------------------------------------------------------------------------
------------------------------------------------

import java.util.*;

public class Main


{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter The number : ");
int n=sc.nextInt();
int count=0,x=n,b=0,p=1,y=n;
while(x!=0)
{
x=x/10;
count+=1;
}

while(n!=0)
{
a=n%10;
for(int i=0; i<count; i++)
{
p=p*a;
}
b=b+p;
n=n/10;
}
if(b==y)
{
System.out,print("Number is armstrong");
}
else
{
System.out,print("Number is not armstrong");
}
}
}

-----------------------------------------------------------------------------------
-------------

#include<stdio.h>

int a,b,u,v,n,i,j,ne=1;
int visited[10]={0},min,mincost=0,cost[10][10];

void main()
{
printf("\nEnter the number of nodes : ");
scanf("%d",&n);
printf("\nEnter the edjacency matrix : \n");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d",&cost[i][j]);
if(cost[i][j]==0)
{
cost[i][j]=999;
}
visited[1]=1;
printf("\n");
while(ne<n)
{
for(i=1,min=999;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(cost[i][j]<min)
{
if(visited[i]!=0)
{
min=cost[i][j];
a=u=i;
b=v=j;
}
}
}
}
if(visited[u]==0 || visited[v]==0)
{
printf("\n Edge %d :(%d %d) cost:%d",ne++,a,b,min);
mincost+=min;
visited[b]=1;
}
cost[a][b]=cost[b][a]=999;
}
printf("\n Minimum cost = %d \n",mincost);
}
}
}

-----------------------------------------------------------------------------------
-------------------------

#include<stdio.h>

void main()
{
int IT,T,AM,t,c;
printf("Enter IT : ");
scanf("%d",&IT);
printf("Enter T : ");
scanf("%d",&T);
printf("Enter AM : ");
scanf("%d",&AM);

t=(IT+T+AM)/3;
c=T-IT;

if(t<=20 && t>=10)


{
printf("Light is Green %d",c*AM);
}
else if(t<=50 && t>=21)
{
printf("Light is Yellow %d",c*AM);
}
else if(t<=51 && t>=70)
{
printf("Light is Red %d",c*AM);
}
}

-----------------------------------------------------------------------------------
---

#include<stdio.h>
#include<string.h>

void main()
{
char str1[100],str2[100];
int count1=0,count2=0,len1=0,len2=0;

printf("Enter the string : ");


scanf("%s",str1);
printf("Enter the string : ");
scanf("%s",str2);
len1 = strlen(str1);
len2 = strlen(str2);
printf("%d\n",len1);
printf("%d\n\n",len2);

for(int i=0; i<len1; i++)


{
count1+=1;
}

for(int i=0; i<len2; i++)


{
count2+=1;
}

if(count1>count2)
{
printf("String 1 is largest.");
}
else if(count1==count2)
{
printf("Both strings are same.");
}
else
{
printf("String 2 is largest.");
}
}
-----------------------------------------------------------------

#include<stdio.h>

void main()
{
int n;
printf("Enter the number : ");
scanf("%d",&n);
for(int i=n; i>0; i--)
{
for(int j=n; j>=i; j--)
{
printf("%d",j);
}
printf("\n");
}
}

----------------------------------------------------------------

import time as q

x="RAJVI"
a="Peacefully flute player"

b=len(x)
def cake():
print(" "*23,"i i i i")
y=q.sleep(1)
print(" "*23,"i i i i")
y=q.sleep(1)
print(" "*22,"_i_i_i_i_")
y=q.sleep(1)
print(" "*20,"|"," "*9,"|")
y=q.sleep(1)
print(" "*20,"|"," "*9,"|")
y=q.sleep(1)
print(" "*20,"|"," "*9,"|")
y=q.sleep(1)
print(" "*16,"-"*21)
y=q.sleep(1)
print(" "*16,"|"," "*17,"|")
y=q.sleep(1)
print(" "*16,"|"," "*int((17-b)/2-1),x," "*int((17-b)/2-1),"|")
y=q.sleep(1)
print(" "*16,"|"," "*17,"|")
y=q.sleep(1)
print(" "*16,"-"*21)

def menu():
print()
for i in range(4):
if i==3:
print(" "*13,"HAPPY HAPPY BIRTHDAY TO YOU")
elif i==0 or i==1:
print(" "*15,"HAPPY BIRTHDAY TO YOU")
elif i==2:
print(" "*15,"HAPPY BIRTHDAY","'",a.upper(),"'","\n")
q.sleep(1.8)
print()

menu()
cake()

print(" "*14,"MANY MANY RETURNS OF THE DAY 'M sq'\n \n\n".upper())


q.sleep(2)
x="Happy, healthy, rocking birthday to you RAJVI"
a=x.split()
for i in a:
print("\t\t",i.title())
q.sleep(1)
print("")
q.sleep(2)
print(" "*18,"god blass you".upper())
q.sleep(1)
print("\n")
print(" "*18,"Your all names".upper())
q.sleep(1)
print(" "*18,"* RAJVI".upper())
q.sleep(1)
print(" "*18,"* Master mind".upper())
q.sleep(1)
print(" "*18,"* madam".upper())
q.sleep(1)
print(" "*18,"* lady don".upper())
q.sleep(1)
print(" "*18,"* Artist".upper())
q.sleep(1)
print(" "*18,"* peacefully flute player".upper())
q.sleep(1)
print(" "*18,"* etc.. ke je mane khabar nathi ka to atyare yadd nathi".upper())
q.sleep(1)
print("\n")
print(" "*18,"Your emojis".upper())
q.sleep(1)
print(" "*18,"* 😁".upper())
q.sleep(1)
print(" "*18,"* 😂".upper())
q.sleep(1)
print(" "*18,"* 😎".upper())
q.sleep(1)
print(" "*18,"* ‍
".upper())
q.sleep(1)
print(" "*18,"* 😆".upper())
q.sleep(1)
print(" "*18,"* 😌".upper())
q.sleep(1)
print(" "*18,"* 🤨".upper())
q.sleep(1)
print(" "*18,"* 🥴".upper())
q.sleep(1)
print(" "*18,"* 😏".upper())
q.sleep(1)
print(" "*18,"* 😜".upper())
q.sleep(1)
print("\n")
print(" "*18,"your dialogues".upper())
q.sleep(1)
print(" "*18,"* Ha ho ha jara pn maja na avi 😂".upper())
q.sleep(1)
print(" "*18,"* jutthu nai bolvanu 😂".upper())
q.sleep(1)
print(" "*18,"* haye 😂".upper())
q.sleep(1)
print(" "*18,"* ha ho haa 😂".upper())
q.sleep(1)
print(" "*18,"* Ha ha bau saru ha 😂".upper())
q.sleep(1)
print(" "*18,"* Ji ha 😂".upper())
q.sleep(1)
print(" "*18,"* Bhale 😂".upper())
q.sleep(1)

You might also like