diff --git a/AI answers b/AI answers index a56b0fb..940e867 100644 --- a/AI answers +++ b/AI answers @@ -1 +1,49 @@ ADD Artificial Intelligence answers here. +ADD Artificial Intelligence answers here. +import pandas as pd +import numpy as np +def firstanswer(): + a = int(input("enter the number")) + for i in(2,a): + if a %i==0: + print("it is not a prime number") + break + else : + print("it is a prime number") +def secondanswer(): + b= input("enter the string") + b=b[::-1] + print(b) +def thirdanswer(): + data = [['hercules', 69], ['thala', 7], ['darsil', 15]] + df = pd.DataFrame(data, columns=['Name', 'Age']) + print(df) +def forthanswer(): + t = np.arange(1, 10).reshape(3, 3) + print(t) +def fifthanswer(): + a={"thala":12,"divyam":22,"prere":222} + aa = list(a.keys()) + aa.sort() + print(aa) +def sixthanswer(): + def fact(a): + if a==1: + return 1 + if a==0: + return 1 + return fact(a-1)*a + b = fact(5) + print(b) +def sevenanswer(): + arr = np.arange(100) + print(arr) + a1 = np.mean(arr) + print(a1) + a2 = np.std(arr) + print(a2) +#answer 11 is (b) +#answer 12 is (a) +#answer 13 is (b) +#answer 14 is (a) +#answer 15 is (b) diff --git a/CP answers b/CP answers index c0e55e6..9cce71e 100644 --- a/CP answers +++ b/CP answers @@ -1 +1,267 @@ ADD Competitive Programming answers here. +Coding questions + + + + + + + +q1 +#include +int main() +{ + int A,B,product; + printf("Enter two numbers A and B.\n\nA:"); + scanf("%d",&A); + printf("\nB:"); + scanf("%d",&B); + product=A*B; + printf("\nProduct of A and B: %d",product); + return 0; +} + + + + + +q2 +#include +int main() { + int num; + printf("Enter an integer: "); + scanf("%d", &num); + + // true if num is perfectly divisible by 2 + if(num % 2 == 0) + printf("%d is even.", num); + else + printf("%d is odd.", num); + + return 0; +} + + + + + + +q3 +#include + +int main(){ + + int x,fact=1,n; + + printf("Enter a number to find factorial: "); + scanf("%d",&n); + + for(x=1;x<=n;x++) + fact=fact*x; + + printf("Factorial of %d is: %d",n,fact); + + return 0; + +} + + + + + + + +q4 +#include +int main() +{ + int c = 0, count = 0; + char s[1000]; + printf("Input a string\n"); + gets(s); + while (s[c] != '\0') { + if (s[c] == 'a' s[c] == 'A' s[c] == 'e' s[c] == 'E' s[c] == 'i' s[c] == 'I' s[c] =='o' s[c]=='O' s[c] == 'u' || s[c] == 'U') + count++; + c++; + } + printf("Number of vowels in the string: %d", count); + return 0; +} + + + + + + +q5 +#include + +int main() +{ + int array[100], maximum, size, c, location = 1; + + printf("Enter the number of elements in array\n"); + scanf("%d", &size); + + printf("Enter %d integers\n", size); + + for (c = 0; c < size; c++) + scanf("%d", &array[c]); + + maximum = array[0]; + + for (c = 1; c < size; c++) + { + if (array[c] > maximum) + { + maximum = array[c]; + location = c+1; + } + } + + printf("Maximum element is present at location %d and it's value is %d.\n", location, maximum); + return 0; +} + + + + + + + +q6 +#include + +int main() + { + int array[100], minimum, size, c, location = 1; + + printf("Enter the number of elements in array\n"); + scanf("%d",&size); + + printf("Enter %d integers\n", size); + + for ( c = 0 ; c < size ; c++ ) + scanf("%d", &array[c]); + + minimum = array[0]; + + for ( c = 1 ; c < size ; c++ ) + { + if ( array[c] < minimum ) + { + minimum = array[c]; + location = c+1; + } + } + + printf("Minimum element is present at location %d and it's value is %d.\n", location, minimum); + return 0; +} + + + + + + + +q7 +#include + int main() +{ +int a=10, b=20; +printf("Before swap a=%d b=%d",a,b); +a=a+b;//a=30 (10+20) +b=a-b;//b=10 (30-20) +a=a-b;//a=20 (30-10) +printf("\nAfter swap a=%d b=%d",a,b); +return 0; +} + + + + + + +q8 +#include +int main() { + int year; + printf("Enter a year: "); + scanf("%d", &year); + + if (year % 400 == 0) { + printf("%d is a leap year.", year); + } + else if (year % 100 == 0) { + printf("%d is not a leap year.", year); + } + else if (year % 4 == 0) { + printf("%d is a leap year.", year); + } + else { + printf("%d is not a leap year.", year); + } + return 0; +} + + + + + + + +q9 +#include +#include +int main() +{ + char str[40]; + printf (" \n Enter a string to be reversed: "); + scanf ("%s", str); + + printf (" \n After the reverse of a string: %s ", strrev(str)); + return 0; +} + + + + + + +q10 +#include + int main() +{ + int A, B, C; + printf("Enter the numbers A, B and C:\n\nA:"); + scanf("%d", &A); + printf("\nB:"); + scanf("%d", &B); + printf("\nC:"); + scanf("%d", &C); + + if (A >= B && A >= C) + printf("A:%d is the largest number.", A); + + else if (B >= A && B >= C) + printf("\nB:%d is the largest number.", B); + + else + printf("\nC:%d is the largest number.", C); + + return 0; +} + + + + + + + +MCQs +q1 A +q2 B +q3 A +q4 A +q5 C diff --git a/Web Devlopment answers b/Web Devlopment answers index 881ac4f..eff5752 100644 --- a/Web Devlopment answers +++ b/Web Devlopment answers @@ -1 +1,99 @@ ADD Web Development Answers here. +HTML Solutions: +Sol 1. + + +Sol 2. +
+Text in a pre element
+    is displayed in a fixed-width
+font, and it preserves
+both      spaces and
+line breaks
+
+ +Sol 3. +Visit Website + +Sol 4. +
+ + + +
+ +Sol 5. +
    +
  • coffee
  • +
  • tea
  • +
  • milk
  • +
+ + +CSS Solutions: +Sol 1. +p:first-of-type::first-letter { + font-size: larger; + color: red; +} + +p:last-of-type::first-letter { + font-size: larger; + color: blue; +} + +Sol 2. +p { + background-color: black !important; +} + +Sol 3. +.hidden-element { + display: none; +} + +.hidden-element { + visibility: hidden; +} + +.hidden-element { + opacity: 0; +} + +Sol 4. +310 px + +Sol 5. +img { + background-repeat: no-repeat; +} + +JavaScript Solutions: +Sol 1. +var element = document.getElementById("Id"); + +Sol 2. +var button = document.getElementById("Id"); + +button.addEventListener("click", function() { + //Write Code +}); + +Sol 3. +setTimeout(function() { + console.log("Hello"); +}, 2000); + +Sol 4. +2 +4 +3 +1 + + +Sol 5. +const myObject = { key1: 'value1', key2: 'value2', key3: 'value3' }; + +for (var key in myObject) { + console.log(key); +}