Docsity

Cs508 it is a programming notes, Quizzes of Java Programming

Toggle sidebar
bg1
Convert the followings into Prolog rules,
1. Socrates is a mortal if he is human
2. X is an animal if X eats grass
3. X is a sportsperson if X plays football
List down at least three design issues of user-located loop control mechanisms.
Write the name of function in LISP that returns the difference of the two lists. Now, use this
function to return the difference of two lists L3 and L4.
Name any three browser objects in JavaScript.
Suppose, there is a class named "ThreadExample" in a typical Java program, which
implements runnable interface to create a thread. You are required to write a simple program
to start a thread by creating an object of ThreadExample class.
Note: You are required to write Java code for main method, to create an object of
ThreadExample class and a statement to start thread.
public class Test {
// write your code here…
}
Complete the missing code given below written in C#, to fulfill/following requirements.
1) Declare a two-dimensional/array of integer type having 3/rows and 4 columns.
2) Values "5" is assigned to row number 2, and column number 1.
3) /Values "7" is assigned to row number 3, and column number 4.
/
Dotted lines represent the missing code.
/
1. ….…….……. [,] array ;
2. array = new int [….…….…….] ;
3. array [….…….…….] = 5 ;
4. array [….…….…….] = 7 ;
/
Note: No need to write code again, just write the missing parts as shown below;
1. ….…….…….….…….…….
2. ….…….…….….…….…….
3. ….…….…….….…….…….
4. ….…….…….….…….…….
/
pf2

Partial preview of the text

Download Cs508 it is a programming notes and more Quizzes Java Programming in PDF only on Docsity!

Convert the followings into Prolog rules,

  1. Socrates is a mortal if he is human
  2. X is an animal if X eats grass
  3. X is a sportsperson if X plays football List down at least three design issues of user-located loop control mechanisms. Write the name of function in LISP that returns the difference of the two lists. Now, use this function to return the difference of two lists L3 and L4. Name any three browser objects in JavaScript. Suppose, there is a class named " ThreadExample " in a typical Java program, which implements runnable interface to create a thread. You are required to write a simple program to start a thread by creating an object of ThreadExample class. Note: You are required to write Java code for main method, to create an object of ThreadExample class and a statement to start thread. public class Test { // write your code here… } Complete the missing code given below written in C#, to fulfill following requirements.
  1. Declare a two-dimensional array of integer type having 3 rows and 4 columns.
  2. Values "5" is assigned to row number 2, and column number 1.
  3. Values "7" is assigned to row number 3, and column number 4. Dotted lines represent the missing code.
  1. ….…….……. [,] array ;
  2. array = new int [….…….…….] ;
  3. array [….…….…….] = 5 ;
  4. array [….…….…….] = 7 ; Note: No need to write code again, just write the missing parts as shown below;
  5. ….…….…….….…….…….
  6. ….…….…….….…….…….
  7. ….…….…….….…….…….
  8. ….…….…….….…….…….

Can a dangling reference be created in Java? Justify your answer with reasons. Prolog has several syntactic elements, ten (10) of them are as follows; nl, cut, write, not, +, -, <, <=, readint(var), readchar(var) You are required to categorized them according to the type as shown in the table given below. Special Predicates Predefined Predicates Arithmetic Operators Relational Operators You are required to write recursive predicate in PROLOG to sort all elements of a list. Just like all programming languages, PHP also supports user-defined functions. A function is a block of statements that can be used repeatedly in a program. Write a simple function in PHP that displays “Programming is Fun” on screen. Name of function should be DisplayMsg. This function does not accept any arguments. After definition, call this function to show the output.