Home / MCQ Bank / Computer
Computer Basic Syntax In Ruby Difficulty: Medium

What is the correct way to declare and initialize a variable in Ruby?

Select the correct option to test your answer:

More Computer Questions

What will be the output of the following Python code? def example(L): ''' (list) -> list ''' i = 0 result = [] while i < len(L): result.append(L[i]) i = i + 3 return result What does the following piece of code do? for(int i = 0; i < row; i++) { for(int j = 0; j < column; j++) { if(i == j) sum = sum + (array[i][j]); } } System.out.println(sum); A relationship between processes such that each has some part (critical section) which must not be executed while the critical section of another is being executed, is known as Which of the following is not essential to shut down your computer? Find the output of the following code. #include<math.h> #include<iostream.h> using namespace std; void distance(float x, float y, float a, float b, float c) { float d = fabs((a * x + b * y + c)) / (sqrt(a * a + b * b)); cout<<d; return; } int main() { float x = -2; float y = -3; float a = 5; float b = -2; float c = - 4; distance(x, y, a, b, c); return 0; }