← 목록

Synth · CodeAlpaca일부

총 20,022개 · 페이지 431/668
🔀 랜덤
불러오는 중…

[output] | <html> <head> <style> .background { background-color: #000; } </style> </head> <body> <div class="background" style="background-color: #FFFF00;"></div> </body> </html> [instruction] | Produce HTML output with a yellow background using the following CSS style. [input] | .background { background-color: #000; }

[output] | #!/bin/bash # Simple bash script # Store name in a variable name="World" # Print message echo "Hello $name" [instruction] | Analyze and improve the following basic shell script. [input] | #!/bin/bash # simple bash script echo "Hello World"

[output] | sort_by_length = lambda words: sorted(words, key=len) [instruction] | Rewrite the following python code to an equivalent code using lambda and sorted function. [input] | def sort_by_length(words): return sorted(words, key=lambda x: len(x))

[output] | let array = [2, 3, 4, 1, 3]; let unique_elements = [...new Set(array)]; console.log(unique_elements); // [2, 3, 4, 1] [instruction] | Suggest a functional Node.js program to output the unique elements of an array. [input] | let array = [2, 3, 4, 1, 3]

[output] | function getStudents(){ const students = [ {name: "Tom", age: 17}, {name: "Jack", age: 16}, {name: "Jill", age: 13}, {name: "Dave", age: 21}, ]; return students; } [instruction] | How can we extend the following JavaScript program to add two more students? [input] | function getStudents(){ const students = [ {name: "Tom", age: 17}, {name: "Jack", age: 16}, ]; return students; }

[output] | #include <stdio.h> int Fibonacci(int n) { int a = 0, b = 1, c; if (n == 0) return a; for (int i = 2; i <= n; i++) { c = a + b; a = b; b = c; } return b; } [instruction] | How can the following C code for Fibonacci Series be modified to include the nth element? [input] | #include <stdio.h> int Fibonacci(int n) { if (n <= 1) return n; return Fibonacci(n-1) + Fibonacci(n-2); }

[output] | .box { width: 300px; height: 200px; background: #fff; border-radius: 10px; border: 1px solid gray; box-shadow: 2px 5px 10px gray; padding: 10px; } [instruction] | Write a CSS program to create a rectangular box with rounded corners, border and a drop shadow. [input] |

[output] | # Project Name project = 'questions_and_answers' # Application Name application = 'qa_app' # Create the project directory import os if not os.path.exists(project): os.mkdir(project) # Create the Django application from django.core.management import call_command call_command('startapp', applic [instruction] | Create a Django application to store and retrieve questions and answers. [input] |

[output] | let grades = [ {name: 'John', score: 90, grade: 'A'}, {name: 'Jack', score: 80, grade: 'B'}, {name: 'Jill', score: 85, grade: 'B+'}, ]; grades = grades.map(grade => { let letter; if (grade.score >= 90) { letter = 'A'; } else if (grade.score >= 80) { letter = 'B'; } else if (gr [instruction] | How can the following JavaScript program be modified to include a letter grade for each student score? [input] | let grades = [ {name: 'John', score: 90}, {name: 'Jack', score: 80}, {name: 'Jill', score: 85}, ]

[output] | def printFibonacciSeries(n): a, b = 0, 1 for i in range(0, n): print(a) c = a + b a = b b = c printFibonacciSeries(10) [instruction] | Write a code to print the Fibonacci series of n terms. [input] |

[output] | <!DOCTYPE html> <html> <head> <title>User Registration Form</title> </head> <body> <h1>User Registration Form</h1> <form> <input type="text" name="name" placeholder="Enter your name"> <input type="email" name="email" placeholder="Enter your email"> <input type="pa [instruction] | Write an HTML page to display a form for user registration. [input] |

[output] | let arrayLength = 10; let randomArray = []; for (let i = 0; i < arrayLength; i++) { randomArray.push(Math.random()); } console.log(randomArray); [instruction] | Generate an array of random numbers using the JavaScript Math.random() function. [input] | Array length :10

[output] | let paragraph = "This is a pleasant evening. I prefer to stay at home for the evening."; let words = paragraph.split(' '); let countSingularWords = 0; let countPluralWords = 0; for (let i = 0; i < words.length; i++) { let lastChar = words[i].charAt(words[i].length-1); if (lastChar === 's') { [instruction] | Write a code to find the number of singular and plural words in a given paragraph. [input] | This is a pleasant evening. I prefer to stay at home for the evening.

[output] | let studentData = { "1": { "name": "John", "age": "18", "country": "USA" }, "2": { "name": "Peter", "age": "20", "country": "UK" }, "3": { "name": "Anna", "age": "19", "country": "USA" }, "4": { "name": "Steven", "age": "22", "country": " [instruction] | Create an associative array containing 8 records of student data. [input] |

[output] | def printPalindromicNumbers(n): for num in range(1, n + 1): s = str(num) if(s == s[::-1]): print(num, end=" ") printPalindromicNumbers(100) [instruction] | Write a code to identify palindromic numbers between 1 and a given number n. [input] |

[output] | fgets() is a JavaScript function for reading contents of a file is incorrect. The correct statement is fgets() is a PHP function for reading contents of a file. [instruction] | Identify which of the given statements is incorrect. [input] | - fopen() is a PHP function for opening a file - fgets() is a JavaScript function for reading contents of a file - fread() is a PHP function for reading contents of a file

[output] | class TV { public: TV(); // Constructor void turnOn(); void turnOff(); void switchChannel(); }; [instruction] | Create a C++ class called "TV". [input] |

[output] | def multiply(x, y): return x * y [instruction] | Write a code to define a function to multiply two numbers passed as arguments. [input] |

[output] | class IntToString { public static String intToString(int n) { String s = String.valueOf(n); return s; } } [instruction] | Create a class and a method to convert an integer to a string. [input] |

[output] | def capitalize_names(names): new_names = [] for name in names: new_name = name[0].capitalize() + name[1:] new_names.append(new_name) return new_names [instruction] | Create a function that takes a list of strings and returns a new list of strings with the first letter of each string as capital. [input] | names = ["mary", "john", "joseph"]

[output] | def are_all_characters_unique(string): seen_characters = set() for c in string: if c in seen_characters: return False seen_characters.add(c) return True [instruction] | Create a function that takes a string as an argument and checks if all the characters in the string are unique, and returns a boolean. [input] |

[output] | def spiral_print(a): m = len(a) n = len(a[0]) t = 0 #top b = m-1 #bottom l = 0 #left r = n-1 #right dir = 0 while l<=r and t<=b: if dir == 0: for i in range(l, r+1): print(a[t][i], end=" ") t += 1 elif di [instruction] | Create a program that prints a given 2D array in a spiral form. [input] | a = [[1,2,3],[4,5,6],[7,8,9]]

[output] | The declaration let myArray = [] in JavaScript is declaring a variable myArray which is an empty array. [instruction] | What does this declaration mean in JavaScript ? [input] | let myArray = []

[output] | The variable name arraySize in JavaScript is used to describe the size of an array, that is, the number of elements in the array. [instruction] | Describe the meaning of the variable name ‘arraySize’ in JavaScript [input] |

[output] | function helloWorld() { return "Hello World"; } [instruction] | Draft a Javascript function that takes no arguments and returns ‘Hello World’ [input] |

[output] | let myVar = "Hello World"; [instruction] | Assign a variable in JavaScript. [input] |

[output] | let doubledNums = nums.map(x => x * 2); [instruction] | Write code to create a new array with elements that are the doubled values of each element in the original array. [input] | let nums = [1, 2, 3, 4];

[output] | The typeof operator in JavaScript is used to determine the type of a value. It can be used to determine the type of primitives, such as string, number, boolean, null, undefined, and Symbol, and the type of objects. It returns a string indicating the type of the argument. [instruction] | What does typeof do in JavaScript? [input] |

[output] | In Javascript, one can comment multiple lines by enclosing the code or text within the /* and */ symbols. For example: /* This is an example of a multi-line comment */ [instruction] | How do you comment multiple lines in JavaScript? [input] |

[output] | * { font-size: 14px; } [instruction] | Create a CSS rule to make all text in a webpage to have font-size 14px. [input] |

← → 방향키로 페이지 이동 · 숫자 입력 후 Enter로 점프